firebase-realtime-database

How to setup a Bar Button with a value of firebase?

China☆狼群 提交于 2021-01-29 08:00:39
问题 I want to check if the user is a admin or not. If the user is a admin, I want to show a bar button. If not, the bar button should be hidden. I call the following code in viewDidLoad : @IBOutlet weak var beitraegeMelden: UIBarButtonItem! var admin = false func setupBarButton() { observeAdmin() if admin == true { self.beitraegeMelden.isEnabled = true self.navigationItem.rightBarButtonItem = self.beitraegeMelden } else { self.beitraegeMelden.isEnabled = false self.navigationItem

How to stop Firebase Listener when i pass to another screen?

白昼怎懂夜的黑 提交于 2021-01-29 07:28:32
问题 I'm using Firebase Listener with on method in Redux action for getting data in a Screen. Here is my redux action code below: export const getSelectedProjectDetail = (groupUid, projectUid) => dispatch => { dispatch({ type: GET_SELECTED_PROJECT_DETAIL_START, }); firebase.database().ref('/groups/' + groupUid + '/projects/' + projectUid).on('value', (mainSnap) => { firebase .database() .ref('/users/' + mainSnap.val().creator.uid) .on('value', snapshot => { const messagesList = _.map(mainSnap.val(

Firebase security rules to read partial objects [duplicate]

爱⌒轻易说出口 提交于 2021-01-29 07:21:58
问题 This question already has an answer here : Firebase: How to structure public/private user data (1 answer) Closed 2 years ago . I can't figure out how to filter data using Firebase database. I've read that rules can't be used for filters. But then how? I'd like a datastructure somewhat like the one below. i.e. a list of posts created by different users due for a specified time (user-id is not included in the layout below as I'm not sure where to put it) posts: { "-LKwbZsfy55d24kwX4t1" : { when

firebase realtime database reads data that doesnt exist

北城余情 提交于 2021-01-29 06:42:36
问题 we came across what might be a major bug in the firebase database, pls see code below. the code below tries to set a value to a child "EXAMPLE" which doesnt have a read or write permission. the write operation doesn't write anything to the database and throws an error " setValue at /EXAMPLE/VALUE failed: DatabaseError: Permission denied" in the log, which is a good thing. however a major issue is with the code that comes after which tries to read the value of child "EXAMPLE", the code

How to create new element and render data each time the data is fetched in react

╄→гoц情女王★ 提交于 2021-01-29 06:40:50
问题 I am new to react and I need to render and list data fetched from firebase to the html I tried doing this, const Music = ({ match }) => { const [title, setTitle] = useState(null) const [user, setUser] = useState(null) const [pfp, setPfp] = useState(null) const { params: { uID } } = match; useEffect(()=>{ firebase.database().ref("users/"+uID+"/public/songs/").on("value", (snapshot)=>{ var musics = snapshot.val() Object.values(musics).forEach((value)=>{ //I need to render this title each and

Accessing Firestore from Firebase Realtime Database Security Rules

♀尐吖头ヾ 提交于 2021-01-29 06:28:57
问题 I'm actively using both of Firebase Realtime Database and Firestore. There is a case in which I need to check a document on Firestore to allow user to write on Firebase Realtime Database. Basically, I need to access user's document in the users collection on Firestore to allow user to create a post under the posts node on Firebase Realtime Database. Is something like this possible, by any chance? "rules": { "posts": { ".write": "get(/databases/$(database)/documents/users/$(auth.uid)).data

Accessing Firestore from Firebase Realtime Database Security Rules

感情迁移 提交于 2021-01-29 06:22:54
问题 I'm actively using both of Firebase Realtime Database and Firestore. There is a case in which I need to check a document on Firestore to allow user to write on Firebase Realtime Database. Basically, I need to access user's document in the users collection on Firestore to allow user to create a post under the posts node on Firebase Realtime Database. Is something like this possible, by any chance? "rules": { "posts": { ".write": "get(/databases/$(database)/documents/users/$(auth.uid)).data

count the nodes of a child in the firebase

萝らか妹 提交于 2021-01-29 06:10:13
问题 I have a structure like this in firebase: Inside the node 'postagens-curtidas', I need to count this childrens and save this value at the 'qtdCurtidas' node, as the photo shows. Is there a way to make this? 回答1: final long count; DatabaseReference ref = FirebaseDatabase.getInstance().getReference(); ref.child("postagens-curtidas").addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { count = dataSnapshot

How do you force the ViewController to export the data in 'b' instead of 'a' to the next VC?

荒凉一梦 提交于 2021-01-29 06:05:30
问题 This is my first attempt at XCode, used to work on MatLab so very new to this. I have a VC here (named guests2ViewController) which I'm trying to send data to the next VC (named resultsViewController). Unfortunately the VC is exporting the data from the lines (print "b") instead of the earlier lines (print "a"). Why is this, and how could I fix it? override func prepare(for segue: UIStoryboardSegue, sender: Any?) { let vc = segue.destination as? resultsViewController if segue.identifier ==

Android studio comment posting page not working

本秂侑毒 提交于 2021-01-29 06:04:19
问题 I want to make a comment page like Instagram in the project I have done on Android studio. The comment fragment is coming, but when I write the comment and send it, it stops.Comments section does not occur in the firebase.I want to post comments on my project and then see those comments.The run part expresses like this. I have searched but could not find AndroidManifest.xml: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package=