This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Only a user can upload their profile picture, but anyone can view it | |
| match /users/{userId}/profilePicture.png { | |
| allow read; | |
| allow write: if request.auth.uid == userId; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Require authentication on all internal image reads | |
| match /internal/{imageId} { | |
| allow read: if request.auth != null; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Anyone to read a public image if the file is less than 100kB | |
| // Anyone can upload a public file ending in '.txt' | |
| match /public/{imageId} { | |
| allow read: if resource.size < 100 * 1024; | |
| allow write: if imageId.matches(".*\\.txt"); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Partial match for files that start with "images" | |
| match /images { | |
| // Exact match for "images/*" | |
| // e.g. images/profilePhoto.png is matched | |
| match /{imageId} { | |
| // This rule only matches a single path segment (*) | |
| // imageId is a string that contains the specific segment matched | |
| allow read: if <condition>; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Partial match for files that start with "images" | |
| match /images { | |
| // Exact match for "images/profilePhoto.png" | |
| match /profilePhoto.png { | |
| allow write: if <condition>; | |
| } | |
| // Exact match for "images/croppedProfilePhoto.png" | |
| match /croppedProfilePhoto.png { | |
| allow write: if <other_condition>; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Exact match for "images/profilePhoto.png" | |
| match /images/profilePhoto.png { | |
| allow write: if <condition>; | |
| } | |
| // Exact match for "images/croppedProfilePhoto.png" | |
| match /images/croppedProfilePhoto.png { | |
| allow write: if <other_condition>; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // If no condition is specified, the rule evaluates to true | |
| allow read; | |
| // Rules can optionally specify a condition | |
| allow write: if <condition>; | |
| // Rules can also specify multiple request methods | |
| allow read, write: if <condition>; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| service firebase.storage { | |
| match /b/{bucket}/o { | |
| match /images/{imageId} { | |
| // Only allow uploads of any image file that's less than 5MB | |
| allow write: if request.resource.size < 5 * 1024 * 1024 | |
| && request.resource.contentType.matches('image/.*'); | |
| } | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.example.demodemo; | |
| import android.content.Intent; | |
| import android.os.Bundle; | |
| import androidx.annotation.Nullable; | |
| import androidx.appcompat.app.AppCompatActivity; | |
| import android.util.Log; | |
| import android.view.View; | |
| import android.widget.Button; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //put these in the beginning of the MainActivity class | |
| CallbackManager callbackManager; | |
| LoginButton loginButton; |