firebase / firebase/firebase-android-sdk
Get a trigger of addSnapshotListener() or listen to changes in specific properties
- Dominant language
- Java
- Stars
- 2.6k
- Forks
- 710
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 31
Description
## What feature would you like to see?
I would like to 1) receive snapshots only if certain properties are updated (i.e. do not receive snapshots if some other properties are updated) or 2) find a source which triggered the snapshot listener, so that I can check properties.
It can be done by comparing the existing object with a newly received, but I would like to avoid it as it will result in spaghetti code.
## How would you use it?
1) For properties to exclude
FireStoreCollectionOrDocument
.addSnapshotListener(
new String[] {"prop1", "prop2"},
(doc, ex) -> { ... });
2) For checking the listener trigger
FireStoreCollectionOrDocument
.addSnapshotListener((doc, ex, metaData) -> {
String a = metaData.getTriggerProperty();
// or String[] b = metaData.getTriggerProperties();
...
})
Contributor guide
Assessment
This issue has not been assessed yet.