mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-22 01:40:07 +01:00
Introduce SignalDatabase as the main database entrypoint.
This commit is contained in:
@@ -10,9 +10,9 @@ import androidx.annotation.WorkerThread;
|
||||
import org.signal.core.util.concurrent.SignalExecutors;
|
||||
import org.signal.core.util.logging.Log;
|
||||
import org.thoughtcrime.securesms.contacts.ContactRepository;
|
||||
import org.thoughtcrime.securesms.database.DatabaseFactory;
|
||||
import org.thoughtcrime.securesms.database.GroupDatabase;
|
||||
import org.thoughtcrime.securesms.database.RecipientDatabase;
|
||||
import org.thoughtcrime.securesms.database.SignalDatabase;
|
||||
import org.thoughtcrime.securesms.database.ThreadDatabase;
|
||||
import org.thoughtcrime.securesms.database.model.ThreadRecord;
|
||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
@@ -45,9 +45,9 @@ class CameraContactsRepository {
|
||||
|
||||
CameraContactsRepository(@NonNull Context context) {
|
||||
this.context = context.getApplicationContext();
|
||||
this.threadDatabase = DatabaseFactory.getThreadDatabase(context);
|
||||
this.groupDatabase = DatabaseFactory.getGroupDatabase(context);
|
||||
this.recipientDatabase = DatabaseFactory.getRecipientDatabase(context);
|
||||
this.threadDatabase = SignalDatabase.threads();
|
||||
this.groupDatabase = SignalDatabase.groups();
|
||||
this.recipientDatabase = SignalDatabase.recipients();
|
||||
this.contactRepository = new ContactRepository(context);
|
||||
this.serialExecutor = SignalExecutors.SERIAL;
|
||||
this.parallelExecutor = SignalExecutors.BOUNDED;
|
||||
|
||||
@@ -14,7 +14,7 @@ import org.thoughtcrime.securesms.attachments.Attachment;
|
||||
import org.thoughtcrime.securesms.attachments.AttachmentId;
|
||||
import org.thoughtcrime.securesms.database.AttachmentDatabase;
|
||||
import org.thoughtcrime.securesms.database.AttachmentDatabase.TransformProperties;
|
||||
import org.thoughtcrime.securesms.database.DatabaseFactory;
|
||||
import org.thoughtcrime.securesms.database.SignalDatabase;
|
||||
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies;
|
||||
import org.thoughtcrime.securesms.jobmanager.JobManager;
|
||||
import org.thoughtcrime.securesms.mms.GifSlide;
|
||||
@@ -136,7 +136,7 @@ public class MediaUploadRepository {
|
||||
|
||||
public void deleteAbandonedAttachments() {
|
||||
executor.execute(() -> {
|
||||
int deleted = DatabaseFactory.getAttachmentDatabase(context).deleteAbandonedPreuploadedAttachments();
|
||||
int deleted = SignalDatabase.attachments().deleteAbandonedPreuploadedAttachments();
|
||||
Log.i(TAG, "Deleted " + deleted + " abandoned attachments.");
|
||||
});
|
||||
}
|
||||
@@ -165,7 +165,7 @@ public class MediaUploadRepository {
|
||||
|
||||
@WorkerThread
|
||||
private void updateCaptionsInternal(@NonNull List<Media> updatedMedia) {
|
||||
AttachmentDatabase db = DatabaseFactory.getAttachmentDatabase(context);
|
||||
AttachmentDatabase db = SignalDatabase.attachments();
|
||||
|
||||
for (Media updated : updatedMedia) {
|
||||
PreUploadResult result = uploadResults.get(updated);
|
||||
@@ -195,7 +195,7 @@ public class MediaUploadRepository {
|
||||
}
|
||||
}
|
||||
|
||||
DatabaseFactory.getAttachmentDatabase(context).updateDisplayOrder(orderMap);
|
||||
SignalDatabase.attachments().updateDisplayOrder(orderMap);
|
||||
|
||||
if (orderedUploadResults.size() == uploadResults.size()) {
|
||||
uploadResults.clear();
|
||||
|
||||
Reference in New Issue
Block a user