mirror of https://github.com/M66B/FairEmail.git
Added rule action permanent delete
This commit is contained in:
parent
9b4e36fa00
commit
e670335429
|
@ -4,6 +4,10 @@
|
|||
|
||||
### [Draconyx](https://en.wikipedia.org/wiki/Draconyx)
|
||||
|
||||
### Next version
|
||||
|
||||
* Added rule action to permanently delete messages
|
||||
|
||||
### 1.1800 - 2021-12-27
|
||||
|
||||
* Fixed crash when manually configuring an account
|
||||
|
|
5
FAQ.md
5
FAQ.md
|
@ -2374,14 +2374,11 @@ You can select one of these actions to apply to matching messages:
|
|||
* Add keyword
|
||||
* Move
|
||||
* Copy (Gmail: label)
|
||||
* Delete permanently (since version 1.1801)
|
||||
* Answer/forward (with template)
|
||||
* Text-to-speech (sender and subject)
|
||||
* Automation (Tasker, etc)
|
||||
|
||||
An small error in a rule condition can lead to a disaster, therefore irreversible actions, like permanent deletion, are unsupportable and won't be added.
|
||||
If you want to permanently delete messages, you can use a filter rule to automatically move messages to the trash folder and set up auto deleting for the trash folder in the folder properties.
|
||||
This way there is a chance to recover messages for when the filter condition was incorrect.
|
||||
|
||||
If you want to forward a message, consider to use a *move* action instead.
|
||||
This will be more reliable than forwarding because forwarded messages might be considered as spam.
|
||||
|
||||
|
|
|
@ -4,6 +4,10 @@
|
|||
|
||||
### [Draconyx](https://en.wikipedia.org/wiki/Draconyx)
|
||||
|
||||
### Next version
|
||||
|
||||
* Added rule action to permanently delete messages
|
||||
|
||||
### 1.1800 - 2021-12-27
|
||||
|
||||
* Fixed crash when manually configuring an account
|
||||
|
|
|
@ -183,6 +183,9 @@ public class AdapterRule extends RecyclerView.Adapter<AdapterRule.ViewHolder> {
|
|||
case EntityRule.TYPE_AUTOMATION:
|
||||
tvAction.setText(R.string.title_rule_automation);
|
||||
break;
|
||||
case EntityRule.TYPE_DELETE:
|
||||
tvAction.setText(R.string.title_rule_delete);
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException("Unknown action type=" + type);
|
||||
}
|
||||
|
|
|
@ -113,6 +113,7 @@ public class EntityRule {
|
|||
static final int TYPE_HIDE = 12;
|
||||
static final int TYPE_IMPORTANCE = 13;
|
||||
static final int TYPE_TTS = 14;
|
||||
static final int TYPE_DELETE = 15;
|
||||
|
||||
static final String ACTION_AUTOMATION = BuildConfig.APPLICATION_ID + ".AUTOMATION";
|
||||
static final String EXTRA_RULE = "rule";
|
||||
|
@ -464,6 +465,8 @@ public class EntityRule {
|
|||
return onActionTts(context, message, jaction);
|
||||
case TYPE_AUTOMATION:
|
||||
return onActionAutomation(context, message, jaction);
|
||||
case TYPE_DELETE:
|
||||
return onActionDelete(context, message, jaction);
|
||||
default:
|
||||
throw new IllegalArgumentException("Unknown rule type=" + type + " name=" + name);
|
||||
}
|
||||
|
@ -528,6 +531,8 @@ public class EntityRule {
|
|||
return;
|
||||
case TYPE_AUTOMATION:
|
||||
return;
|
||||
case TYPE_DELETE:
|
||||
return;
|
||||
default:
|
||||
throw new IllegalArgumentException("Unknown rule type=" + type);
|
||||
}
|
||||
|
@ -928,6 +933,14 @@ public class EntityRule {
|
|||
return true;
|
||||
}
|
||||
|
||||
private boolean onActionDelete(Context context, EntityMessage message, JSONObject jargs) {
|
||||
EntityOperation.queue(context, message, EntityOperation.DELETE);
|
||||
|
||||
message.ui_hide = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private static Calendar getRelativeCalendar(int minutes, long reference) {
|
||||
int d = minutes / (24 * 60);
|
||||
int h = minutes / 60 % 24;
|
||||
|
|
|
@ -161,6 +161,7 @@ public class FragmentRule extends FragmentBase {
|
|||
private Group grpAnswer;
|
||||
private Group grpTts;
|
||||
private Group grpAutomation;
|
||||
private Group grpDelete;
|
||||
|
||||
private ArrayAdapter<String> adapterDay;
|
||||
private ArrayAdapter<Action> adapterAction;
|
||||
|
@ -299,6 +300,7 @@ public class FragmentRule extends FragmentBase {
|
|||
grpAnswer = view.findViewById(R.id.grpAnswer);
|
||||
grpTts = view.findViewById(R.id.grpTts);
|
||||
grpAutomation = view.findViewById(R.id.grpAutomation);
|
||||
grpDelete = view.findViewById(R.id.grpDelete);
|
||||
|
||||
ibSender.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
@ -456,6 +458,7 @@ public class FragmentRule extends FragmentBase {
|
|||
actions.add(new Action(EntityRule.TYPE_MOVE, getString(R.string.title_rule_move)));
|
||||
actions.add(new Action(EntityRule.TYPE_COPY, getString(R.string.title_rule_copy)));
|
||||
}
|
||||
actions.add(new Action(EntityRule.TYPE_DELETE, getString(R.string.title_rule_delete)));
|
||||
actions.add(new Action(EntityRule.TYPE_ANSWER, getString(R.string.title_rule_answer)));
|
||||
actions.add(new Action(EntityRule.TYPE_TTS, getString(R.string.title_rule_tts)));
|
||||
actions.add(new Action(EntityRule.TYPE_AUTOMATION, getString(R.string.title_rule_automation)));
|
||||
|
@ -587,6 +590,7 @@ public class FragmentRule extends FragmentBase {
|
|||
grpAnswer.setVisibility(View.GONE);
|
||||
grpTts.setVisibility(View.GONE);
|
||||
grpAutomation.setVisibility(View.GONE);
|
||||
grpDelete.setVisibility(View.GONE);
|
||||
|
||||
pbWait.setVisibility(View.VISIBLE);
|
||||
|
||||
|
@ -1050,6 +1054,7 @@ public class FragmentRule extends FragmentBase {
|
|||
grpAnswer.setVisibility(type == EntityRule.TYPE_ANSWER ? View.VISIBLE : View.GONE);
|
||||
grpTts.setVisibility(type == EntityRule.TYPE_TTS ? View.VISIBLE : View.GONE);
|
||||
grpAutomation.setVisibility(type == EntityRule.TYPE_AUTOMATION ? View.VISIBLE : View.GONE);
|
||||
grpDelete.setVisibility(type == EntityRule.TYPE_DELETE ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
|
||||
private void onActionDelete() {
|
||||
|
|
|
@ -926,6 +926,21 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/btnTtsData" />
|
||||
|
||||
<eu.faircode.email.FixedTextView
|
||||
android:id="@+id/tvDelete"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:drawableStart="@drawable/twotone_warning_24"
|
||||
android:drawablePadding="6dp"
|
||||
android:drawableTint="?attr/colorWarning"
|
||||
android:text="@string/title_rule_delete_hint"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
|
||||
android:textColor="?attr/colorWarning"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tvAutomation" />
|
||||
|
||||
<androidx.constraintlayout.widget.Group
|
||||
android:id="@+id/grpReady"
|
||||
android:layout_width="0dp"
|
||||
|
@ -993,6 +1008,12 @@
|
|||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:constraint_referenced_ids="tvAutomation" />
|
||||
|
||||
<androidx.constraintlayout.widget.Group
|
||||
android:id="@+id/grpDelete"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:constraint_referenced_ids="tvDelete" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</eu.faircode.email.ScrollViewEx>
|
||||
|
||||
|
|
|
@ -1476,6 +1476,7 @@
|
|||
<string name="title_rule_answer">Reply/forward</string>
|
||||
<string name="title_rule_tts">Text to speech</string>
|
||||
<string name="title_rule_automation">Automation</string>
|
||||
<string name="title_rule_delete">Delete permanently</string>
|
||||
|
||||
<string name="title_rule_caption">Edit rule</string>
|
||||
<string name="title_rule_title">Rule applies to</string>
|
||||
|
@ -1517,6 +1518,7 @@
|
|||
<string name="title_rule_answer_missing">Template missing</string>
|
||||
<string name="title_rule_keyword_missing">Keyword missing</string>
|
||||
<string name="title_rule_automation_hint">This will send the intent \'%1$s\' with the extras \'%2$s\'</string>
|
||||
<string name="title_rule_delete_hint">Permanent deletion is irreversible, so make sure the rule conditions are correct!</string>
|
||||
|
||||
<string name="title_rule_execute">Execute now</string>
|
||||
<string name="title_rule_applied">Affected messages: %1$d</string>
|
||||
|
|
|
@ -4,6 +4,10 @@
|
|||
|
||||
### [Draconyx](https://en.wikipedia.org/wiki/Draconyx)
|
||||
|
||||
### Next version
|
||||
|
||||
* Added rule action to permanently delete messages
|
||||
|
||||
### 1.1800 - 2021-12-27
|
||||
|
||||
* Fixed crash when manually configuring an account
|
||||
|
|
Loading…
Reference in New Issue