mirror of
https://github.com/oxen-io/session-android.git
synced 2025-12-30 07:27:31 +00:00
Create placeholder ContentProviders for database observations.
Required for the API 26 migration. See https://developer.android.com/about/versions/oreo/android-8.0-changes#ccn
This commit is contained in:
@@ -28,10 +28,7 @@ import java.util.Set;
|
||||
|
||||
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 static final String ID_WHERE = "_id = ?";
|
||||
|
||||
protected SQLCipherOpenHelper databaseHelper;
|
||||
protected final Context context;
|
||||
@@ -47,29 +44,29 @@ public abstract class Database {
|
||||
}
|
||||
|
||||
protected void notifyConversationListeners(long threadId) {
|
||||
context.getContentResolver().notifyChange(Uri.parse(CONVERSATION_URI + threadId), null);
|
||||
context.getContentResolver().notifyChange(DatabaseContentProviders.Conversation.getUriForThread(threadId), null);
|
||||
}
|
||||
|
||||
protected void notifyConversationListListeners() {
|
||||
context.getContentResolver().notifyChange(Uri.parse(CONVERSATION_LIST_URI), null);
|
||||
context.getContentResolver().notifyChange(DatabaseContentProviders.ConversationList.CONTENT_URI, null);
|
||||
}
|
||||
|
||||
protected void setNotifyConverationListeners(Cursor cursor, long threadId) {
|
||||
cursor.setNotificationUri(context.getContentResolver(), Uri.parse(CONVERSATION_URI + threadId));
|
||||
cursor.setNotificationUri(context.getContentResolver(), DatabaseContentProviders.Conversation.getUriForThread(threadId));
|
||||
}
|
||||
|
||||
protected void setNotifyConverationListListeners(Cursor cursor) {
|
||||
cursor.setNotificationUri(context.getContentResolver(), Uri.parse(CONVERSATION_LIST_URI));
|
||||
cursor.setNotificationUri(context.getContentResolver(), DatabaseContentProviders.ConversationList.CONTENT_URI);
|
||||
}
|
||||
|
||||
protected void registerAttachmentListeners(@NonNull ContentObserver observer) {
|
||||
context.getContentResolver().registerContentObserver(Uri.parse(ATTACHMENT_URI),
|
||||
context.getContentResolver().registerContentObserver(DatabaseContentProviders.Attachment.CONTENT_URI,
|
||||
true,
|
||||
observer);
|
||||
}
|
||||
|
||||
protected void notifyAttachmentListeners() {
|
||||
context.getContentResolver().notifyChange(Uri.parse(ATTACHMENT_URI), null);
|
||||
context.getContentResolver().notifyChange(DatabaseContentProviders.Attachment.CONTENT_URI, null);
|
||||
}
|
||||
|
||||
public void reset(SQLCipherOpenHelper databaseHelper) {
|
||||
|
||||
Reference in New Issue
Block a user