Fix bad flag parsing on attachment pointers.

This commit is contained in:
Alex Hart
2021-04-22 14:46:20 -03:00
committed by GitHub
parent a4868602b5
commit bf124b87fa
8 changed files with 86 additions and 11 deletions

View File

@@ -689,7 +689,7 @@ public class ConversationActivity extends PassphraseRequiredActivity
Objects.requireNonNull(MediaType.from(BlobProvider.getMimeType(data.getData()))),
data.getIntExtra(GiphyActivity.EXTRA_WIDTH, 0),
data.getIntExtra(GiphyActivity.EXTRA_HEIGHT, 0),
data.getBooleanExtra(GiphyActivity.EXTRA_BORDERLESS, false),
false,
true);
break;
case SMS_DEFAULT:

View File

@@ -164,7 +164,7 @@ public class AttachmentDatabase extends Database {
FAST_PREFLIGHT_ID + " TEXT, " +
VOICE_NOTE + " INTEGER DEFAULT 0, " +
BORDERLESS + " INTEGER DEFAULT 0, " +
VIDEO_GIF + " INTEGER DEFAULT 0, " +
VIDEO_GIF + " INTEGER DEFAULT 0, " +
DATA_RANDOM + " BLOB, " +
QUOTE + " INTEGER DEFAULT 0, " +
WIDTH + " INTEGER DEFAULT 0, " +

View File

@@ -29,7 +29,6 @@ public class GiphyActivity extends PassphraseRequiredActivity implements GiphyAc
public static final String EXTRA_WIDTH = "extra_width";
public static final String EXTRA_HEIGHT = "extra_height";
public static final String EXTRA_COLOR = "extra_color";
public static final String EXTRA_BORDERLESS = "extra_borderless";
private final DynamicTheme dynamicTheme = new DynamicDarkToolbarTheme();
private final DynamicLanguage dynamicLanguage = new DynamicLanguage();
@@ -97,7 +96,6 @@ public class GiphyActivity extends PassphraseRequiredActivity implements GiphyAc
intent.setData(success.getBlobUri());
intent.putExtra(EXTRA_WIDTH, success.getWidth());
intent.putExtra(EXTRA_HEIGHT, success.getHeight());
intent.putExtra(EXTRA_BORDERLESS, success.getBlobUri());
setResult(RESULT_OK, intent);
finish();

View File

@@ -6,6 +6,7 @@ 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 {
@@ -22,7 +23,23 @@ 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(context, constructAttachmentFromUri(context,
uri,
MediaUtil.IMAGE_GIF,
size,
width,
height,
true,
null,
caption,
null,
null,
null,
false,
borderless,
FeatureFlags.mp4GifSendSupport(),
false));
this.borderless = borderless;
}