mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-25 19:29:54 +01:00
Add support for backing up wallpapers.
This commit is contained in:
@@ -66,9 +66,11 @@ class BackupRestoreMediaJob private constructor(parameters: Parameters) : BaseJo
|
||||
val messageMap = SignalDatabase.messages.getMessages(messageIds).associate { it.id to (it as MmsMessageRecord) }
|
||||
|
||||
for (attachment in attachmentBatch) {
|
||||
val isWallpaper = attachment.mmsId == AttachmentTable.WALLPAPER_MESSAGE_ID
|
||||
|
||||
val message = messageMap[attachment.mmsId]
|
||||
if (message == null) {
|
||||
Log.w(TAG, "Unable to find message for ${attachment.attachmentId}")
|
||||
if (message == null && !isWallpaper) {
|
||||
Log.w(TAG, "Unable to find message for ${attachment.attachmentId}, mmsId: ${attachment.mmsId}")
|
||||
notRestorable += attachment
|
||||
continue
|
||||
}
|
||||
@@ -79,7 +81,7 @@ class BackupRestoreMediaJob private constructor(parameters: Parameters) : BaseJo
|
||||
highPriority = false
|
||||
)
|
||||
|
||||
if (shouldRestoreFullSize(message, restoreTime, SignalStore.backup.optimizeStorage)) {
|
||||
if (isWallpaper || shouldRestoreFullSize(message!!, restoreTime, SignalStore.backup.optimizeStorage)) {
|
||||
restoreFullAttachmentJobs += attachment to RestoreAttachmentJob(
|
||||
messageId = attachment.mmsId,
|
||||
attachmentId = attachment.attachmentId
|
||||
|
||||
@@ -94,6 +94,7 @@ import org.thoughtcrime.securesms.migrations.TrimByLengthSettingsMigrationJob;
|
||||
import org.thoughtcrime.securesms.migrations.UpdateSmsJobsMigrationJob;
|
||||
import org.thoughtcrime.securesms.migrations.UserNotificationMigrationJob;
|
||||
import org.thoughtcrime.securesms.migrations.UuidMigrationJob;
|
||||
import org.thoughtcrime.securesms.migrations.WallpaperStorageMigrationJob;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
@@ -309,6 +310,7 @@ public final class JobManagerFactories {
|
||||
put(UpdateSmsJobsMigrationJob.KEY, new UpdateSmsJobsMigrationJob.Factory());
|
||||
put(UserNotificationMigrationJob.KEY, new UserNotificationMigrationJob.Factory());
|
||||
put(UuidMigrationJob.KEY, new UuidMigrationJob.Factory());
|
||||
put(WallpaperStorageMigrationJob.KEY, new WallpaperStorageMigrationJob.Factory());
|
||||
|
||||
// Dead jobs
|
||||
put(FailingJob.KEY, new FailingJob.Factory());
|
||||
|
||||
Reference in New Issue
Block a user