firebase / FirebaseUI-Android

Optimized UI components for Firebase
https://firebaseopensource.com/projects/firebase/firebaseui-android/
Apache License 2.0
4.63k stars 1.83k forks source link

Add skip button as custom sign-in layout option #2148

Open MirecXP opened 10 months ago

MirecXP commented 10 months ago

Welcome to FirebaseUI and thanks for submitting an issue!

Please take a look at open issues, as well as resolved issues, to see if your issue is either already being addressed, or has been solved by someone else.

If not, please feel free to fill in the following info so we can help faster!

Step 1: Are you in the right place?

Yes.

Step 2: Describe your environment

Step 3: Describe the problem:

The AuthUI login can be started as part of an onboarding flow. To simplify the UX, we do not want to add a separate onboarding screen for the user to decide whether they want to log in or not. So having a skip button available directly on the sign-in screen would help a lot. The sign in screen can be cancelled by navigating back, but this is not suitable if the sign-in screen is part of some flow.

Steps to reproduce:

  1. Create custom sign-in layout (with optional skip/close/cancel button)
  2. Create sign-in intent using custom layout
  3. Launch sign-in activity using signInIntent

Observed Results:

It is not possible to cancel the launched sign-in activity with a custom button.

Expected Results:

I can use a custom button to cancel the sign in, e.g. Continue without login and I do not need a separate screen for that.

Relevant Code:


         val customSignInLayout: AuthMethodPickerLayout = AuthMethodPickerLayout.Builder(R.layout.onboarding_login_layout)
            .setGoogleButtonId(R.id.google_signin_button)
            .setAppleButtonId(R.id.apple_signin_button)
            .setTosAndPrivacyPolicyId(R.id.tos_link)
            .setSkipButtonId(R.id.skip_signin_button) // <-- this would be very useful
            .build()

        var signInIntent = AuthUI.getInstance()
            .createSignInIntentBuilder()
            .setAvailableProviders(providers)
            .setIsSmartLockEnabled(false)
            .setAlwaysShowSignInMethodScreen(true)
            .setLogo(R.mipmap.ic_launcher)
            .setTosAndPrivacyPolicyUrls(termsUrl, privacyUrl)
            .enableAnonymousUsersAutoUpgrade()
            .setAuthMethodPickerLayout(customSignInLayout)

        launcher.launch(signInIntent.build())  ```