Skip to content

Commit

Permalink
style(lint, android): yarn lint:android
Browse files Browse the repository at this point in the history
this check silently fails in CI so some things merge despite needing
a re-format - here's a post-merge re-format
  • Loading branch information
mikehardy committed Sep 20, 2023
1 parent e2a4b17 commit 6f77c19
Showing 1 changed file with 19 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<String, FirebaseAppCheck.AppCheckListener> mAppCheckListeners = new HashMap<>();
private static HashMap<String, FirebaseAppCheck.AppCheckListener> mAppCheckListeners =
new HashMap<>();

ReactNativeFirebaseAppCheckProviderFactory providerFactory =
new ReactNativeFirebaseAppCheckProviderFactory();
Expand Down Expand Up @@ -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();
}
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 6f77c19

Please sign in to comment.