Skip to content

Commit

Permalink
Show Not now as secondary button during autofill onboarding (#5198)
Browse files Browse the repository at this point in the history
Task/Issue URL:
https://app.asana.com/0/1203822806345703/1208592982102639/f

### Description
During Autofill Onboarding show "Not Now" as secondary button.

### Steps to test this PR

_Feature 1_
- [x] fresh install
- [x] visit fill.dev and try a login
- [x] ensure on the dialog (onboarding), secondary button is not now
- [x] click Not Now
- [x] visit authenticationtest.com and try a login
- [x] ensure on the dialog (onboarding), secondary 
- [x] click not now
- [x] visit fill.dev again and try a login
- [x] ensure on the dialog (not onboarding anymote), secondary button is
Never for this site


### UI changes
| Before  | After |
| ------ | ----- |
!(Upload before screenshot)|(Upload after screenshot)|

---------

Co-authored-by: Dax The Translator <[email protected]>
  • Loading branch information
2 people authored and aitorvs committed Nov 6, 2024
1 parent d129356 commit a7f7752
Show file tree
Hide file tree
Showing 28 changed files with 82 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ import com.duckduckgo.autofill.impl.ui.credential.saving.AutofillSavingCredentia
import com.duckduckgo.autofill.impl.ui.credential.saving.AutofillSavingCredentialsDialogFragment.DialogEvent.Shown
import com.duckduckgo.autofill.impl.ui.credential.saving.AutofillSavingCredentialsViewModel.ViewState
import com.duckduckgo.autofill.impl.ui.credential.saving.declines.AutofillDeclineCounter
import com.duckduckgo.common.ui.view.button.DaxButton
import com.duckduckgo.common.ui.view.prependIconToText
import com.duckduckgo.common.utils.DispatcherProvider
import com.duckduckgo.common.utils.FragmentViewModelFactory
Expand Down Expand Up @@ -115,6 +116,8 @@ class AutofillSavingCredentialsDialogFragment : BottomSheetDialogFragment(), Cre

private lateinit var keyFeaturesContainer: ViewGroup

private lateinit var secondaryButton: DaxButton

private val viewModel by lazy {
ViewModelProvider(this, viewModelFactory)[AutofillSavingCredentialsViewModel::class.java]
}
Expand Down Expand Up @@ -157,12 +160,14 @@ class AutofillSavingCredentialsDialogFragment : BottomSheetDialogFragment(), Cre

private fun renderViewState(viewState: ViewState) {
keyFeaturesContainer.isVisible = viewState.expandedDialog
configureSecondaryButtons(viewState.expandedDialog)
(dialog as? BottomSheetDialog)?.behavior?.isDraggable = viewState.expandedDialog
pixelNameDialogEvent(Shown, viewState.expandedDialog)?.let { pixel.fire(it) }
}

private fun configureViews(binding: ContentAutofillSaveNewCredentialsBinding) {
keyFeaturesContainer = binding.keyFeaturesContainer
secondaryButton = binding.secondaryButton
(dialog as BottomSheetDialog).behavior.state = BottomSheetBehavior.STATE_EXPANDED
configureCloseButtons(binding)
configureSaveButton(binding)
Expand Down Expand Up @@ -222,6 +227,16 @@ class AutofillSavingCredentialsDialogFragment : BottomSheetDialogFragment(), Cre
}
}

private fun onUserChoseNotNow() {
pixelNameDialogEvent(Dismissed, isOnboardingMode())?.let { pixel.fire(it) }

// this is another way to refuse saving credentials, so ensure that normal logic still runs
onUserRejectedToSaveCredentials()

// avoid the standard cancellation logic from running
ignoreCancellationEvents = true
}

private fun onUserChoseNeverSaveThisSite() {
pixelNameDialogEvent(Exclude, isOnboardingMode())?.let { pixel.fire(it) }
viewModel.addSiteToNeverSaveList(getOriginalUrl())
Expand All @@ -239,9 +254,21 @@ class AutofillSavingCredentialsDialogFragment : BottomSheetDialogFragment(), Cre
*/
private fun configureCloseButtons(binding: ContentAutofillSaveNewCredentialsBinding) {
binding.closeButton.setOnClickListener { animateClosed() }
binding.neverSaveForThisSiteButton.setOnClickListener {
onUserChoseNeverSaveThisSite()
animateClosed()
}

private fun configureSecondaryButtons(isOnboarding: Boolean) {
if (isOnboarding) {
secondaryButton.text = getString(R.string.saveOnboardingLoginDialogSecondaryButton)
secondaryButton.setOnClickListener {
onUserChoseNotNow()
animateClosed()
}
} else {
secondaryButton.text = getString(R.string.saveLoginDialogNeverForThisSite)
secondaryButton.setOnClickListener {
onUserChoseNeverSaveThisSite()
animateClosed()
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class AutofillSavingCredentialsViewModel @Inject constructor(
viewModelScope.launch(dispatchers.io()) {
val shouldShowExpandedView = autofillDeclineCounter.declineCount() < 2 && autofillDeclineCounter.isDeclineCounterActive()
_viewState.value = ViewState(shouldShowExpandedView)
Timber.d("Autofill: AutofillSavingCredentialsViewModel initialized")
Timber.d("Autofill: AutofillSavingCredentialsViewModel initialized with expanded view state: $shouldShowExpandedView")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,9 @@
app:layout_constraintTop_toBottomOf="@id/keyFeaturesContainer" />

<com.duckduckgo.common.ui.view.button.DaxButtonGhost
android:id="@+id/neverSaveForThisSiteButton"
android:id="@+id/secondaryButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/saveLoginDialogNeverForThisSite"
app:buttonSize="large"
app:layout_constraintEnd_toEndOf="@id/saveLoginButton"
app:layout_constraintStart_toStartOf="@id/saveLoginButton"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@

<string name="credentialManagementSuggestionsLabel">Предложения</string>

<string name="credentialManagementWebViewIncompatibleErrorMessage">Автоматичното попълване за пароли не е достъпно, защото Вашата версия на Android WebView е твърде стара.</string>
<string name="credentialManagementWebViewIncompatibleErrorMessage">Автоматичното попълване на пароли не е достъпно, тъй като Вашата версия на Android WebView е остаряла или несъвместима.</string>

<string name="autofillManagementSearchClearDescription">Изчистване на въведеното търсене</string>
<string name="autofillManagementNoSearchResults" instruction="Placeholder is the query the user has searched for. e.g., No results for &apos;kittens&apos;">Няма резултати за \'%1$s\'</string>
Expand Down Expand Up @@ -145,6 +145,7 @@
<string name="credentials_invalid_request_warning_notif"><b></b>\nСинхронизирането на пароли е на пауза\nНякои пароли са форматирани неправилно или са твърде дълги и не бяха синхронизирани.</string>

<string name="saveLoginDialogNeverForThisSite">Никога не питай за този сайт</string>
<string name="saveOnboardingLoginDialogSecondaryButton">Не, благодаря</string>
<string name="credentialManagementInstructionNeverForThisSite">Ако нулирате изключените сайтове, при следващото влизане в някой от тези сайтове ще бъдете подканени да запазите паролата за вход.</string>
<string name="credentialManagementClearNeverForThisSiteList">Нулиране на изключените сайтове</string>
<string name="credentialManagementClearNeverForThisSiteDialogTitle">Нулиране на изключените сайтове?</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@

<string name="credentialManagementSuggestionsLabel">Navrhované</string>

<string name="credentialManagementWebViewIncompatibleErrorMessage">Automatické vyplňování hesel není dostupné, protože tvoje verze Android WebView je moc stará.</string>
<string name="credentialManagementWebViewIncompatibleErrorMessage">Automatické vyplňování hesel není dostupné, protože tvoje verze Android WebView je zastaralá nebo nekompatibilní.</string>

<string name="autofillManagementSearchClearDescription">Vymazat vyhledávací vstup</string>
<string name="autofillManagementNoSearchResults" instruction="Placeholder is the query the user has searched for. e.g., No results for &apos;kittens&apos;">Žádné výsledky pro dotaz „%1$s“</string>
Expand Down Expand Up @@ -145,6 +145,7 @@
<string name="credentials_invalid_request_warning_notif"><b>Synchronizace hesel je pozastavená</b>\nNěkterá hesla jsou nesprávně naformátovaná nebo moc dlouhá, takže jsme je nemohli synchronizovat.</string>

<string name="saveLoginDialogNeverForThisSite">Na téhle stránce už se neptat</string>
<string name="saveOnboardingLoginDialogSecondaryButton">Ne, děkuji</string>
<string name="credentialManagementInstructionNeverForThisSite">Pokud vyloučené weby resetuješ, při příštím přihlašování na některý z nich se ti zobrazí výzva k uložení hesla.</string>
<string name="credentialManagementClearNeverForThisSiteList">Obnovit vyloučené stránky</string>
<string name="credentialManagementClearNeverForThisSiteDialogTitle">Obnovit vyloučené stránky?</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@

<string name="credentialManagementSuggestionsLabel">Foreslået</string>

<string name="credentialManagementWebViewIncompatibleErrorMessage">Automatisk udfyldning af adgangskoder er ikke tilgængelig, fordi din version af Android WebView er for gammel.</string>
<string name="credentialManagementWebViewIncompatibleErrorMessage">Automatisk udfyldning af adgangskoder er ikke tilgængelig, fordi din version af Android WebView er forældet eller inkompatibel.</string>

<string name="autofillManagementSearchClearDescription">Ryd søgeinput</string>
<string name="autofillManagementNoSearchResults" instruction="Placeholder is the query the user has searched for. e.g., No results for &apos;kittens&apos;">Ingen resultater for \"%1$s\"</string>
Expand Down Expand Up @@ -145,6 +145,7 @@
<string name="credentials_invalid_request_warning_notif"><b>Synkronisering af adgangskoder er sat på pause</b>\nNogle adgangskoder er formateret forkert eller er for lange og blev ikke synkroniseret.</string>

<string name="saveLoginDialogNeverForThisSite">Spørg aldrig på dette websted</string>
<string name="saveOnboardingLoginDialogSecondaryButton">Nej tak</string>
<string name="credentialManagementInstructionNeverForThisSite">Hvis du nulstiller ekskluderede websteder, vil du blive bedt om at gemme din adgangskode, næste gang du logger ind på en af disse sider.</string>
<string name="credentialManagementClearNeverForThisSiteList">Nulstil ekskluderede websteder</string>
<string name="credentialManagementClearNeverForThisSiteDialogTitle">Nulstil ekskluderede websteder?</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@

<string name="credentialManagementSuggestionsLabel">Vorgeschlagen</string>

<string name="credentialManagementWebViewIncompatibleErrorMessage">Die automatische Vervollständigung von Passwörtern ist nicht verfügbar, da Ihre Version von Android WebView zu alt ist.</string>
<string name="credentialManagementWebViewIncompatibleErrorMessage">Die automatische Vervollständigung von Passwörtern ist nicht verfügbar, da deine Version von Android WebView nicht aktuell oder inkompatibel ist.</string>

<string name="autofillManagementSearchClearDescription">Sucheingabe löschen</string>
<string name="autofillManagementNoSearchResults" instruction="Placeholder is the query the user has searched for. e.g., No results for &apos;kittens&apos;">Keine Ergebnisse für „%1$s“</string>
Expand Down Expand Up @@ -145,6 +145,7 @@
<string name="credentials_invalid_request_warning_notif"><b>Die Passwort-Synchronisierung wurde angehalten</b>\nEinige Passwörter sind falsch formatiert oder zu lang und wurden nicht synchronisiert.\n\n</string>

<string name="saveLoginDialogNeverForThisSite">Für diese Website niemals fragen</string>
<string name="saveOnboardingLoginDialogSecondaryButton">Nein, danke</string>
<string name="credentialManagementInstructionNeverForThisSite">Wenn du die ausgeschlossenen Websites zurücksetzt, wirst du aufgefordert, dein Passwort zu speichern, wenn du dich das nächste Mal auf einer dieser Websites anmeldest.</string>
<string name="credentialManagementClearNeverForThisSiteList">Ausgeschlossene Websites zurücksetzen</string>
<string name="credentialManagementClearNeverForThisSiteDialogTitle">Ausgeschlossene Websites zurücksetzen?</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@

<string name="credentialManagementSuggestionsLabel">Προτεινόμενο</string>

<string name="credentialManagementWebViewIncompatibleErrorMessage">Η αυτόματη συμπλήρωση κωδικών πρόσβασης δεν είναι διαθέσιμη καθώς η έκδοση του Android WebView είναι πολύ παλιά.</string>
<string name="credentialManagementWebViewIncompatibleErrorMessage">Η αυτόματη συμπλήρωση κωδικών πρόσβασης δεν είναι διαθέσιμη καθώς η έκδοση του Android WebView είναι παλιά ή μη συμβατή.</string>

<string name="autofillManagementSearchClearDescription">Εκκαθάριση εισαγωγής αναζήτησης</string>
<string name="autofillManagementNoSearchResults" instruction="Placeholder is the query the user has searched for. e.g., No results for &apos;kittens&apos;">Δεν υπάρχουν αποτελέσματα για «%1$s»</string>
Expand Down Expand Up @@ -145,6 +145,7 @@
<string name="credentials_invalid_request_warning_notif"><b>Ο συγχρονισμός κωδικών πρόσβασης έχει τεθεί σε παύση</b>\nΟρισμένοι κωδικοί πρόσβασης δεν έχουν μορφοποιηθεί σωστά ή είναι πολύ μεγάλοι και δεν συγχρονίστηκαν.</string>

<string name="saveLoginDialogNeverForThisSite">Μην ζητάτε ποτέ αυτόν τον ιστότοπο</string>
<string name="saveOnboardingLoginDialogSecondaryButton">Όχι, ευχαριστώ</string>
<string name="credentialManagementInstructionNeverForThisSite">Εάν κάνετε επαναφορά των αποκλεισμένων ιστότοπων, θα σας ζητηθεί να αποθηκεύσετε τον κωδικό πρόσβασής σας την επόμενη φορά που θα συνδεθείτε σε οποιονδήποτε από τους ιστότοπους αυτούς.</string>
<string name="credentialManagementClearNeverForThisSiteList">Επαναφορά αποκλεισμένων ιστότοπων</string>
<string name="credentialManagementClearNeverForThisSiteDialogTitle">Επαναφορά αποκλεισμένων ιστότοπων;</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@

<string name="credentialManagementSuggestionsLabel">Sugerencias</string>

<string name="credentialManagementWebViewIncompatibleErrorMessage">La función de autocompletar para las contraseñas no está disponible porque tu versión de Android WebView es demasiado antigua.</string>
<string name="credentialManagementWebViewIncompatibleErrorMessage">La función de autocompletar para las contraseñas no está disponible porque tu versión de Android WebView está desfasada o es incompatible.</string>

<string name="autofillManagementSearchClearDescription">Borrar búsqueda</string>
<string name="autofillManagementNoSearchResults" instruction="Placeholder is the query the user has searched for. e.g., No results for &apos;kittens&apos;">Sin resultados para «%1$s»</string>
Expand Down Expand Up @@ -145,6 +145,7 @@
<string name="credentials_invalid_request_warning_notif"><b>La sincronización de contraseña está en pausa</b>\nAlgunas contraseñas tienen un formato incorrecto o son demasiado largas y no se han sincronizado.</string>

<string name="saveLoginDialogNeverForThisSite">No preguntar nunca para esta página</string>
<string name="saveOnboardingLoginDialogSecondaryButton">No, gracias</string>
<string name="credentialManagementInstructionNeverForThisSite">Si restableces los sitios excluidos, se te pedirá que guardes tu contraseña la próxima vez que accedas a cualquiera de estos sitios.</string>
<string name="credentialManagementClearNeverForThisSiteList">Restablecer sitios excluidos</string>
<string name="credentialManagementClearNeverForThisSiteDialogTitle">¿Restablecer sitios excluidos?</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@

<string name="credentialManagementSuggestionsLabel">Soovitatud</string>

<string name="credentialManagementWebViewIncompatibleErrorMessage">Automaatne täitmine paroolide jaoks pole saadaval, sest sinu Android WebView\'i versioon on liiga vana.</string>
<string name="credentialManagementWebViewIncompatibleErrorMessage">Automaatne täitmine paroolide jaoks pole saadaval, sest sinu Android WebView\'i versioon on aegunud või ühildumatu.</string>

<string name="autofillManagementSearchClearDescription">Tühjenda otsingusisend</string>
<string name="autofillManagementNoSearchResults" instruction="Placeholder is the query the user has searched for. e.g., No results for &apos;kittens&apos;">Päringule „%1$s” ei leitud tulemusi</string>
Expand Down Expand Up @@ -145,6 +145,7 @@
<string name="credentials_invalid_request_warning_notif"><b>Paroolide sünkroonimine on peatatud</b>\nMõned paroolid on valesti vormindatud või liiga pikad ja neid ei sünkroonitud.</string>

<string name="saveLoginDialogNeverForThisSite">Ära selle saidi kohta rohkem küsi</string>
<string name="saveOnboardingLoginDialogSecondaryButton">Ei, aitäh</string>
<string name="credentialManagementInstructionNeverForThisSite">Kui lähtestad välistatud saidid, pakutakse sulle järgmisel korral, kui logid neile saitidele sisse, võimalust parool salvestada.</string>
<string name="credentialManagementClearNeverForThisSiteList">Lähtesta välistatud saidid</string>
<string name="credentialManagementClearNeverForThisSiteDialogTitle">Kas lähtestada välistatud saidid?</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@

<string name="credentialManagementSuggestionsLabel">Ehdotettu</string>

<string name="credentialManagementWebViewIncompatibleErrorMessage">Salasanojen automaattinen täyttäminen ei ole käytettävissä, koska Android WebView -versiosi on liian vanha.</string>
<string name="credentialManagementWebViewIncompatibleErrorMessage">Salasanojen automaattinen täyttäminen ei ole käytettävissä, koska Android WebView -versiosi on vanhentunut tai yhteensopimaton.</string>

<string name="autofillManagementSearchClearDescription">Tyhjennä hakusyöte</string>
<string name="autofillManagementNoSearchResults" instruction="Placeholder is the query the user has searched for. e.g., No results for &apos;kittens&apos;">Ei tuloksia haulla \'%1$s\'</string>
Expand Down Expand Up @@ -145,6 +145,7 @@
<string name="credentials_invalid_request_warning_notif"><b>Salasanojen synkronointi keskeytetty</b>\nSalasanojen synkronointi on keskeytetty.\n\nJotkin salasanat on muotoiltu väärin tai ovat liian pitkiä, eikä niitä synkronoitu.</string>

<string name="saveLoginDialogNeverForThisSite">Älä kysy enää tällä sivustolla</string>
<string name="saveOnboardingLoginDialogSecondaryButton">Ei kiitos</string>
<string name="credentialManagementInstructionNeverForThisSite">Jos nollaat poissuljetut sivustot, sinua pyydetään tallentamaan salasanasi, kun seuraavan kerran kirjaudut sisään jollekin näistä sivustoista.</string>
<string name="credentialManagementClearNeverForThisSiteList">Nollaa poissuljetut sivustot</string>
<string name="credentialManagementClearNeverForThisSiteDialogTitle">Nollataanko poissuljetut sivustot?</string>
Expand Down
Loading

0 comments on commit a7f7752

Please sign in to comment.