diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java b/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java index b83b37f616..fd2c0ff411 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java @@ -231,6 +231,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc private SwitchCompat swAdjacentPortrait; private SwitchCompat swAdjacentLandscape; private SwitchCompat swDeleteConfirmation; + private SwitchCompat swDeleteNotification; private SwitchCompat swDmarcViewer; private EditText etKeywords; private SwitchCompat swTestIab; @@ -291,7 +292,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc "webp", "animate_images", "easy_correct", "paste_plain", "infra", "tld_flags", "json_ld", "dup_msgids", "thread_byref", "save_user_flags", "mdn", "app_chooser", "app_chooser_share", "adjacent_links", "adjacent_documents", "adjacent_portrait", "adjacent_landscape", - "delete_confirmation", "global_keywords", "test_iab" + "delete_confirmation", "delete_notification", "global_keywords", "test_iab" )); private final static String[] RESET_QUESTIONS = new String[]{ @@ -472,6 +473,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc swAdjacentPortrait = view.findViewById(R.id.swAdjacentPortrait); swAdjacentLandscape = view.findViewById(R.id.swAdjacentLandscape); swDeleteConfirmation = view.findViewById(R.id.swDeleteConfirmation); + swDeleteNotification = view.findViewById(R.id.swDeleteNotification); swDmarcViewer = view.findViewById(R.id.swDmarcViewer); etKeywords = view.findViewById(R.id.etKeywords); swTestIab = view.findViewById(R.id.swTestIab); @@ -1644,6 +1646,13 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc } }); + swDeleteNotification.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { + prefs.edit().putBoolean("delete_notification", checked).apply(); + } + }); + swDmarcViewer.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { @@ -2393,6 +2402,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc swAdjacentPortrait.setChecked(prefs.getBoolean("adjacent_portrait", false)); swAdjacentLandscape.setChecked(prefs.getBoolean("adjacent_landscape", false)); swDeleteConfirmation.setChecked(prefs.getBoolean("delete_confirmation", true)); + swDeleteNotification.setChecked(prefs.getBoolean("delete_notification", false)); swDmarcViewer.setChecked(Helper.isComponentEnabled(getContext(), ActivityDMARC.class)); etKeywords.setText(prefs.getString("global_keywords", null)); swTestIab.setChecked(prefs.getBoolean("test_iab", false)); diff --git a/app/src/main/java/eu/faircode/email/NotificationHelper.java b/app/src/main/java/eu/faircode/email/NotificationHelper.java index ffa81a95f0..4d72790228 100644 --- a/app/src/main/java/eu/faircode/email/NotificationHelper.java +++ b/app/src/main/java/eu/faircode/email/NotificationHelper.java @@ -703,8 +703,7 @@ class NotificationHelper { String sound = prefs.getString("sound", null); boolean alert_once = prefs.getBoolean("alert_once", true); boolean perform_expunge = prefs.getBoolean("perform_expunge", true); - boolean delete_confirmation = prefs.getBoolean("delete_confirmation", true); - + boolean delete_notification = prefs.getBoolean("delete_notification", false); // Get contact info Map messageFrom = new HashMap<>(); @@ -1073,8 +1072,8 @@ class NotificationHelper { List wactions = new ArrayList<>(); if (notify_trash && - perform_expunge && - message.accountProtocol == EntityAccount.TYPE_IMAP) { + !delete_notification && + message.accountProtocol == EntityAccount.TYPE_IMAP && perform_expunge) { EntityFolder folder = db.folder().getFolderByType(message.account, EntityFolder.TRASH); if (folder != null && !folder.id.equals(message.folder)) { Intent trash = new Intent(context, ServiceUI.class) @@ -1094,7 +1093,7 @@ class NotificationHelper { wactions.add(actionTrash.build()); } } else if (notify_trash && - (!delete_confirmation || + (delete_notification || (message.accountProtocol == EntityAccount.TYPE_POP && message.accountLeaveDeleted) || (message.accountProtocol == EntityAccount.TYPE_IMAP && !perform_expunge))) { Intent delete = new Intent(context, ServiceUI.class) @@ -1104,7 +1103,7 @@ class NotificationHelper { context, ServiceUI.PI_DELETE, delete, PendingIntent.FLAG_UPDATE_CURRENT); NotificationCompat.Action.Builder actionDelete = new NotificationCompat.Action.Builder( R.drawable.twotone_delete_forever_24, - context.getString(R.string.title_advanced_notify_action_delete), + context.getString(R.string.title_delete_permanently), piDelete) .setSemanticAction(NotificationCompat.Action.SEMANTIC_ACTION_DELETE) .setShowsUserInterface(false) diff --git a/app/src/main/res/layout/fragment_options_misc.xml b/app/src/main/res/layout/fragment_options_misc.xml index 6db022142a..6112063155 100644 --- a/app/src/main/res/layout/fragment_options_misc.xml +++ b/app/src/main/res/layout/fragment_options_misc.xml @@ -2008,6 +2008,31 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/swDeleteConfirmation" /> + + + + Portrait mode Landscape mode Permanent deletion confirmation - If you turn this off, please do not complain if you accidentally delete messages irreversibly + Delete permanently from notifications + If you change this setting, please do not complain if you accidentally deleted messages irreversibly DMARC viewer Global keywords Test IAB