Bug 1969980 - part 1 - remove password saved and username updated snackbars r=android-reviewers,twhite,android-l10n-reviewers,delphine

Differential Revision: https://phabricator.services.mozilla.com/D252232
This commit is contained in:
gela 2025-07-08 20:19:27 +00:00 committed by gmalekpour@mozilla.com
parent 032153cfa1
commit 00b10518da
6 changed files with 2 additions and 33 deletions

View file

@ -953,7 +953,6 @@ class PromptFeature private constructor(
// For v1, we only handle a single login and drop all others on the floor // For v1, we only handle a single login and drop all others on the floor
entry = promptRequest.logins[0], entry = promptRequest.logins[0],
icon = session.content.icon, icon = session.content.icon,
onShowSnackbarAfterLoginChange = onSaveLogin,
) )
} }

View file

@ -90,7 +90,6 @@ internal class SaveLoginDialogFragment : PromptDialogFragment() {
private var loginValid = false private var loginValid = false
private var validateStateUpdate: Job? = null private var validateStateUpdate: Job? = null
private var onShowSnackbarAfterLoginChange: (Boolean) -> Unit = { _ -> }
private var isUpdate = false private var isUpdate = false
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
@ -184,8 +183,6 @@ internal class SaveLoginDialogFragment : PromptDialogFragment() {
) )
emitSaveFact() emitSaveFact()
dismiss() dismiss()
onShowSnackbarAfterLoginChange.invoke(isUpdate)
} }
@VisibleForTesting @VisibleForTesting
@ -404,7 +401,6 @@ internal class SaveLoginDialogFragment : PromptDialogFragment() {
* @param hint a value that helps to determine the appropriate prompting behavior. * @param hint a value that helps to determine the appropriate prompting behavior.
* @param entry represents login information on a given domain. * @param entry represents login information on a given domain.
* @param icon represents the icon to be displayed on the dialog. * @param icon represents the icon to be displayed on the dialog.
* @param onShowSnackbarAfterLoginChange callback to display a snackbar after save/update.
* */ * */
fun newInstance( fun newInstance(
sessionId: String, sessionId: String,
@ -413,7 +409,6 @@ internal class SaveLoginDialogFragment : PromptDialogFragment() {
hint: Int, hint: Int,
entry: LoginEntry, entry: LoginEntry,
icon: Bitmap? = null, icon: Bitmap? = null,
onShowSnackbarAfterLoginChange: (Boolean) -> Unit,
): SaveLoginDialogFragment { ): SaveLoginDialogFragment {
val fragment = SaveLoginDialogFragment() val fragment = SaveLoginDialogFragment()
val arguments = fragment.arguments ?: Bundle() val arguments = fragment.arguments ?: Bundle()
@ -432,7 +427,6 @@ internal class SaveLoginDialogFragment : PromptDialogFragment() {
} }
fragment.arguments = arguments fragment.arguments = arguments
fragment.onShowSnackbarAfterLoginChange = onShowSnackbarAfterLoginChange
return fragment return fragment
} }
} }

View file

@ -114,11 +114,11 @@
<!-- Pressing this will dismiss the suggested strong password dialog --> <!-- Pressing this will dismiss the suggested strong password dialog -->
<string name="mozac_feature_prompts_suggest_strong_password_dismiss">Not now</string> <string name="mozac_feature_prompts_suggest_strong_password_dismiss">Not now</string>
<!-- Title for showing the suggest strong password saved confirmation snackbar --> <!-- Title for showing the suggest strong password saved confirmation snackbar -->
<string name="mozac_feature_prompts_suggest_strong_password_saved_snackbar_title">Password saved</string> <string name="mozac_feature_prompts_suggest_strong_password_saved_snackbar_title" tools:ignore="UnusedResources" moz:removedIn="142">Password saved</string>
<!-- Title for showing the suggest strong password updated confirmation snackbar --> <!-- Title for showing the suggest strong password updated confirmation snackbar -->
<string name="mozac_feature_prompts_suggest_strong_password_updated_snackbar_title">Password updated</string> <string name="mozac_feature_prompts_suggest_strong_password_updated_snackbar_title">Password updated</string>
<!-- Title for showing the username updated confirmation snackbar --> <!-- Title for showing the username updated confirmation snackbar -->
<string name="mozac_feature_prompt_login_snackbar_username_updated">Username updated</string> <string name="mozac_feature_prompt_login_snackbar_username_updated" tools:ignore="UnusedResources" moz:removedIn="142">Username updated</string>
<!-- Strings shown in a dialog that appear when users try to refresh a certain kind of webpages --> <!-- Strings shown in a dialog that appear when users try to refresh a certain kind of webpages -->
<string name="mozac_feature_prompt_repost_title">Resend data to this site?</string> <string name="mozac_feature_prompt_repost_title">Resend data to this site?</string>

View file

@ -2819,7 +2819,6 @@ class PromptFeatureTest {
username = "username", username = "username",
password = "password", password = "password",
), ),
onShowSnackbarAfterLoginChange = { _ -> },
), ),
) )
feature.activePrompt = WeakReference(fragment) feature.activePrompt = WeakReference(fragment)

View file

@ -49,7 +49,6 @@ class SaveLoginDialogFragmentTest : TestCase() {
hint = hint, hint = hint,
entry = entry, entry = entry,
icon = icon, icon = icon,
onShowSnackbarAfterLoginChange = { _ -> },
), ),
) )
doReturn(appCompatContext).`when`(fragment).requireContext() doReturn(appCompatContext).`when`(fragment).requireContext()
@ -96,7 +95,6 @@ class SaveLoginDialogFragmentTest : TestCase() {
hint = hint, hint = hint,
entry = entry, entry = entry,
icon = icon, icon = icon,
onShowSnackbarAfterLoginChange = { _ -> },
), ),
) )
val defaultIconResource = iconsR.drawable.mozac_ic_globe_24 val defaultIconResource = iconsR.drawable.mozac_ic_globe_24

View file

@ -1038,11 +1038,6 @@ abstract class BaseBrowserFragment :
password = password, password = password,
) )
}, },
onSaveLogin = { isUpdate ->
showSnackbarAfterLoginChange(
isUpdate,
)
},
passwordGeneratorColorsProvider = passwordGeneratorColorsProvider, passwordGeneratorColorsProvider = passwordGeneratorColorsProvider,
hideUpdateFragmentAfterSavingGeneratedPassword = { username, password -> hideUpdateFragmentAfterSavingGeneratedPassword = { username, password ->
hideUpdateFragmentAfterSavingGeneratedPassword( hideUpdateFragmentAfterSavingGeneratedPassword(
@ -1437,22 +1432,6 @@ abstract class BaseBrowserFragment :
} }
} }
/**
* Show a [Snackbar] when credentials are saved or updated.
*/
private fun showSnackbarAfterLoginChange(isUpdate: Boolean) {
val snackbarText = if (isUpdate) {
R.string.mozac_feature_prompt_login_snackbar_username_updated
} else {
R.string.mozac_feature_prompts_suggest_strong_password_saved_snackbar_title
}
ContextMenuSnackbarDelegate().show(
snackBarParentView = binding.dynamicSnackbarContainer,
text = snackbarText,
duration = LENGTH_LONG,
)
}
/** /**
* Shows a biometric prompt and fallback to prompting for the password. * Shows a biometric prompt and fallback to prompting for the password.
*/ */