mirror of
https://github.com/oxen-io/session-android.git
synced 2025-12-30 05:36:40 +00:00
Allow deletion of media through preview.
When viewing a media in the media preview, you can delete it by pressing a delete button on the action bar. It will then ask you to confirm your choice. If you confirm, it will delete the attachment from the database and from disk. If it was the only attachment for that message, the message itself will also be deleted.
This commit is contained in:
committed by
Moxie Marlinspike
parent
a8cf5b8efa
commit
0c768a24e4
@@ -17,8 +17,10 @@
|
||||
package org.thoughtcrime.securesms.database;
|
||||
|
||||
import android.content.Context;
|
||||
import android.database.ContentObserver;
|
||||
import android.database.Cursor;
|
||||
import android.net.Uri;
|
||||
import android.support.annotation.NonNull;
|
||||
|
||||
import org.thoughtcrime.securesms.database.helpers.SQLCipherOpenHelper;
|
||||
|
||||
@@ -29,6 +31,7 @@ public abstract class Database {
|
||||
protected static final String ID_WHERE = "_id = ?";
|
||||
private static final String CONVERSATION_URI = "content://textsecure/thread/";
|
||||
private static final String CONVERSATION_LIST_URI = "content://textsecure/conversation-list";
|
||||
private static final String ATTACHMENT_URI = "content://textsecure/attachment/";
|
||||
|
||||
protected SQLCipherOpenHelper databaseHelper;
|
||||
protected final Context context;
|
||||
@@ -59,6 +62,16 @@ public abstract class Database {
|
||||
cursor.setNotificationUri(context.getContentResolver(), Uri.parse(CONVERSATION_LIST_URI));
|
||||
}
|
||||
|
||||
protected void registerAttachmentListeners(@NonNull ContentObserver observer) {
|
||||
context.getContentResolver().registerContentObserver(Uri.parse(ATTACHMENT_URI),
|
||||
true,
|
||||
observer);
|
||||
}
|
||||
|
||||
protected void notifyAttachmentListeners() {
|
||||
context.getContentResolver().notifyChange(Uri.parse(ATTACHMENT_URI), null);
|
||||
}
|
||||
|
||||
public void reset(SQLCipherOpenHelper databaseHelper) {
|
||||
this.databaseHelper = databaseHelper;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user