firebase

Firebase rules: dynamically give access to a specific user

前提是你 提交于 2021-02-19 02:31:12
问题 I'm building an Android app which requires me to store some pictures for the user. Let's say I have 2 users: A and B. They should be able to read / write on their specific folders: user A can read and write to bucket/images/userA and user B can read and write to bucket/images/userB. They should not have access to anything else. Now let's say user A uploaded picture1.jpg and picture2.jpg. How can user A grant access to bucket/images/userA/picture1.jpg to user B? User B should not have access

Converting Firebase Datasnapshot to codable JSON data

ぃ、小莉子 提交于 2021-02-19 02:26:21
问题 I am using Firebase Database and am attempting to retrieve and use data using NSObject. I am receiving a NSUnknownKeyException error when running the app causing it to crash. NSObject: class WatchList: NSObject { var filmid: Int? } Firebase Code: ref.child("users").child(uid!).child("watchlist").observe(DataEventType.childAdded, with: { (info) in print(info) if let dict = info.value as? [String: AnyObject] { let list = WatchList() list.setValuesForKeys(dict) print(list) } }, withCancel: nil)

Deployment error. Build failed: Build error details not available. Firebase Cloud Functions

丶灬走出姿态 提交于 2021-02-19 02:15:07
问题 I reinstalled multiple times NPM and Node on my pc. (npm version 7.4.3) (node version v15.7.0) I followed the procedure for configuring the Firebase CLI with: npm install -g firebase-tools and firebase init and firebase deploy and the configuration seems to work fine. The problem I'm facing happens when I open the index.js file and I uncomment the stock helloWorld function which looks like this: exports.helloWorld = functions.https.onRequest((request, response) => { functions.logger.info(

Cloud Firestore - Dynamic Querying

独自空忆成欢 提交于 2021-02-19 01:32:05
问题 I have a Collection in Cloud Firestore that has a certain number of items, let's call it Collection "X". This number of items will constantly be changing. At any given time, I want to listen for the number of items in this Collection and create several whereEqualto() calls on a Query object that is based on another 'Collection', let's call it "Y": Query queryStore = FirebaseFirestore.getInstance() .collection("Y") .whereEqualTo(USER_ID_LABEL, "item 1 from X") .whereEqualTo(USER_ID_LABEL,

Flutter :[cloud_firestore/unknown] NoSuchMethodError: invalid member on null: 'includeMetadataChanges' (Flutter Web)

烂漫一生 提交于 2021-02-18 22:20:06
问题 I am trying to fetch data from Friebase-firestore and then convert it to model, I used the same code and approach to another project (web project) ,it works fine , but with this project it doesn't work ,I don't know why. I upgrade flutter version, run Flutter doctor , and nothing wrong with the environment setup. here is the code : class dbService{ static final CollectionReference myCollection = FirebaseFirestore.instance.collection('myCollection'); static Future<myModel> getMyInfo() async{

How to add testInstrumentation environment variable for firebase testlab?

旧时模样 提交于 2021-02-18 18:57:43
问题 If i am going to run espresso test locally and pass enviroment variable i can do this by adding defaultConfig { testInstrumentationRunnerArgument 'USERNAME' 'David' } in build.gradle file then i can call this variable by InstrumentationRegistry.getArguments().getString("USERNAME") but when i run this on firebase testlab instrumentationrunner argument are not working 回答1: This is not supported in Test Lab. If you really need to do this, there's a workaround by overriding the test runner and

How to add testInstrumentation environment variable for firebase testlab?

喜欢而已 提交于 2021-02-18 18:55:26
问题 If i am going to run espresso test locally and pass enviroment variable i can do this by adding defaultConfig { testInstrumentationRunnerArgument 'USERNAME' 'David' } in build.gradle file then i can call this variable by InstrumentationRegistry.getArguments().getString("USERNAME") but when i run this on firebase testlab instrumentationrunner argument are not working 回答1: This is not supported in Test Lab. If you really need to do this, there's a workaround by overriding the test runner and

Firebase connection detection does not work after 60 seconds

北慕城南 提交于 2021-02-18 18:15:54
问题 As explained in some answers: On Android, Firebase automatically manages connection state to reduce bandwidth and battery usage. When a client has no active listeners, no pending write or onDisconnect operations, and is not explicitly disconnected by the goOffline method, Firebase closes the connection after 60 seconds of inactivity. The problem is that after 60s, even after I go to an activity with a complete new reference, event listener, etc.. It still says it is disconnect, when in fact,

Firebase connection detection does not work after 60 seconds

强颜欢笑 提交于 2021-02-18 18:15:21
问题 As explained in some answers: On Android, Firebase automatically manages connection state to reduce bandwidth and battery usage. When a client has no active listeners, no pending write or onDisconnect operations, and is not explicitly disconnected by the goOffline method, Firebase closes the connection after 60 seconds of inactivity. The problem is that after 60s, even after I go to an activity with a complete new reference, event listener, etc.. It still says it is disconnect, when in fact,

Flutter app crashes on concurrent transactions performed on cloud Firestore

允我心安 提交于 2021-02-18 17:49:36
问题 I am trying to develop an app where multiple users log in and completes a poll concurrently. In this, as soon as user submits the answer the transaction is ran to increment the counter for given answer try { DocumentSnapshot freshsnap = await tx.get(reff); try { await tx.update(reff, <String, dynamic>{ '$i': freshsnap['$i'] + 1, }); } catch (error) { print("Error" + error.code); } } catch (error) { if (error is PlatformException && error.code == 'Error performing transaction') { // await tx