From d6f62a3b374e321a86d97cd2765cc91b1f006e29 Mon Sep 17 00:00:00 2001 From: Mike Hardy Date: Mon, 6 May 2024 23:02:34 -0500 Subject: [PATCH] fix(firestore, android): remove usage of Guava library 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 --- .../ReactNativeFirebaseFirestoreSerialize.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/firestore/android/src/reactnative/java/io/invertase/firebase/firestore/ReactNativeFirebaseFirestoreSerialize.java b/packages/firestore/android/src/reactnative/java/io/invertase/firebase/firestore/ReactNativeFirebaseFirestoreSerialize.java index f55bc25e08..58c86233f4 100644 --- a/packages/firestore/android/src/reactnative/java/io/invertase/firebase/firestore/ReactNativeFirebaseFirestoreSerialize.java +++ b/packages/firestore/android/src/reactnative/java/io/invertase/firebase/firestore/ReactNativeFirebaseFirestoreSerialize.java @@ -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; @@ -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) {