Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: rename setIsSmartLockEnabled to setCredentialManagerEnabled #2188

Merged
merged 6 commits into from
Mar 4, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -194,8 +194,7 @@ private Intent getSignInIntent(@Nullable String link) {
.setTheme(getSelectedTheme())
.setLogo(getSelectedLogo())
.setAvailableProviders(getSelectedProviders())
.setIsSmartLockEnabled(mBinding.credentialSelectorEnabled.isChecked(),
mBinding.hintSelectorEnabled.isChecked());
.setCredentialManagerEnabled(mBinding.credentialSelectorEnabled.isChecked());

if (mBinding.customLayout.isChecked()) {
AuthMethodPickerLayout customLayout = new AuthMethodPickerLayout
7 changes: 0 additions & 7 deletions app/src/main/res/layout/auth_ui_layout.xml
Original file line number Diff line number Diff line change
@@ -312,13 +312,6 @@
android:checked="true"
android:text="@string/options_enable_credential_selector" />

<CheckBox
android:id="@+id/hint_selector_enabled"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:text="@string/options_enable_hint_selector" />

<CheckBox
android:id="@+id/allow_new_email_accounts"
android:layout_width="wrap_content"
3 changes: 1 addition & 2 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -63,8 +63,7 @@
<string name="facebook_permission_photos">Photos</string>

<string name="options_header">Other Options</string>
<string name="options_enable_credential_selector">Enable Smart Lock\'s credential selector</string>
<string name="options_enable_hint_selector">Enable Smart Lock\'s hint selector</string>
<string name="options_enable_credential_selector">Enable Credential Manager\'s credential selector</string>
<string name="options_allow_new_email_acccount">Allow new account creation</string>
<string name="options_require_name">Require first/last name with email accounts.</string>
<string name="options_use_auth_emulator">Connect to auth emulator (localhost:9099).</string>
25 changes: 3 additions & 22 deletions auth/src/main/java/com/firebase/ui/auth/AuthUI.java
Original file line number Diff line number Diff line change
@@ -1126,7 +1126,6 @@ private abstract class AuthIntentBuilder<T extends AuthIntentBuilder> {
boolean mAlwaysShowProviderChoice = false;
boolean mLockOrientation = false;
boolean mEnableCredentials = true;
boolean mEnableHints = true;
AuthMethodPickerLayout mAuthMethodPickerLayout = null;
ActionCodeSettings mPasswordSettings = null;

@@ -1251,32 +1250,15 @@ public T setDefaultProvider(@Nullable IdpConfig config) {
}

/**
* Enables or disables the use of Smart Lock for Passwords in the sign in flow. To
* (en)disable hint selector and credential selector independently use {@link
* #setIsSmartLockEnabled(boolean, boolean)}
* Enables or disables the use of Credential Manager for Passwords credential selector
* <p>
* <p>SmartLock is enabled by default.
*
* @param enabled enables smartlock's credential selector and hint selector
*/
@NonNull
public T setIsSmartLockEnabled(boolean enabled) {
return setIsSmartLockEnabled(enabled, enabled);
}

/**
* Enables or disables the use of Smart Lock for Passwords credential selector and hint
* selector.
* <p>
* <p>Both selectors are enabled by default.
* <p>Is enabled by default.
*
* @param enableCredentials enables credential selector before signup
* @param enableHints enable hint selector in respective signup screens
*/
@NonNull
public T setIsSmartLockEnabled(boolean enableCredentials, boolean enableHints) {
public T setCredentialManagerEnabled(boolean enableCredentials) {
mEnableCredentials = enableCredentials;
mEnableHints = enableHints;
return (T) this;
}

@@ -1409,7 +1391,6 @@ protected FlowParameters getFlowParams() {
mTosUrl,
mPrivacyPolicyUrl,
mEnableCredentials,
mEnableHints,
mEnableAnonymousUpgrade,
mAlwaysShowProviderChoice,
mLockOrientation,
Original file line number Diff line number Diff line change
@@ -70,7 +70,6 @@ public FlowParameters createFromParcel(Parcel in) {
termsOfServiceUrl,
privacyPolicyUrl,
enableCredentials,
enableHints,
enableAnonymousUpgrade,
alwaysShowProviderChoice,
lockOrientation,
@@ -113,7 +112,6 @@ public FlowParameters[] newArray(int size) {
public final ActionCodeSettings passwordResetSettings;

public final boolean enableCredentials;
public final boolean enableHints;
public final boolean enableAnonymousUpgrade;
public final boolean alwaysShowProviderChoice;
public final boolean lockOrientation;
@@ -130,7 +128,6 @@ public FlowParameters(
@Nullable String termsOfServiceUrl,
@Nullable String privacyPolicyUrl,
boolean enableCredentials,
boolean enableHints,
boolean enableAnonymousUpgrade,
boolean alwaysShowProviderChoice,
boolean lockOrientation,
@@ -146,7 +143,6 @@ public FlowParameters(
this.termsOfServiceUrl = termsOfServiceUrl;
this.privacyPolicyUrl = privacyPolicyUrl;
this.enableCredentials = enableCredentials;
this.enableHints = enableHints;
this.enableAnonymousUpgrade = enableAnonymousUpgrade;
this.alwaysShowProviderChoice = alwaysShowProviderChoice;
this.lockOrientation = lockOrientation;
@@ -172,7 +168,6 @@ public void writeToParcel(Parcel dest, int flags) {
dest.writeString(termsOfServiceUrl);
dest.writeString(privacyPolicyUrl);
dest.writeInt(enableCredentials ? 1 : 0);
dest.writeInt(enableHints ? 1 : 0);
dest.writeInt(enableAnonymousUpgrade ? 1 : 0);
dest.writeInt(alwaysShowProviderChoice ? 1 : 0);
dest.writeInt(lockOrientation ? 1 : 0);
@@ -205,7 +200,6 @@ public boolean isAnonymousUpgradeEnabled() {
public boolean isPlayServicesRequired() {
// Play services only required for Google Sign In and the Credentials API
return isProviderEnabled(GoogleAuthProvider.PROVIDER_ID)
|| enableHints
|| enableCredentials;
}

Original file line number Diff line number Diff line change
@@ -87,7 +87,7 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat

ImeHelper.setImeOnDoneListener(mEmailEditText, this);

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && getFlowParams().enableHints) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
mEmailEditText.setImportantForAutofill(View.IMPORTANT_FOR_AUTOFILL_NO);
}

@@ -130,7 +130,7 @@ public void onActivityCreated(@Nullable Bundle savedInstanceState) {
if (!TextUtils.isEmpty(email)) {
mEmailEditText.setText(email);
// Previously auto-triggering the check is now removed.
} else if (getFlowParams().enableHints) {
} else if (getFlowParams().enableCredentials) {
mHandler.fetchCredential();
}
}
Original file line number Diff line number Diff line change
@@ -85,7 +85,7 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat

mSmsTermsText.setText(getString(R.string.fui_sms_terms_of_service,
getString(R.string.fui_verify_phone_number)));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && getFlowParams().enableHints) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
mPhoneEditText.setImportantForAutofill(View.IMPORTANT_FOR_AUTOFILL_NO);
}
requireActivity().setTitle(getString(R.string.fui_verify_phone_number_title));
@@ -220,7 +220,7 @@ private void setDefaultCountryForSpinner() {
"",
countryIso,
String.valueOf(PhoneNumberUtils.getCountryCode(countryIso))));
} else if (getFlowParams().enableHints) {
} else if (getFlowParams().enableCredentials) {
// Launch phone number hint flow using the new API
mCheckPhoneHandler.fetchCredential(requireActivity());
}
Original file line number Diff line number Diff line change
@@ -184,7 +184,6 @@ public static FlowParameters getFlowParameters(Collection<String> providerIds,
null,
null,
true,
true,
enableAnonymousUpgrade,
false,
true,