Remove "confirmDelete" methods from 'K9'

This commit is contained in:
cketti 2019-05-22 00:37:49 +02:00
parent acd437c791
commit 1a06188e7c
4 changed files with 9 additions and 16 deletions

View file

@ -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)

View file

@ -882,7 +882,7 @@ public class MessageListFragment extends Fragment implements OnItemClickListener
}
private void onDelete(List<MessageReference> messages) {
if (K9.confirmDelete()) {
if (K9.isConfirmDelete()) {
// remember the message selection for #onCreateDialog(int)
activeMessages = messages;
showDialog(R.id.dialog_confirm_delete);

View file

@ -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();

View file

@ -151,7 +151,7 @@ class GeneralSettingsDataStore(
return when (key) {
"confirm_actions" -> {
mutableSetOf<String>().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<String>()
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)