firebase-realtime-database

iOS: display firebase data in tableView

落花浮王杯 提交于 2021-02-20 04:49:48
问题 I try to display data from a Firebase database into my tableView. The code worked using "Tabs View Controller", but for the purpose of the project I had to include a TableView in a classic ViewController. Here is the code that should get the data from the database, and further include it in the tableview. import UIKit import Firebase import FirebaseAuth import FirebaseDatabase class NewsfeedViewController: UIViewController, UITableViewDataSource, UITableViewDelegate { var ref

In Firebase Realtime Database Rules, how do you give write access to the users with a certain child value?

ぃ、小莉子 提交于 2021-02-20 00:49:10
问题 ,"people" : { ".read": "auth != null", "$uid": { }, "e2" : { ".read": "auth.uid != null", ".write": "$uid == auth.uid" }, "l1" : { ".read": "auth.uid != null", ".write": "auth.uid != null" } So e2 is the @ of an email. For example @gmail or @aol or @yahoo. For the l1 child, I want to make the write rule: Write if auth.uid != null && e2 has the same value as the e2 of the person you are writing l1 to. The furthest I could get, is something like this: "data.parent().child(people).hasChildren([

Encrypt chat messages stored in Firebase Database

不打扰是莪最后的温柔 提交于 2021-02-19 14:02:53
问题 I am making an application in which chatting is also a feature for which I am using firebase realtime database. Though all the data stored in firebase is via SSL but I want that even the administration is not able to see that messages. I thought of implementing the end-to-end encryption by using the public and private key architecture, but storing the private key on device won't be good as a new private key will be created when the phone is uninstalled or even when the app is used in another

React Not Updating Render After SetState

匆匆过客 提交于 2021-02-19 05:38:40
问题 I've played around with the code for a while now. I'm grabbing data from Firebase and populating a list of objects from that data onto this UserProfile page. I just want it to work so that when I go on the profile page, a list of their items is listed there. The problem is that with this version of the code I have to click on the profile link twice for the items to show up, but the display name shows up fine. I know setState is asynchronous. I've tried setting the state in a callback in

Debugging Firebase functions locally (node.js)

时光怂恿深爱的人放手 提交于 2021-02-19 05:34:20
问题 see below my code is very simple....it listens to a change on a database field in realtime-database. const functions = require("firebase-functions"); var admin = require("firebase-admin"); exports.onActiveUpdate = functions.database .ref("/profiles/users/{userId}/active") .onUpdate((change, context) => { //code here return true; }); Ive tried to debug code locally with the following commands firebase serve --only functions firebase serve firebase emulators:start I always get the same message.

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,

How to distinguish between the reasons Firebase Transactions return null?

僤鯓⒐⒋嵵緔 提交于 2021-02-18 15:01:13
问题 From my understanding of Transactions, it can return null for two reasons: There is actually no value at the node where the transaction is being performed. The local cache is empty as Firebase Cloud Functions is stateless. Therefore, it may return null the very first time and it will re-run the function. My question is, how do we distinguish between these two cases? Or does firebase do the distinction by itself? Myref.transaction(function(currentData) { if(currentData != null) { return

Firebase Realtime Database Pricing with Query

流过昼夜 提交于 2021-02-18 08:07:50
问题 I have a question about the firebase database pricing. I have about 400,000 rows in the leaderboard of my database, but in my app I just want to load the last 500 rows, so my question will I get charged for the 500 rows loaded when I run the query or will I get charged for all 400,000 rows. Realtime database charges 5$ per gb stored and 1$ per gb downloaded. I did the calculation with Firestore and found that Realtime Database would be way cheaper if i get charged for the 500 rows and not the

wait for two asynchronous completion functions to finish, before executing next line code

对着背影说爱祢 提交于 2021-02-18 03:40:50
问题 I have two functions: func Females_NonChat() and func males_NonChat() I want to wait for both of them to finish before executing the print statement in viewdidload. Do I need another completion handler to accomplish that? Those functions used are firebase completion handlers for requesting information from the online database... override func viewDidLoad() { super.viewDidLoad() func Females_NonChat() func males_NonChat() print("finished executing both asynchronous functions") } func Females