Skip to content
This repository was archived by the owner on Oct 15, 2024. It is now read-only.

Commit 9c1cc86

Browse files
Mark Autofill onboarding dialog as seen on dismiss (#731)
1 parent c302d6f commit 9c1cc86

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

app/src/main/java/com/zeapo/pwdstore/PasswordStore.kt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ class PasswordStore : AppCompatActivity() {
128128

129129
// If user is eligible for Oreo autofill, prompt them to switch.
130130
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O &&
131-
!settings.getBoolean("seen_autofill_onboarding", false)) {
131+
!settings.getBoolean(PREFERENCE_SEEN_AUTOFILL_ONBOARDING, false)) {
132132
MaterialAlertDialogBuilder(this).run {
133133
@SuppressLint("InflateParams")
134134
val layout =
@@ -151,13 +151,16 @@ class PasswordStore : AppCompatActivity() {
151151
"$appLabel: $supportDescription"
152152
}
153153
setView(layout)
154-
setTitle(getString(R.string.autofill_onboarding_dialog_title))
154+
setTitle(R.string.autofill_onboarding_dialog_title)
155155
setPositiveButton(R.string.dialog_ok) { _, _ ->
156-
settings.edit { putBoolean("seen_autofill_onboarding", true) }
157156
startActivity(Intent(Settings.ACTION_REQUEST_SET_AUTOFILL_SERVICE).apply {
158157
data = Uri.parse("package:${BuildConfig.APPLICATION_ID}")
159158
})
160159
}
160+
setNegativeButton(R.string.dialog_cancel) { _, _ -> }
161+
setOnDismissListener {
162+
settings.edit { putBoolean(PREFERENCE_SEEN_AUTOFILL_ONBOARDING, true) }
163+
}
161164
show()
162165
}
163166
}
@@ -846,6 +849,8 @@ class PasswordStore : AppCompatActivity() {
846849
block != null && block !== UnicodeBlock.SPECIALS)
847850
}
848851

852+
private const val PREFERENCE_SEEN_AUTOFILL_ONBOARDING = "seen_autofill_onboarding"
853+
849854
fun commitChange(activity: Activity, message: String, finishWithResultOnEnd: Intent? = null) {
850855
object : GitOperation(getRepositoryDirectory(activity), activity) {
851856
override fun execute() {

0 commit comments

Comments
 (0)