Enable notification/delete when leave on server is enabled

This commit is contained in:
M66B
2021-11-28 19:38:19 +01:00
parent 10d957e7a9
commit 50b19ce0b0
3 changed files with 44 additions and 0 deletions

View File

@@ -57,6 +57,7 @@ public class ServiceUI extends IntentService {
static final int PI_HIDE = 9;
static final int PI_SNOOZE = 10;
static final int PI_IGNORED = 11;
static final int PI_DELETE = 12;
public ServiceUI() {
this(ServiceUI.class.getName());
@@ -108,6 +109,11 @@ public class ServiceUI extends IntentService {
onMove(id, EntityFolder.TRASH);
break;
case "delete":
cancel(group, id);
onDelete(id);
break;
case "junk":
cancel(group, id);
onJunk(id);
@@ -249,6 +255,23 @@ public class ServiceUI extends IntentService {
}
}
private void onDelete(long id) {
DB db = DB.getInstance(this);
try {
db.beginTransaction();
EntityMessage message = db.message().getMessage(id);
if (message == null)
return;
EntityOperation.queue(this, message, EntityOperation.DELETE);
db.setTransactionSuccessful();
} finally {
db.endTransaction();
}
}
private void onJunk(long id) throws JSONException {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
boolean block_sender = prefs.getBoolean("notify_block_sender", false);