Default to WEBP for sticker contentTypes.
parent
45915bed90
commit
41b10630bb
|
@ -148,8 +148,9 @@ public class SQLCipherOpenHelper extends SQLiteOpenHelper {
|
||||||
private static final int STICKER_CONTENT_TYPE = 72;
|
private static final int STICKER_CONTENT_TYPE = 72;
|
||||||
private static final int STICKER_EMOJI_IN_NOTIFICATIONS = 73;
|
private static final int STICKER_EMOJI_IN_NOTIFICATIONS = 73;
|
||||||
private static final int THUMBNAIL_CLEANUP = 74;
|
private static final int THUMBNAIL_CLEANUP = 74;
|
||||||
|
private static final int STICKER_CONTENT_TYPE_CLEANUP = 75;
|
||||||
|
|
||||||
private static final int DATABASE_VERSION = 74;
|
private static final int DATABASE_VERSION = 75;
|
||||||
private static final String DATABASE_NAME = "signal.db";
|
private static final String DATABASE_NAME = "signal.db";
|
||||||
|
|
||||||
private final Context context;
|
private final Context context;
|
||||||
|
@ -1049,6 +1050,16 @@ public class SQLCipherOpenHelper extends SQLiteOpenHelper {
|
||||||
Log.w(TAG, "Deleted " + deleted + "/" + total + " thumbnail files.");
|
Log.w(TAG, "Deleted " + deleted + "/" + total + " thumbnail files.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (oldVersion < STICKER_CONTENT_TYPE_CLEANUP) {
|
||||||
|
ContentValues values = new ContentValues();
|
||||||
|
values.put("ct", "image/webp");
|
||||||
|
|
||||||
|
String query = "sticker_id NOT NULL AND (ct IS NULL OR ct = '')";
|
||||||
|
|
||||||
|
int rows = db.update("part", values, query, null);
|
||||||
|
Log.i(TAG, "Updated " + rows + " sticker attachment content types.");
|
||||||
|
}
|
||||||
|
|
||||||
db.setTransactionSuccessful();
|
db.setTransactionSuccessful();
|
||||||
} finally {
|
} finally {
|
||||||
db.endTransaction();
|
db.endTransaction();
|
||||||
|
|
|
@ -7,6 +7,7 @@ import androidx.annotation.Nullable;
|
||||||
|
|
||||||
import org.thoughtcrime.securesms.mms.PartAuthority;
|
import org.thoughtcrime.securesms.mms.PartAuthority;
|
||||||
import org.thoughtcrime.securesms.util.MediaUtil;
|
import org.thoughtcrime.securesms.util.MediaUtil;
|
||||||
|
import org.thoughtcrime.securesms.util.Util;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
@ -68,7 +69,7 @@ public final class StickerRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
public @NonNull String getContentType() {
|
public @NonNull String getContentType() {
|
||||||
return contentType == null ? MediaUtil.IMAGE_WEBP : contentType;
|
return Util.isEmpty(contentType) ? MediaUtil.IMAGE_WEBP : contentType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getSize() {
|
public long getSize() {
|
||||||
|
|
|
@ -153,8 +153,8 @@ public final class AttachmentCompressionJob extends BaseJob {
|
||||||
if (MediaUtil.isJpeg(attachment)) {
|
if (MediaUtil.isJpeg(attachment)) {
|
||||||
MediaStream stripped = getResizedMedia(context, attachment, constraints);
|
MediaStream stripped = getResizedMedia(context, attachment, constraints);
|
||||||
attachmentDatabase.updateAttachmentData(attachment, stripped, false);
|
attachmentDatabase.updateAttachmentData(attachment, stripped, false);
|
||||||
attachmentDatabase.markAttachmentAsTransformed(attachmentId);
|
|
||||||
}
|
}
|
||||||
|
attachmentDatabase.markAttachmentAsTransformed(attachmentId);
|
||||||
} else if (constraints.canResize(attachment)) {
|
} else if (constraints.canResize(attachment)) {
|
||||||
MediaStream resized = getResizedMedia(context, attachment, constraints);
|
MediaStream resized = getResizedMedia(context, attachment, constraints);
|
||||||
attachmentDatabase.updateAttachmentData(attachment, resized, false);
|
attachmentDatabase.updateAttachmentData(attachment, resized, false);
|
||||||
|
|
Loading…
Reference in New Issue