From cd72d15b328cce62d0a6162533bd868222824f75 Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Sun, 14 Jun 2020 07:54:46 +0000 Subject: UserPreference: delete all shortcuts when repository is deleted (#850) --- CHANGELOG.md | 1 + app/src/main/java/com/zeapo/pwdstore/UserPreference.kt | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 317e7a95..0bbe354f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ All notable changes to this project will be documented in this file. ### Fixed - 'Draw over other apps' permission dialog opens when attempting to use Oreo Autofill +- Old app shortcuts are now removed when the local repository is deleted ### Added - Completely revamped decypted password view diff --git a/app/src/main/java/com/zeapo/pwdstore/UserPreference.kt b/app/src/main/java/com/zeapo/pwdstore/UserPreference.kt index 04967c82..cd01c883 100644 --- a/app/src/main/java/com/zeapo/pwdstore/UserPreference.kt +++ b/app/src/main/java/com/zeapo/pwdstore/UserPreference.kt @@ -232,6 +232,11 @@ class UserPreference : AppCompatActivity() { // TODO Handle the different cases of exceptions } + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) { + requireContext().getSystemService()?.apply { + removeDynamicShortcuts(dynamicShortcuts.map { it.id }.toMutableList()) + } + } sharedPreferences.edit { putBoolean("repository_initialized", false) } dialogInterface.cancel() callingActivity.finish() -- cgit v1.2.3