mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-23 10:20:25 +01:00
committed by
Nicholas Tinsley
parent
eceed641bf
commit
670b6c4c56
@@ -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