mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-02-25 12:17:22 +00:00
committed by
Nicholas Tinsley
parent
eceed641bf
commit
670b6c4c56
@@ -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());
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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<ClearGlideCacheMigrationJob> {
|
||||
override fun create(parameters: Parameters, data: Data): ClearGlideCacheMigrationJob {
|
||||
return ClearGlideCacheMigrationJob(parameters)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user