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) --- app/src/main/java/com/zeapo/pwdstore/UserPreference.kt | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'app/src/main/java/com/zeapo') 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