diff --git a/app/src/main/java/org/thoughtcrime/securesms/jobs/JobManagerFactories.java b/app/src/main/java/org/thoughtcrime/securesms/jobs/JobManagerFactories.java index 6a4b6c09bf..c11bcc354e 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/jobs/JobManagerFactories.java +++ b/app/src/main/java/org/thoughtcrime/securesms/jobs/JobManagerFactories.java @@ -39,6 +39,7 @@ import org.thoughtcrime.securesms.migrations.AvatarMigrationJob; import org.thoughtcrime.securesms.migrations.BackupNotificationMigrationJob; import org.thoughtcrime.securesms.migrations.BlobStorageLocationMigrationJob; import org.thoughtcrime.securesms.migrations.CachedAttachmentsMigrationJob; +import org.thoughtcrime.securesms.migrations.ClearGlideCacheMigrationJob; import org.thoughtcrime.securesms.migrations.DatabaseMigrationJob; import org.thoughtcrime.securesms.migrations.DeleteDeprecatedLogsMigrationJob; import org.thoughtcrime.securesms.migrations.DirectoryRefreshMigrationJob; @@ -209,6 +210,7 @@ public final class JobManagerFactories { put(BackupNotificationMigrationJob.KEY, new BackupNotificationMigrationJob.Factory()); put(BlobStorageLocationMigrationJob.KEY, new BlobStorageLocationMigrationJob.Factory()); put(CachedAttachmentsMigrationJob.KEY, new CachedAttachmentsMigrationJob.Factory()); + put(ClearGlideCacheMigrationJob.KEY, new ClearGlideCacheMigrationJob.Factory()); put(DatabaseMigrationJob.KEY, new DatabaseMigrationJob.Factory()); put(DeleteDeprecatedLogsMigrationJob.KEY, new DeleteDeprecatedLogsMigrationJob.Factory()); put(DirectoryRefreshMigrationJob.KEY, new DirectoryRefreshMigrationJob.Factory()); diff --git a/app/src/main/java/org/thoughtcrime/securesms/migrations/ApplicationMigrations.java b/app/src/main/java/org/thoughtcrime/securesms/migrations/ApplicationMigrations.java index 593144449d..d15205ebff 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/migrations/ApplicationMigrations.java +++ b/app/src/main/java/org/thoughtcrime/securesms/migrations/ApplicationMigrations.java @@ -118,9 +118,10 @@ public class ApplicationMigrations { static final int OPTIMIZE_MESSAGE_FTS_INDEX = 74; static final int REACTION_DATABASE_MIGRATION = 75; static final int REBUILD_MESSAGE_FTS_INDEX_2 = 76; + static final int GLIDE_CACHE_CLEAR = 77; } - public static final int CURRENT_VERSION = 76; + public static final int CURRENT_VERSION = 77; /** * This *must* be called after the {@link JobManager} has been instantiated, but *before* the call @@ -526,6 +527,10 @@ public class ApplicationMigrations { jobs.put(Version.REBUILD_MESSAGE_FTS_INDEX_2, new RebuildMessageSearchIndexMigrationJob()); } + if (lastSeenVersion < Version.GLIDE_CACHE_CLEAR) { + jobs.put(Version.GLIDE_CACHE_CLEAR, new ClearGlideCacheMigrationJob()); + } + return jobs; } diff --git a/app/src/main/java/org/thoughtcrime/securesms/migrations/ClearGlideCacheMigrationJob.kt b/app/src/main/java/org/thoughtcrime/securesms/migrations/ClearGlideCacheMigrationJob.kt new file mode 100644 index 0000000000..a16c73c721 --- /dev/null +++ b/app/src/main/java/org/thoughtcrime/securesms/migrations/ClearGlideCacheMigrationJob.kt @@ -0,0 +1,35 @@ +package org.thoughtcrime.securesms.migrations + +import com.bumptech.glide.Glide +import org.signal.core.util.logging.Log +import org.thoughtcrime.securesms.jobmanager.Data +import org.thoughtcrime.securesms.jobmanager.Job + +/** + * Clears the Glide disk cache. + */ +internal class ClearGlideCacheMigrationJob( + parameters: Parameters = Parameters.Builder().build() +) : MigrationJob(parameters) { + + companion object { + val TAG = Log.tag(ClearGlideCacheMigrationJob::class.java) + const val KEY = "ClearGlideCacheMigrationJog" + } + + override fun getFactoryKey(): String = KEY + + override fun isUiBlocking(): Boolean = false + + override fun performMigration() { + Glide.get(context).clearDiskCache() + } + + override fun shouldRetry(e: Exception): Boolean = false + + class Factory : Job.Factory { + override fun create(parameters: Parameters, data: Data): ClearGlideCacheMigrationJob { + return ClearGlideCacheMigrationJob(parameters) + } + } +} diff --git a/dependencies.gradle b/dependencies.gradle index d4bc048d72..57aa989330 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -10,7 +10,7 @@ dependencyResolutionManagement { version('androidx-navigation', '2.5.2') version('androidx-window', '1.0.0') version('exoplayer', '2.18.1') - version('glide', '4.14.2') + version('glide', '4.13.2') version('kotlin', '1.6.21') version('libsignal-client', '0.21.1') version('mp4parser', '1.9.39') diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml index 29a068806f..39f9167727 100644 --- a/gradle/verification-metadata.xml +++ b/gradle/verification-metadata.xml @@ -1593,35 +1593,29 @@ https://docs.gradle.org/current/userguide/dependency_verification.html - - - - - - + + + - - - - - - + + + - - - + + + - - - + + + - - - + + +