firebase-realtime-database

Finding an UID by email in Firebase

做~自己de王妃 提交于 2021-02-16 14:07:22
问题 I first attempted to instantiate each user in the database like so: emails : { email: "jerry@gmail.com" { uid: "x" } } I quickly found out that I can't store an email because it has an @ and . . I was originally going to do an user look up like so: func userLookUpByEmail (email: String) -> String { var userID: String = "nil" ref.queryOrderedByChild("emails").queryEqualToValue(email).observeSingleEventOfType(.ChildAdded, withBlock: { snapshot in if snapshot.value != nil { print(snapshot.value)

How to know which offline data has been synced to firebase Realtime Database

扶醉桌前 提交于 2021-02-16 09:32:53
问题 I'm writing a chat application with the help of firebase.Here I have a problem , if the device is offline the data is stored in cache and when device is back online the cache will be synced , but how to know which data is synced and which not (User may have poor internet connection , so syncing may be delayed).How to notify user that message has been sent or sending , and that too we need to manage a huge list of messages Thank you! 回答1: There are two ways: Using a completion listener as

How does .indexOn works with users and unique keys?

烂漫一生 提交于 2021-02-15 07:49:05
问题 I am confused with index rules in firebase. I have this database and I wanted to extract distance_traveled in battery_and_cables . The thing is, 1 is something like a userID set by the user itself so that will vary. I used this code in pyrebase to extract the distance_traveled db.child("mileage_maintenance").order_by_child("distance_traveled").get() but I get Index not defined, add ".indexOn": "distance_traveled", for path "/mileage_maintenance", to the rules This is my database: Any my rules

How does .indexOn works with users and unique keys?

て烟熏妆下的殇ゞ 提交于 2021-02-15 07:49:04
问题 I am confused with index rules in firebase. I have this database and I wanted to extract distance_traveled in battery_and_cables . The thing is, 1 is something like a userID set by the user itself so that will vary. I used this code in pyrebase to extract the distance_traveled db.child("mileage_maintenance").order_by_child("distance_traveled").get() but I get Index not defined, add ".indexOn": "distance_traveled", for path "/mileage_maintenance", to the rules This is my database: Any my rules

How does .indexOn works with users and unique keys?

 ̄綄美尐妖づ 提交于 2021-02-15 07:49:03
问题 I am confused with index rules in firebase. I have this database and I wanted to extract distance_traveled in battery_and_cables . The thing is, 1 is something like a userID set by the user itself so that will vary. I used this code in pyrebase to extract the distance_traveled db.child("mileage_maintenance").order_by_child("distance_traveled").get() but I get Index not defined, add ".indexOn": "distance_traveled", for path "/mileage_maintenance", to the rules This is my database: Any my rules

Hide recyclerview when there is no item to show with condition

三世轮回 提交于 2021-02-15 07:48:30
问题 I am facing a problem to hide RecyclerView . From Last 2 night's I am looking for the solution but I have failed to find it. I am using firebase recycleradapter to show value in recyclerview . When ever someone click the viewholderitem i save his Uid under the datasnapshot key. So to show the value if datasnapshot don't have the uid key show the value in recyclerview . If the datasnapshot have the uid key don't show his data . everything works fine . But i want to hide the recyclerview and

Firebase realtime database validation username and email

北慕城南 提交于 2021-02-15 07:40:21
问题 Recently found out the database rules can be set to validate whether the database already have the same data but currently it just accepted same data to insert but how to validate and prevent same input of username and email? { "rules": { ".read": true, ".write": true, "username":{ ".validate": "!root.child('username').child(newData.val()).exists()" }, "email":{ ".validate": "!root.child('email').child(newData.val()).exists()" } } } The root child is created by email authentication uid and

Firebase realtime database validation username and email

ε祈祈猫儿з 提交于 2021-02-15 07:40:20
问题 Recently found out the database rules can be set to validate whether the database already have the same data but currently it just accepted same data to insert but how to validate and prevent same input of username and email? { "rules": { ".read": true, ".write": true, "username":{ ".validate": "!root.child('username').child(newData.val()).exists()" }, "email":{ ".validate": "!root.child('email').child(newData.val()).exists()" } } } The root child is created by email authentication uid and

How to update Firebase data to the React application in realtime

十年热恋 提交于 2021-02-12 09:27:22
问题 I'm developing an application that updates Firebase data in realtime to React. What I want to do is that a user updates the state in the app, at the same time it should be updated for another user. I have built it done but it continually renders renderStatus() and it's too slow. I want to make it updated once RDB data updated. class Status extends Component { constructor(props) { super(props); this.state = { to_status: false, from_status: false }; } // change the state in RDB handleSatus = ()

How to update Firebase data to the React application in realtime

雨燕双飞 提交于 2021-02-12 09:27:11
问题 I'm developing an application that updates Firebase data in realtime to React. What I want to do is that a user updates the state in the app, at the same time it should be updated for another user. I have built it done but it continually renders renderStatus() and it's too slow. I want to make it updated once RDB data updated. class Status extends Component { constructor(props) { super(props); this.state = { to_status: false, from_status: false }; } // change the state in RDB handleSatus = ()