Add partial share and draft support to CFv2.

This commit is contained in:
Cody Henthorne
2023-05-31 14:12:33 -04:00
parent b9ae537706
commit 693aef5c04
25 changed files with 642 additions and 137 deletions

View File

@@ -57,15 +57,15 @@ public class AudioSlide extends Slide {
}
public AudioSlide(Context context, Uri uri, long dataSize, boolean voiceNote) {
super(context, constructAttachmentFromUri(context, uri, MediaUtil.AUDIO_UNSPECIFIED, dataSize, 0, 0, false, null, null, null, null, null, voiceNote, false, false, false));
super(constructAttachmentFromUri(context, uri, MediaUtil.AUDIO_UNSPECIFIED, dataSize, 0, 0, false, null, null, null, null, null, voiceNote, false, false, false));
}
public AudioSlide(Context context, Uri uri, long dataSize, String contentType, boolean voiceNote) {
super(context, new UriAttachment(uri, contentType, AttachmentTable.TRANSFER_PROGRESS_STARTED, dataSize, 0, 0, null, null, voiceNote, false, false, false, null, null, null, null, null));
super(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) {
super(context, attachment);
super(attachment);
}
@Override
@@ -85,7 +85,7 @@ public class AudioSlide extends Slide {
@NonNull
@Override
public String getContentDescription() {
public String getContentDescription(Context context) {
return context.getString(R.string.Slide_audio);
}

View File

@@ -13,14 +13,14 @@ import org.thoughtcrime.securesms.util.StorageUtil;
public class DocumentSlide extends Slide {
public DocumentSlide(@NonNull Context context, @NonNull Attachment attachment) {
super(context, attachment);
super(attachment);
}
public DocumentSlide(@NonNull Context context, @NonNull Uri uri,
@NonNull String contentType, long size,
@Nullable String fileName)
{
super(context, constructAttachmentFromUri(context, uri, contentType, size, 0, 0, true, StorageUtil.getCleanFileName(fileName), null, null, null, null, false, false, false, false));
super(constructAttachmentFromUri(context, uri, contentType, size, 0, 0, true, StorageUtil.getCleanFileName(fileName), null, null, null, null, false, false, false, false));
}
@Override

View File

@@ -12,8 +12,8 @@ public class GifSlide extends ImageSlide {
private final boolean borderless;
public GifSlide(Context context, Attachment attachment) {
super(context, attachment);
public GifSlide(Attachment attachment) {
super(attachment);
this.borderless = attachment.isBorderless();
}
@@ -22,22 +22,22 @@ public class GifSlide extends ImageSlide {
}
public GifSlide(Context context, Uri uri, long size, int width, int height, boolean borderless, @Nullable String caption) {
super(context, constructAttachmentFromUri(context,
uri,
MediaUtil.IMAGE_GIF,
size,
width,
height,
true,
null,
caption,
null,
null,
null,
false,
borderless,
true,
false));
super(constructAttachmentFromUri(context,
uri,
MediaUtil.IMAGE_GIF,
size,
width,
height,
true,
null,
caption,
null,
null,
null,
false,
borderless,
true,
false));
this.borderless = borderless;
}

View File

@@ -38,8 +38,8 @@ public class ImageSlide extends Slide {
@SuppressWarnings("unused")
private static final String TAG = Log.tag(ImageSlide.class);
public ImageSlide(@NonNull Context context, @NonNull Attachment attachment) {
super(context, attachment);
public ImageSlide(@NonNull Attachment attachment) {
super(attachment);
this.borderless = attachment.isBorderless();
}
@@ -52,7 +52,7 @@ public class ImageSlide extends Slide {
}
public ImageSlide(Context context, Uri uri, String contentType, long size, int width, int height, boolean borderless, @Nullable String caption, @Nullable BlurHash blurHash, @Nullable TransformProperties transformProperties) {
super(context, constructAttachmentFromUri(context, uri, contentType, size, width, height, true, null, caption, null, blurHash, null, false, borderless, false, false, transformProperties));
super(constructAttachmentFromUri(context, uri, contentType, size, width, height, true, null, caption, null, blurHash, null, false, borderless, false, false, transformProperties));
this.borderless = borderless;
}
@@ -78,7 +78,7 @@ public class ImageSlide extends Slide {
@NonNull
@Override
public String getContentDescription() {
public String getContentDescription(Context context) {
return context.getString(R.string.Slide_image);
}
}

View File

@@ -10,12 +10,12 @@ import org.thoughtcrime.securesms.attachments.Attachment;
public class MmsSlide extends ImageSlide {
public MmsSlide(@NonNull Context context, @NonNull Attachment attachment) {
super(context, attachment);
super(attachment);
}
@NonNull
@Override
public String getContentDescription() {
public String getContentDescription(Context context) {
return "MMS";
}

View File

@@ -40,10 +40,8 @@ import java.util.Optional;
public abstract class Slide {
protected final Attachment attachment;
protected final Context context;
public Slide(@NonNull Context context, @NonNull Attachment attachment) {
this.context = context;
public Slide(@NonNull Attachment attachment) {
this.attachment = attachment;
}
@@ -122,7 +120,7 @@ public abstract class Slide {
return hasVideo() && attachment.isVideoGif();
}
public @NonNull String getContentDescription() { return ""; }
public @NonNull String getContentDescription(@NonNull Context context) { return ""; }
public @NonNull Attachment asAttachment() {
return attachment;

View File

@@ -21,13 +21,13 @@ public class StickerSlide extends Slide {
private final StickerLocator stickerLocator;
public StickerSlide(@NonNull Context context, @NonNull Attachment attachment) {
super(context, attachment);
public StickerSlide(@NonNull Attachment attachment) {
super(attachment);
this.stickerLocator = Objects.requireNonNull(attachment.getSticker());
}
public StickerSlide(Context context, Uri uri, long size, @NonNull StickerLocator stickerLocator, @NonNull String contentType) {
super(context, constructAttachmentFromUri(context, uri, contentType, size, WIDTH, HEIGHT, true, null, null, stickerLocator, null, null, false, false, false, false));
super(constructAttachmentFromUri(context, uri, contentType, size, WIDTH, HEIGHT, true, null, null, stickerLocator, null, null, false, false, false, false));
this.stickerLocator = Objects.requireNonNull(attachment.getSticker());
}
@@ -47,7 +47,7 @@ public class StickerSlide extends Slide {
}
@Override
public @NonNull String getContentDescription() {
public @NonNull String getContentDescription(Context context) {
return context.getString(R.string.Slide_sticker);
}

View File

@@ -13,10 +13,10 @@ import org.thoughtcrime.securesms.util.MediaUtil;
public class TextSlide extends Slide {
public TextSlide(@NonNull Context context, @NonNull Attachment attachment) {
super(context, attachment);
super(attachment);
}
public TextSlide(@NonNull Context context, @NonNull Uri uri, @Nullable String filename, long size) {
super(context, constructAttachmentFromUri(context, uri, MediaUtil.LONG_TEXT, size, 0, 0, true, filename, null, null, null, null, false, false, false, false));
super(constructAttachmentFromUri(context, uri, MediaUtil.LONG_TEXT, size, 0, 0, true, filename, null, null, null, null, false, false, false, false));
}
}

View File

@@ -38,15 +38,15 @@ public class VideoSlide extends Slide {
}
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));
super(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 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));
super(constructAttachmentFromUri(context, uri, MediaUtil.VIDEO_UNSPECIFIED, dataSize, width, height, MediaUtil.hasVideoThumbnail(context, uri), null, caption, null, null, null, false, false, gif, false, transformProperties));
}
public VideoSlide(Context context, Attachment attachment) {
super(context, attachment);
super(attachment);
}
@Override
@@ -75,7 +75,7 @@ public class VideoSlide extends Slide {
}
@NonNull @Override
public String getContentDescription() {
public String getContentDescription(Context context) {
return context.getString(R.string.Slide_video);
}
}

View File

@@ -16,7 +16,7 @@ import org.thoughtcrime.securesms.util.MediaUtil;
public class ViewOnceSlide extends Slide {
public ViewOnceSlide(@NonNull Context context, @NonNull Attachment attachment) {
super(context, attachment);
super(attachment);
}
@Override