Closed ArcherEmiya05 closed 2 years ago
Yes
Closing Firebase Auth UI using onbackpress causes UI to freeze.
Open Firebase Auth UI (Phone Auth), and close it via back press in navigation.
That is a huge frame skipped!
I suspect this is due to Material Component being used now in 8.0.0
Smooth transition between project activity and Firebase UI Auth (Phone Auth)
SampleActivity: AppCompatActivity() { private val activityResultLauncher = activityForResult { result, _ -> PhoneAuthUtil.handleIntentResult(this, result) } override fun onCreate(savedInstanceState: Bundle?) { // Launch OTP activity activityResultLauncher.launch(PhoneAuthUtil.getAuthIntent()) } } object PhoneAuthUtil { private val AUTH_REQUEST: Intent by lazy { val builder = AuthUI.getInstance().createSignInIntentBuilder() .setTheme(R.style.AuthStyle) .setIsSmartLockEnabled(false) .setAvailableProviders(PROVIDER_LIST) builder.setTosAndPrivacyPolicyUrls( "https://firebase.google.com/terms/", "https://firebase.google.com/policies/analytics" ) builder.build() } fun getAuthIntent() = AUTH_REQUEST fun handleIntentResult(phoneAuthCallback: PhoneAuthCallback, result: ActivityResult) { val response: IdpResponse? = IdpResponse.fromResultIntent(result.data) if (result.resultCode == RESULT_OK) phoneAuthCallback.onFPASuccess() else { // Sign in failed if (response == null) { // Probably the user pressed back button phoneAuthCallback.onFPAErrorMessage(R.string.fui_required_field) phoneAuthCallback.onFPACancel() return } if (response.error == null) { phoneAuthCallback.onFPAErrorMessage(R.string.fui_error_unknown) return } if (response.error!!.errorCode == ErrorCodes.NO_NETWORK) { phoneAuthCallback.onFPAErrorMessage(R.string.fui_no_internet) return } if (response.error!!.errorCode == ErrorCodes.ERROR_USER_DISABLED) { phoneAuthCallback.onFPAErrorMessage(R.string.fui_error_email_does_not_exist) return } if (response.error!!.errorCode == ErrorCodes.NO_NETWORK) { phoneAuthCallback.onFPAErrorMessage(R.string.fui_no_internet) return } if (response.error!!.errorCode == ErrorCodes.NO_NETWORK) { phoneAuthCallback.onFPAErrorMessage(R.string.fui_no_internet) return } } } }
It seems fixed with Material3 theme
Step 1: Are you in the right place?
Yes
Step 2: Describe your environment
Step 3: Describe the problem:
Closing Firebase Auth UI using onbackpress causes UI to freeze.
Steps to reproduce:
Open Firebase Auth UI (Phone Auth), and close it via back press in navigation.
Observed Results:
That is a huge frame skipped!
I suspect this is due to Material Component being used now in 8.0.0
Expected Results:
Smooth transition between project activity and Firebase UI Auth (Phone Auth)
Relevant Code: