Renamed database classes to table classes.

Because they're not databases. They're tables.
This commit is contained in:
Greyson Parrelli
2022-11-29 10:47:12 -05:00
committed by Cody Henthorne
parent b190f9495a
commit 7949996c5c
382 changed files with 3420 additions and 3464 deletions

View File

@@ -18,7 +18,6 @@ package org.thoughtcrime.securesms.mms;
import android.Manifest;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
@@ -53,8 +52,8 @@ import org.thoughtcrime.securesms.components.ThumbnailView;
import org.thoughtcrime.securesms.components.location.SignalMapView;
import org.thoughtcrime.securesms.components.location.SignalPlace;
import org.thoughtcrime.securesms.conversation.MessageSendType;
import org.thoughtcrime.securesms.database.AttachmentDatabase;
import org.thoughtcrime.securesms.database.MediaDatabase;
import org.thoughtcrime.securesms.database.AttachmentTable;
import org.thoughtcrime.securesms.database.MediaTable;
import org.thoughtcrime.securesms.database.SignalDatabase;
import org.thoughtcrime.securesms.giph.ui.GiphyActivity;
import org.thoughtcrime.securesms.maps.PlacePickerActivity;
@@ -62,7 +61,6 @@ import org.thoughtcrime.securesms.mediapreview.MediaIntentFactory;
import org.thoughtcrime.securesms.mediapreview.MediaPreviewV2Fragment;
import org.thoughtcrime.securesms.mediasend.v2.MediaSelectionActivity;
import org.thoughtcrime.securesms.payments.CanNotSendPaymentDialog;
import org.thoughtcrime.securesms.payments.MobileCoinPublicAddress;
import org.thoughtcrime.securesms.payments.PaymentsAddressException;
import org.thoughtcrime.securesms.payments.create.CreatePaymentFragmentArgs;
import org.thoughtcrime.securesms.payments.preferences.PaymentsActivity;
@@ -93,7 +91,6 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
public class AttachmentManager {
@@ -346,8 +343,8 @@ public class AttachmentManager {
Long mediaSize = null;
String fileName = null;
String mimeType = null;
boolean gif = false;
AttachmentDatabase.TransformProperties transformProperties = null;
boolean gif = false;
AttachmentTable.TransformProperties transformProperties = null;
if (PartAuthority.isLocalUri(uri)) {
mediaSize = PartAuthority.getAttachmentSize(context, uri);
@@ -529,7 +526,7 @@ public class AttachmentManager {
false,
false,
false,
MediaDatabase.Sorting.Newest,
MediaTable.Sorting.Newest,
slide.isVideoGif());
context.startActivity(MediaIntentFactory.create(context, args));
}

View File

@@ -27,19 +27,19 @@ import org.thoughtcrime.securesms.R;
import org.thoughtcrime.securesms.attachments.Attachment;
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.database.AttachmentTable;
import org.thoughtcrime.securesms.database.DraftTable;
import org.thoughtcrime.securesms.util.MediaUtil;
public class AudioSlide extends Slide {
public static @NonNull AudioSlide createFromVoiceNoteDraft(@NonNull Context context, @NonNull DraftDatabase.Draft draft) {
public static @NonNull AudioSlide createFromVoiceNoteDraft(@NonNull Context context, @NonNull DraftTable.Draft draft) {
VoiceNoteDraft voiceNoteDraft = VoiceNoteDraft.fromDraft(draft);
return new AudioSlide(context, new UriAttachment(voiceNoteDraft.getUri(),
MediaUtil.AUDIO_AAC,
AttachmentDatabase.TRANSFER_PROGRESS_DONE,
AttachmentTable.TRANSFER_PROGRESS_DONE,
voiceNoteDraft.getSize(),
0,
0,
@@ -61,7 +61,7 @@ public class AudioSlide extends Slide {
}
public AudioSlide(Context context, Uri uri, long dataSize, String contentType, boolean voiceNote) {
super(context, new UriAttachment(uri, contentType, AttachmentDatabase.TRANSFER_PROGRESS_STARTED, dataSize, 0, 0, null, null, voiceNote, false, false, false, null, null, null, null, null));
super(context, new UriAttachment(uri, contentType, AttachmentTable.TRANSFER_PROGRESS_STARTED, dataSize, 0, 0, null, null, voiceNote, false, false, false, null, null, null, null, null));
}
public AudioSlide(Context context, Attachment attachment) {

View File

@@ -28,7 +28,7 @@ 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.TransformProperties;
import org.thoughtcrime.securesms.database.AttachmentTable.TransformProperties;
import org.thoughtcrime.securesms.util.MediaUtil;
public class ImageSlide extends Slide {

View File

@@ -1,6 +1,6 @@
package org.thoughtcrime.securesms.mms;
import org.thoughtcrime.securesms.database.ThreadDatabase;
import org.thoughtcrime.securesms.database.ThreadTable;
import org.thoughtcrime.securesms.database.model.StoryType;
import org.thoughtcrime.securesms.recipients.Recipient;
@@ -14,7 +14,7 @@ public class OutgoingExpirationUpdateMessage extends OutgoingSecureMediaMessage
"",
new LinkedList<>(),
sentTimeMillis,
ThreadDatabase.DistributionTypes.CONVERSATION,
ThreadTable.DistributionTypes.CONVERSATION,
expiresIn,
false,
StoryType.NONE,

View File

@@ -5,7 +5,7 @@ import androidx.annotation.Nullable;
import org.thoughtcrime.securesms.attachments.Attachment;
import org.thoughtcrime.securesms.contactshare.Contact;
import org.thoughtcrime.securesms.database.ThreadDatabase;
import org.thoughtcrime.securesms.database.ThreadTable;
import org.thoughtcrime.securesms.database.model.Mention;
import org.thoughtcrime.securesms.database.model.StoryType;
import org.thoughtcrime.securesms.database.model.databaseprotos.DecryptedGroupV2Context;
@@ -36,7 +36,7 @@ public final class OutgoingGroupUpdateMessage extends OutgoingSecureMediaMessage
groupContext.getEncodedGroupContext(),
avatar,
sentTimeMillis,
ThreadDatabase.DistributionTypes.CONVERSATION,
ThreadTable.DistributionTypes.CONVERSATION,
expiresIn,
viewOnce,
StoryType.NONE,

View File

@@ -1,6 +1,6 @@
package org.thoughtcrime.securesms.mms
import org.thoughtcrime.securesms.database.ThreadDatabase
import org.thoughtcrime.securesms.database.ThreadTable
import org.thoughtcrime.securesms.database.model.StoryType
import org.thoughtcrime.securesms.recipients.Recipient
import java.util.LinkedList
@@ -17,7 +17,7 @@ class OutgoingRequestToActivatePaymentMessages(
"",
LinkedList(),
sentTimeMillis,
ThreadDatabase.DistributionTypes.CONVERSATION,
ThreadTable.DistributionTypes.CONVERSATION,
expiresIn,
false,
StoryType.NONE,
@@ -46,7 +46,7 @@ class OutgoingPaymentsActivatedMessages(
"",
LinkedList(),
sentTimeMillis,
ThreadDatabase.DistributionTypes.CONVERSATION,
ThreadTable.DistributionTypes.CONVERSATION,
expiresIn,
false,
StoryType.NONE,
@@ -72,7 +72,7 @@ class OutgoingPaymentsNotificationMessage(
paymentUuid,
LinkedList(),
sentTimeMillis,
ThreadDatabase.DistributionTypes.CONVERSATION,
ThreadTable.DistributionTypes.CONVERSATION,
expiresIn,
false,
StoryType.NONE,

View File

@@ -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.AttachmentDatabase;
import org.thoughtcrime.securesms.database.AttachmentTable;
import org.thoughtcrime.securesms.database.SignalDatabase;
import org.thoughtcrime.securesms.emoji.EmojiFiles;
import org.thoughtcrime.securesms.providers.BlobProvider;
@@ -153,7 +153,7 @@ public class PartAuthority {
}
}
public static @Nullable AttachmentDatabase.TransformProperties getAttachmentTransformProperties(@NonNull Uri uri) {
public static @Nullable AttachmentTable.TransformProperties getAttachmentTransformProperties(@NonNull Uri uri) {
int match = uriMatcher.match(uri);
switch (match) {
case PART_ROW:

View File

@@ -29,7 +29,7 @@ import org.thoughtcrime.securesms.attachments.Attachment;
import org.thoughtcrime.securesms.attachments.UriAttachment;
import org.thoughtcrime.securesms.audio.AudioHash;
import org.thoughtcrime.securesms.blurhash.BlurHash;
import org.thoughtcrime.securesms.database.AttachmentDatabase;
import org.thoughtcrime.securesms.database.AttachmentTable;
import org.thoughtcrime.securesms.stickers.StickerLocator;
import org.thoughtcrime.securesms.util.MediaUtil;
import org.thoughtcrime.securesms.util.Util;
@@ -133,8 +133,8 @@ public abstract class Slide {
}
public boolean isPendingDownload() {
return getTransferState() == AttachmentDatabase.TRANSFER_PROGRESS_FAILED ||
getTransferState() == AttachmentDatabase.TRANSFER_PROGRESS_PENDING;
return getTransferState() == AttachmentTable.TRANSFER_PROGRESS_FAILED ||
getTransferState() == AttachmentTable.TRANSFER_PROGRESS_PENDING;
}
public int getTransferState() {
@@ -193,13 +193,13 @@ public abstract class Slide {
boolean borderless,
boolean gif,
boolean quote,
@Nullable AttachmentDatabase.TransformProperties transformProperties)
@Nullable AttachmentTable.TransformProperties transformProperties)
{
String resolvedType = Optional.ofNullable(MediaUtil.getMimeType(context, uri)).orElse(defaultMime);
String fastPreflightId = String.valueOf(new SecureRandom().nextLong());
return new UriAttachment(uri,
resolvedType,
AttachmentDatabase.TRANSFER_PROGRESS_STARTED,
AttachmentTable.TRANSFER_PROGRESS_STARTED,
size,
width,
height,

View File

@@ -9,11 +9,10 @@ import android.util.Pair;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.WorkerThread;
import org.signal.core.util.logging.Log;
import org.thoughtcrime.securesms.blurhash.BlurHash;
import org.thoughtcrime.securesms.database.AttachmentDatabase;
import org.thoughtcrime.securesms.database.AttachmentTable;
import org.thoughtcrime.securesms.util.MediaUtil;
import java.io.IOException;
@@ -41,7 +40,7 @@ public final class SlideFactory {
*
* @return A Slide with all the information we can gather about it.
*/
public static @Nullable Slide getSlide(@NonNull Context context, @Nullable String contentType, @NonNull Uri uri, int width, int height, @Nullable AttachmentDatabase.TransformProperties transformProperties) {
public static @Nullable Slide getSlide(@NonNull Context context, @Nullable String contentType, @NonNull Uri uri, int width, int height, @Nullable AttachmentTable.TransformProperties transformProperties) {
MediaType mediaType = MediaType.from(contentType);
try {
@@ -65,7 +64,7 @@ public final class SlideFactory {
@NonNull Uri uri,
int width,
int height,
@Nullable AttachmentDatabase.TransformProperties transformProperties
@Nullable AttachmentTable.TransformProperties transformProperties
) {
long start = System.currentTimeMillis();
@@ -99,7 +98,7 @@ public final class SlideFactory {
@NonNull Uri uri,
int width,
int height,
@Nullable AttachmentDatabase.TransformProperties transformProperties
@Nullable AttachmentTable.TransformProperties transformProperties
) throws IOException
{
long start = System.currentTimeMillis();
@@ -162,7 +161,7 @@ public final class SlideFactory {
int width,
int height,
boolean gif,
@Nullable AttachmentDatabase.TransformProperties transformProperties)
@Nullable AttachmentTable.TransformProperties transformProperties)
{
if (mimeType == null) {
mimeType = "application/octet-stream";

View File

@@ -27,7 +27,7 @@ import androidx.annotation.Nullable;
import org.thoughtcrime.securesms.R;
import org.thoughtcrime.securesms.attachments.Attachment;
import org.thoughtcrime.securesms.database.AttachmentDatabase;
import org.thoughtcrime.securesms.database.AttachmentTable;
import org.thoughtcrime.securesms.giph.mp4.GiphyMp4PlaybackPolicy;
import org.thoughtcrime.securesms.util.MediaUtil;
@@ -37,11 +37,11 @@ public class VideoSlide extends Slide {
this(context, uri, dataSize, gif, null, null);
}
public VideoSlide(Context context, Uri uri, long dataSize, boolean gif, @Nullable String caption, @Nullable AttachmentDatabase.TransformProperties transformProperties) {
public VideoSlide(Context context, Uri uri, long dataSize, boolean gif, @Nullable String caption, @Nullable AttachmentTable.TransformProperties transformProperties) {
super(context, constructAttachmentFromUri(context, uri, MediaUtil.VIDEO_UNSPECIFIED, dataSize, 0, 0, MediaUtil.hasVideoThumbnail(context, uri), null, caption, null, null, null, false, false, gif, false, transformProperties));
}
public VideoSlide(Context context, Uri uri, long dataSize, boolean gif, int width, int height, @Nullable String caption, @Nullable AttachmentDatabase.TransformProperties transformProperties) {
public VideoSlide(Context context, Uri uri, long dataSize, boolean gif, int width, int height, @Nullable String caption, @Nullable AttachmentTable.TransformProperties transformProperties) {
super(context, constructAttachmentFromUri(context, uri, MediaUtil.VIDEO_UNSPECIFIED, dataSize, width, height, MediaUtil.hasVideoThumbnail(context, uri), null, caption, null, null, null, false, false, gif, false, transformProperties));
}