Relax GIF size restrictions.

fork-5.53.8
Greyson Parrelli 2021-04-21 16:35:54 -04:00
rodzic b4d0dde129
commit d28f0e3544
1 zmienionych plików z 6 dodań i 2 usunięć

Wyświetl plik

@ -8,9 +8,11 @@ import androidx.annotation.Nullable;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.thoughtcrime.securesms.util.ByteUnit;
public class GiphyImage {
private static final int MAX_SIZE = 1024 * 1024; // 1MB
private static final int MAX_SIZE = (int) ByteUnit.MEGABYTES.toBytes(2);
@JsonProperty
private ImageTypes images;
@ -85,7 +87,7 @@ public class GiphyImage {
}
private @Nullable ImageData getGifData() {
return getLargestGifWithinSizeConstraint(images.fixed_width, images.fixed_height, images.fixed_width_small, images.fixed_height_small);
return getLargestGifWithinSizeConstraint(images.downsized, images.fixed_width, images.fixed_height, images.fixed_width_small, images.fixed_height_small);
}
private @Nullable ImageData getGifMmsData() {
@ -136,6 +138,8 @@ public class GiphyImage {
}
public static class ImageTypes {
@JsonProperty
private ImageData downsized;
@JsonProperty
private ImageData fixed_height;
@JsonProperty