Skip to content

Commit

Permalink
feat: rename setIsSmartLockEnabled to setCredentialManagerEnabled (#2188
Browse files Browse the repository at this point in the history
)

* feat: rename setIsSmartLockEnabled to setCredentialManagerEnabled

* fix

* feat: rename setIsSmartLockEnabled to setCredentialManagerEnabled

* feat: rename setIsSmartLockEnabled to setCredentialManagerEnabled

* fix

* remove references
  • Loading branch information
Lyokone authored Mar 4, 2025
1 parent e004565 commit 7231cf5
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
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
Expand Up @@ -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"
Expand Down
3 changes: 1 addition & 2 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
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
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -1409,7 +1391,6 @@ protected FlowParameters getFlowParams() {
mTosUrl,
mPrivacyPolicyUrl,
mEnableCredentials,
mEnableHints,
mEnableAnonymousUpgrade,
mAlwaysShowProviderChoice,
mLockOrientation,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ public FlowParameters createFromParcel(Parcel in) {
termsOfServiceUrl,
privacyPolicyUrl,
enableCredentials,
enableHints,
enableAnonymousUpgrade,
alwaysShowProviderChoice,
lockOrientation,
Expand Down Expand Up @@ -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;
Expand All @@ -130,7 +128,6 @@ public FlowParameters(
@Nullable String termsOfServiceUrl,
@Nullable String privacyPolicyUrl,
boolean enableCredentials,
boolean enableHints,
boolean enableAnonymousUpgrade,
boolean alwaysShowProviderChoice,
boolean lockOrientation,
Expand All @@ -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;
Expand All @@ -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);
Expand Down Expand Up @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -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());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@ public static FlowParameters getFlowParameters(Collection<String> providerIds,
null,
null,
true,
true,
enableAnonymousUpgrade,
false,
true,
Expand Down

0 comments on commit 7231cf5

Please sign in to comment.