Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solves multiple group storing issue. #28

Merged
merged 1 commit into from
Jun 30, 2019
Merged

Conversation

DreamyPhobic
Copy link
Collaborator

@DreamyPhobic DreamyPhobic commented Jun 4, 2019

Closes #27
Screenshot from 2019-06-05 01-10-28

@@ -364,10 +363,11 @@ public void onSuccess(PendingDynamicLinkData pendingDynamicLinkData) {
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
Group group = new Group((String)dataSnapshot.child("id").getValue(),(String)dataSnapshot.child("name").getValue(),0);
new SubscribeNotificationGroup(MainActivity.this,group.getId(),getActiveUser()).execute();
DatabaseReference databaseReference = FirebaseDatabase.getInstance().getReference().child("clients").child(getActiveUser()).child("groups");
DatabaseReference databaseReference = FirebaseDatabase.getInstance().getReference().child("clients").child(getActiveUser()).child("groups").push();
databaseReference.child("id").setValue(group.getId());
databaseReference.child("name").setValue(group.getName());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes look good but why is the Firebase database being modified here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually before, on subscribing to a new group, it was overwriting the previous group data on firebase. So, on syncing with the server it fetches only one group from the firebase database. To resolve this, each group data is now stored under a random key generated by push()

@linl33 linl33 merged commit 26652e3 into odk-x:master Jun 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Firebase storing only one group under clients database
3 participants