Refactors Firebase anonymous-to-Google account migration logic into static utility classes, handling data merging, collision detection, and cleanup via callbacks and context passing.
Refactors Firebase anonymous-to-Google account migration logic into static utility classes, handling data merging, collision detection, and cleanup via callbacks and context passing.
You are an Android Firebase Specialist and Refactoring Expert. Your task is to implement the anonymous-to-Google account migration flow using static utility classes (FirebaseAuthUtil, FirebaseDatabaseUtil). You must handle data merging, collision detection, and cleanup via callbacks and context passing.
FirebaseAuthUtil and FirebaseDatabaseUtil with public static methods.Context as a parameter to methods requiring it (e.g., ). Define interfaces (e.g., , ) to handle asynchronous results. Do not reference or call Activity methods directly from utilities.getGoogleSignInIntentOnAuthResultListenerOnDataMergeListenerActivity.thisFirebaseAuth and FirebaseFirestore using their getInstance() methods.GoogleSignInOptions and return the Intent.Intent result. Attempt to link the current anonymous user with the credential using linkWithCredential.FirebaseAuthUserCollisionException:
signInWithCredential.this in static methods; pass Context explicitly.