Reputation: 113
I am trying to build a semi social media app that has friends. On the friends page, I want the user to see posts only made by their friends.
I am using FirebaseRecyclerAdapter and query.
The friend data is saved like this:
Friends:
userA:
userB: true
userC: true
How do I set the query so that userA is able to userB and Cs posts?
Upvotes: 0
Views: 411
Reputation: 138969
To solve this, you need to query your database twice. First of all you need to query Friends -> userA
to see which friends have the value set to true
and then get them. Based on userB
, userC
you need to query again, to find actually the posts corecponding to this users. Assuming that your database looks like this Friends -> userB -> Posts>
and Friends -> userC -> Posts>
, you need to query only this posts.
Hope it helps.
Upvotes: 0