Support additional sticker states

Co-authored-by: scott@signal.org
Co-authored-by: ken@signal.org
This commit is contained in:
Ken Powers 2019-05-23 18:27:42 -07:00 committed by Scott Nonnenberg
parent 41880cfe66
commit be5d0837f8
35 changed files with 925 additions and 249 deletions

View file

@ -129,6 +129,7 @@ function initializeMigrations({
const {
getPath,
getStickersPath,
getTempPath,
createReader,
createAbsolutePathGetter,
createWriterForNew,
@ -161,6 +162,12 @@ function initializeMigrations({
const deleteSticker = Attachments.createDeleter(stickersPath);
const readStickerData = createReader(stickersPath);
const tempPath = getTempPath(userDataPath);
const getAbsoluteTempPath = createAbsolutePathGetter(tempPath);
const writeNewTempData = createWriterForNew(tempPath);
const deleteTempFile = Attachments.createDeleter(tempPath);
const readTempData = createReader(tempPath);
return {
attachmentsPath,
copyIntoAttachmentsDirectory,
@ -170,6 +177,7 @@ function initializeMigrations({
deleteOnDisk,
}),
deleteSticker,
deleteTempFile,
getAbsoluteAttachmentPath,
getAbsoluteStickerPath,
getPlaceholderMigrations,
@ -181,6 +189,7 @@ function initializeMigrations({
loadStickerData,
readAttachmentData,
readStickerData,
readTempData,
run,
processNewAttachment: attachment =>
MessageType.processNewAttachment(attachment, {
@ -200,6 +209,13 @@ function initializeMigrations({
getImageDimensions,
logger,
}),
processNewEphemeralSticker: stickerData =>
MessageType.processNewSticker(stickerData, {
writeNewStickerData: writeNewTempData,
getAbsoluteStickerPath: getAbsoluteTempPath,
getImageDimensions,
logger,
}),
upgradeMessageSchema: (message, options = {}) => {
const { maxVersion } = options;