use of com.google.firebase.firestore.remote.WatchChange.DocumentChange in project firebase-android-sdk by firebase.
the class TestUtil method updateRemoteEvent.
public static RemoteEvent updateRemoteEvent(MutableDocument doc, List<Integer> updatedInTargets, List<Integer> removedFromTargets, List<Integer> activeTargets) {
DocumentChange change = new DocumentChange(updatedInTargets, removedFromTargets, doc.getKey(), doc);
WatchChangeAggregator aggregator = new WatchChangeAggregator(new WatchChangeAggregator.TargetMetadataProvider() {
@Override
public ImmutableSortedSet<DocumentKey> getRemoteKeysForTarget(int targetId) {
return DocumentKey.emptyKeySet().insert(doc.getKey());
}
@Override
public TargetData getTargetDataForTarget(int targetId) {
return activeTargets.contains(targetId) ? targetData(targetId, QueryPurpose.LISTEN, doc.getKey().toString()) : null;
}
});
aggregator.handleDocumentChange(change);
return aggregator.createRemoteEvent(doc.getVersion());
}
Aggregations