diff options
author | Fabian Henneke <FabianHenneke@users.noreply.github.com> | 2020-04-22 11:14:25 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-22 14:44:25 +0530 |
commit | 9c1cc8690d34d7824e1bb8b7e7766df0a152cd5a (patch) | |
tree | b5ec8b0957faa18f6fb9302640a532fe12e63b1c /app/src/main | |
parent | c302d6fe580a1a12dfe63560e8218f5add65bde8 (diff) |
Mark Autofill onboarding dialog as seen on dismiss (#731)
Diffstat (limited to 'app/src/main')
-rw-r--r-- | app/src/main/java/com/zeapo/pwdstore/PasswordStore.kt | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/PasswordStore.kt b/app/src/main/java/com/zeapo/pwdstore/PasswordStore.kt index da1e72a1..58e1f39c 100644 --- a/app/src/main/java/com/zeapo/pwdstore/PasswordStore.kt +++ b/app/src/main/java/com/zeapo/pwdstore/PasswordStore.kt @@ -128,7 +128,7 @@ class PasswordStore : AppCompatActivity() { // If user is eligible for Oreo autofill, prompt them to switch. if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && - !settings.getBoolean("seen_autofill_onboarding", false)) { + !settings.getBoolean(PREFERENCE_SEEN_AUTOFILL_ONBOARDING, false)) { MaterialAlertDialogBuilder(this).run { @SuppressLint("InflateParams") val layout = @@ -151,13 +151,16 @@ class PasswordStore : AppCompatActivity() { "$appLabel: $supportDescription" } setView(layout) - setTitle(getString(R.string.autofill_onboarding_dialog_title)) + setTitle(R.string.autofill_onboarding_dialog_title) setPositiveButton(R.string.dialog_ok) { _, _ -> - settings.edit { putBoolean("seen_autofill_onboarding", true) } startActivity(Intent(Settings.ACTION_REQUEST_SET_AUTOFILL_SERVICE).apply { data = Uri.parse("package:${BuildConfig.APPLICATION_ID}") }) } + setNegativeButton(R.string.dialog_cancel) { _, _ -> } + setOnDismissListener { + settings.edit { putBoolean(PREFERENCE_SEEN_AUTOFILL_ONBOARDING, true) } + } show() } } @@ -846,6 +849,8 @@ class PasswordStore : AppCompatActivity() { block != null && block !== UnicodeBlock.SPECIALS) } + private const val PREFERENCE_SEEN_AUTOFILL_ONBOARDING = "seen_autofill_onboarding" + fun commitChange(activity: Activity, message: String, finishWithResultOnEnd: Intent? = null) { object : GitOperation(getRepositoryDirectory(activity), activity) { override fun execute() { |