mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-20 16:49:40 +01:00
Introduce SignalDatabase as the main database entrypoint.
This commit is contained in:
@@ -29,11 +29,8 @@ import org.thoughtcrime.securesms.attachments.UriAttachment;
|
||||
import org.thoughtcrime.securesms.components.voice.VoiceNoteDraft;
|
||||
import org.thoughtcrime.securesms.database.AttachmentDatabase;
|
||||
import org.thoughtcrime.securesms.database.DraftDatabase;
|
||||
import org.thoughtcrime.securesms.providers.BlobProvider;
|
||||
import org.thoughtcrime.securesms.util.MediaUtil;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
|
||||
public class AudioSlide extends Slide {
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ import android.net.Uri;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import org.thoughtcrime.securesms.attachments.Attachment;
|
||||
import org.thoughtcrime.securesms.util.FeatureFlags;
|
||||
import org.thoughtcrime.securesms.util.MediaUtil;
|
||||
|
||||
public class GifSlide extends ImageSlide {
|
||||
|
||||
@@ -28,7 +28,6 @@ import org.signal.core.util.logging.Log;
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.attachments.Attachment;
|
||||
import org.thoughtcrime.securesms.blurhash.BlurHash;
|
||||
import org.thoughtcrime.securesms.database.AttachmentDatabase;
|
||||
import org.thoughtcrime.securesms.database.AttachmentDatabase.TransformProperties;
|
||||
import org.thoughtcrime.securesms.util.MediaUtil;
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@ import org.thoughtcrime.securesms.recipients.RecipientId;
|
||||
import org.thoughtcrime.securesms.util.Base64;
|
||||
import org.whispersystems.signalservice.api.groupsv2.DecryptedGroupUtil;
|
||||
import org.whispersystems.signalservice.api.push.ACI;
|
||||
import org.whispersystems.signalservice.api.push.SignalServiceAddress;
|
||||
import org.whispersystems.signalservice.api.util.UuidUtil;
|
||||
import org.whispersystems.signalservice.internal.push.SignalServiceProtos.GroupContext;
|
||||
import org.whispersystems.signalservice.internal.push.SignalServiceProtos.GroupContextV2;
|
||||
|
||||
@@ -12,7 +12,7 @@ import org.thoughtcrime.securesms.BuildConfig;
|
||||
import org.thoughtcrime.securesms.attachments.Attachment;
|
||||
import org.thoughtcrime.securesms.attachments.AttachmentId;
|
||||
import org.thoughtcrime.securesms.avatar.AvatarPickerStorage;
|
||||
import org.thoughtcrime.securesms.database.DatabaseFactory;
|
||||
import org.thoughtcrime.securesms.database.SignalDatabase;
|
||||
import org.thoughtcrime.securesms.emoji.EmojiFiles;
|
||||
import org.thoughtcrime.securesms.providers.BlobProvider;
|
||||
import org.thoughtcrime.securesms.providers.DeprecatedPersistentBlobProvider;
|
||||
@@ -70,8 +70,8 @@ public class PartAuthority {
|
||||
int match = uriMatcher.match(uri);
|
||||
try {
|
||||
switch (match) {
|
||||
case PART_ROW: return DatabaseFactory.getAttachmentDatabase(context).getAttachmentStream(new PartUriParser(uri).getPartId(), 0);
|
||||
case STICKER_ROW: return DatabaseFactory.getStickerDatabase(context).getStickerStream(ContentUris.parseId(uri));
|
||||
case PART_ROW: return SignalDatabase.attachments().getAttachmentStream(new PartUriParser(uri).getPartId(), 0);
|
||||
case STICKER_ROW: return SignalDatabase.stickers().getStickerStream(ContentUris.parseId(uri));
|
||||
case PERSISTENT_ROW: return DeprecatedPersistentBlobProvider.getInstance(context).getStream(context, ContentUris.parseId(uri));
|
||||
case BLOB_ROW: return BlobProvider.getInstance().getStream(context, uri);
|
||||
case WALLPAPER_ROW: return WallpaperStorage.read(context, getWallpaperFilename(uri));
|
||||
@@ -89,7 +89,7 @@ public class PartAuthority {
|
||||
|
||||
switch (match) {
|
||||
case PART_ROW:
|
||||
Attachment attachment = DatabaseFactory.getAttachmentDatabase(context).getAttachment(new PartUriParser(uri).getPartId());
|
||||
Attachment attachment = SignalDatabase.attachments().getAttachment(new PartUriParser(uri).getPartId());
|
||||
|
||||
if (attachment != null) return attachment.getFileName();
|
||||
else return null;
|
||||
@@ -107,7 +107,7 @@ public class PartAuthority {
|
||||
|
||||
switch (match) {
|
||||
case PART_ROW:
|
||||
Attachment attachment = DatabaseFactory.getAttachmentDatabase(context).getAttachment(new PartUriParser(uri).getPartId());
|
||||
Attachment attachment = SignalDatabase.attachments().getAttachment(new PartUriParser(uri).getPartId());
|
||||
|
||||
if (attachment != null) return attachment.getSize();
|
||||
else return null;
|
||||
@@ -125,7 +125,7 @@ public class PartAuthority {
|
||||
|
||||
switch (match) {
|
||||
case PART_ROW:
|
||||
Attachment attachment = DatabaseFactory.getAttachmentDatabase(context).getAttachment(new PartUriParser(uri).getPartId());
|
||||
Attachment attachment = SignalDatabase.attachments().getAttachment(new PartUriParser(uri).getPartId());
|
||||
|
||||
if (attachment != null) return attachment.getContentType();
|
||||
else return null;
|
||||
@@ -143,7 +143,7 @@ public class PartAuthority {
|
||||
|
||||
switch (match) {
|
||||
case PART_ROW:
|
||||
Attachment attachment = DatabaseFactory.getAttachmentDatabase(context).getAttachment(new PartUriParser(uri).getPartId());
|
||||
Attachment attachment = SignalDatabase.attachments().getAttachment(new PartUriParser(uri).getPartId());
|
||||
|
||||
if (attachment != null) return attachment.isVideoGif();
|
||||
else return false;
|
||||
|
||||
Reference in New Issue
Block a user