diff --git a/packages/app-check/android/src/main/java/io/invertase/firebase/appcheck/ReactNativeFirebaseAppCheckModule.java b/packages/app-check/android/src/main/java/io/invertase/firebase/appcheck/ReactNativeFirebaseAppCheckModule.java index 5ad88729ec..15e918e7c5 100644 --- a/packages/app-check/android/src/main/java/io/invertase/firebase/appcheck/ReactNativeFirebaseAppCheckModule.java +++ b/packages/app-check/android/src/main/java/io/invertase/firebase/appcheck/ReactNativeFirebaseAppCheckModule.java @@ -24,12 +24,12 @@ import com.google.android.gms.tasks.Tasks; import com.google.firebase.FirebaseApp; import com.google.firebase.appcheck.FirebaseAppCheck; +import io.invertase.firebase.common.ReactNativeFirebaseEvent; +import io.invertase.firebase.common.ReactNativeFirebaseEventEmitter; import io.invertase.firebase.common.ReactNativeFirebaseJSON; import io.invertase.firebase.common.ReactNativeFirebaseMeta; import io.invertase.firebase.common.ReactNativeFirebaseModule; import io.invertase.firebase.common.ReactNativeFirebasePreferences; -import io.invertase.firebase.common.ReactNativeFirebaseEvent; -import io.invertase.firebase.common.ReactNativeFirebaseEventEmitter; import java.util.HashMap; import java.util.Iterator; import java.util.Map; @@ -39,7 +39,8 @@ public class ReactNativeFirebaseAppCheckModule extends ReactNativeFirebaseModule private static final String LOGTAG = "RNFBAppCheck"; private static final String KEY_APPCHECK_TOKEN_REFRESH_ENABLED = "app_check_token_auto_refresh"; - private static HashMap mAppCheckListeners = new HashMap<>(); + private static HashMap mAppCheckListeners = + new HashMap<>(); ReactNativeFirebaseAppCheckProviderFactory providerFactory = new ReactNativeFirebaseAppCheckProviderFactory(); @@ -110,7 +111,8 @@ public void onCatalystInstanceDestroy() { String appName = (String) pair.getKey(); FirebaseApp firebaseApp = FirebaseApp.getInstance(appName); FirebaseAppCheck firebaseAppCheck = FirebaseAppCheck.getInstance(firebaseApp); - FirebaseAppCheck.AppCheckListener mAppCheckListener = (FirebaseAppCheck.AppCheckListener) pair.getValue(); + FirebaseAppCheck.AppCheckListener mAppCheckListener = + (FirebaseAppCheck.AppCheckListener) pair.getValue(); firebaseAppCheck.removeAppCheckListener(mAppCheckListener); appCheckListenerIterator.remove(); } @@ -213,16 +215,19 @@ public void addAppCheckListener(final String appName) { FirebaseAppCheck firebaseAppCheck = FirebaseAppCheck.getInstance(firebaseApp); if (mAppCheckListeners.get(appName) == null) { - FirebaseAppCheck.AppCheckListener newAppCheckListener = appCheckToken -> { - WritableMap eventBody = Arguments.createMap(); - eventBody.putString("appName", appName); // for js side distribution - eventBody.putString("token", appCheckToken.getToken()); - eventBody.putDouble("expireTimeMillis", appCheckToken.getExpireTimeMillis()); - - ReactNativeFirebaseEventEmitter emitter = ReactNativeFirebaseEventEmitter.getSharedInstance(); - ReactNativeFirebaseEvent event = new ReactNativeFirebaseEvent("appCheck_token_changed", eventBody, appName); - emitter.sendEvent(event); - }; + FirebaseAppCheck.AppCheckListener newAppCheckListener = + appCheckToken -> { + WritableMap eventBody = Arguments.createMap(); + eventBody.putString("appName", appName); // for js side distribution + eventBody.putString("token", appCheckToken.getToken()); + eventBody.putDouble("expireTimeMillis", appCheckToken.getExpireTimeMillis()); + + ReactNativeFirebaseEventEmitter emitter = + ReactNativeFirebaseEventEmitter.getSharedInstance(); + ReactNativeFirebaseEvent event = + new ReactNativeFirebaseEvent("appCheck_token_changed", eventBody, appName); + emitter.sendEvent(event); + }; firebaseAppCheck.addAppCheckListener(newAppCheckListener); mAppCheckListeners.put(appName, newAppCheckListener);