Skip to content

Commit

Permalink
fix(firestore, android): remove usage of Guava library
Browse files Browse the repository at this point in the history
there was only one usage of Guava in firestore, and it was easily
replaced with a for loop which eliminates the dependency

this is important in the context of firebase-android-sdk where guava
is no longer transitively available - best to remove it here as well
vs bring it in directly as a dependency we specifically we need
  • Loading branch information
mikehardy committed May 20, 2024
1 parent e9939c4 commit d6f62a3
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import com.facebook.react.bridge.ReadableMapKeySetIterator;
import com.facebook.react.bridge.WritableArray;
import com.facebook.react.bridge.WritableMap;
import com.google.common.collect.Iterables;
import com.google.firebase.Timestamp;
import com.google.firebase.firestore.Blob;
import com.google.firebase.firestore.DocumentChange;
Expand Down Expand Up @@ -199,10 +198,12 @@ private static WritableArray documentChangesToWritableArray(
boolean isMetadataChange = false;
if (checkIfMetadataChange) {
int hashCode = documentChange.hashCode();
DocumentChange exists =
Iterables.tryFind(
comparableDocumentChanges, docChange -> docChange.hashCode() == hashCode)
.orNull();
DocumentChange exists = null;
for (DocumentChange docChange : comparableDocumentChanges) {
if (docChange.hashCode() == hashCode) {
exists = docChange;
}
}

// Exists in docChanges with meta, but doesnt exist in docChanges without meta
if (exists == null) {
Expand Down

0 comments on commit d6f62a3

Please sign in to comment.