diff --git a/app/core/src/main/java/com/fsck/k9/K9.kt b/app/core/src/main/java/com/fsck/k9/K9.kt index 9359277e4..cb582f5dc 100644 --- a/app/core/src/main/java/com/fsck/k9/K9.kt +++ b/app/core/src/main/java/com/fsck/k9/K9.kt @@ -184,7 +184,9 @@ object K9 : KoinComponent { @JvmStatic var isShowAnimations = true - private var confirmDelete = false + @JvmStatic + var isConfirmDelete = false + private var confirmDiscardMessage = true private var confirmDeleteStarred = false private var confirmSpam = false @@ -333,15 +335,6 @@ object K9 : KoinComponent { updateLoggingStatus() } - @JvmStatic - fun confirmDelete(): Boolean { - return confirmDelete - } - - fun setConfirmDelete(confirm: Boolean) { - confirmDelete = confirm - } - @JvmStatic fun confirmDeleteStarred(): Boolean { return confirmDeleteStarred @@ -508,7 +501,7 @@ object K9 : KoinComponent { hideUserAgent = storage.getBoolean("hideUserAgent", false) hideTimeZone = storage.getBoolean("hideTimeZone", false) - confirmDelete = storage.getBoolean("confirmDelete", false) + isConfirmDelete = storage.getBoolean("confirmDelete", false) confirmDiscardMessage = storage.getBoolean("confirmDiscardMessage", true) confirmDeleteStarred = storage.getBoolean("confirmDeleteStarred", false) confirmSpam = storage.getBoolean("confirmSpam", false) @@ -634,7 +627,7 @@ object K9 : KoinComponent { editor.putInt("messageComposeTheme", k9ComposerThemeSetting.ordinal) editor.putBoolean("fixedMessageViewTheme", isFixedMessageViewTheme) - editor.putBoolean("confirmDelete", confirmDelete) + editor.putBoolean("confirmDelete", isConfirmDelete) editor.putBoolean("confirmDiscardMessage", confirmDiscardMessage) editor.putBoolean("confirmDeleteStarred", confirmDeleteStarred) editor.putBoolean("confirmSpam", confirmSpam) diff --git a/app/ui/src/main/java/com/fsck/k9/fragment/MessageListFragment.java b/app/ui/src/main/java/com/fsck/k9/fragment/MessageListFragment.java index 15d766c3d..ba799f0ca 100644 --- a/app/ui/src/main/java/com/fsck/k9/fragment/MessageListFragment.java +++ b/app/ui/src/main/java/com/fsck/k9/fragment/MessageListFragment.java @@ -882,7 +882,7 @@ public class MessageListFragment extends Fragment implements OnItemClickListener } private void onDelete(List messages) { - if (K9.confirmDelete()) { + if (K9.isConfirmDelete()) { // remember the message selection for #onCreateDialog(int) activeMessages = messages; showDialog(R.id.dialog_confirm_delete); diff --git a/app/ui/src/main/java/com/fsck/k9/ui/messageview/MessageViewFragment.java b/app/ui/src/main/java/com/fsck/k9/ui/messageview/MessageViewFragment.java index f19e33f80..0e2472e99 100644 --- a/app/ui/src/main/java/com/fsck/k9/ui/messageview/MessageViewFragment.java +++ b/app/ui/src/main/java/com/fsck/k9/ui/messageview/MessageViewFragment.java @@ -290,7 +290,7 @@ public class MessageViewFragment extends Fragment implements ConfirmationDialogF * Called from UI thread when user select Delete */ public void onDelete() { - if (K9.confirmDelete() || (K9.confirmDeleteStarred() && mMessage.isSet(Flag.FLAGGED))) { + if (K9.isConfirmDelete() || (K9.confirmDeleteStarred() && mMessage.isSet(Flag.FLAGGED))) { showDialog(R.id.dialog_confirm_delete); } else { delete(); diff --git a/app/ui/src/main/java/com/fsck/k9/ui/settings/general/GeneralSettingsDataStore.kt b/app/ui/src/main/java/com/fsck/k9/ui/settings/general/GeneralSettingsDataStore.kt index 732506be4..dd237e1a8 100644 --- a/app/ui/src/main/java/com/fsck/k9/ui/settings/general/GeneralSettingsDataStore.kt +++ b/app/ui/src/main/java/com/fsck/k9/ui/settings/general/GeneralSettingsDataStore.kt @@ -151,7 +151,7 @@ class GeneralSettingsDataStore( return when (key) { "confirm_actions" -> { mutableSetOf().apply { - if (K9.confirmDelete()) add("delete") + if (K9.isConfirmDelete) add("delete") if (K9.confirmDeleteStarred()) add("delete_starred") if (K9.confirmDeleteFromNotification()) add("delete_notif") if (K9.confirmSpam()) add("spam") @@ -182,7 +182,7 @@ class GeneralSettingsDataStore( val checkedValues = values ?: emptySet() when (key) { "confirm_actions" -> { - K9.setConfirmDelete("delete" in checkedValues) + K9.isConfirmDelete = "delete" in checkedValues K9.setConfirmDeleteStarred("delete_starred" in checkedValues) K9.setConfirmDeleteFromNotification("delete_notif" in checkedValues) K9.setConfirmSpam("spam" in checkedValues)