mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-23 02:10:44 +01:00
Perform decryptions inline.
This commit is contained in:
committed by
Alex Hart
parent
e222f96310
commit
1b2cb2637f
@@ -122,9 +122,10 @@ public class ApplicationMigrations {
|
||||
static final int GLIDE_CACHE_CLEAR = 77;
|
||||
static final int SYSTEM_NAME_RESYNC = 78;
|
||||
static final int RECOVERY_PASSWORD_SYNC = 79;
|
||||
static final int DECRYPTIONS_DRAINED = 80;
|
||||
}
|
||||
|
||||
public static final int CURRENT_VERSION = 79;
|
||||
public static final int CURRENT_VERSION = 80;
|
||||
|
||||
/**
|
||||
* This *must* be called after the {@link JobManager} has been instantiated, but *before* the call
|
||||
@@ -542,6 +543,10 @@ public class ApplicationMigrations {
|
||||
jobs.put(Version.RECOVERY_PASSWORD_SYNC, new AttributesMigrationJob());
|
||||
}
|
||||
|
||||
if (lastSeenVersion < Version.DECRYPTIONS_DRAINED) {
|
||||
jobs.put(Version.DECRYPTIONS_DRAINED, new DecryptionsDrainedMigrationJob());
|
||||
}
|
||||
|
||||
return jobs;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package org.thoughtcrime.securesms.migrations
|
||||
|
||||
import org.signal.core.util.logging.Log
|
||||
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies
|
||||
import org.thoughtcrime.securesms.jobmanager.Data
|
||||
import org.thoughtcrime.securesms.jobmanager.Job
|
||||
import org.thoughtcrime.securesms.jobs.PushDecryptDrainedJob
|
||||
|
||||
/**
|
||||
* Kicks off a job to notify the [org.thoughtcrime.securesms.messages.IncomingMessageObserver] when the decryption queue is empty.
|
||||
*/
|
||||
internal class DecryptionsDrainedMigrationJob(
|
||||
parameters: Parameters = Parameters.Builder().build()
|
||||
) : MigrationJob(parameters) {
|
||||
|
||||
companion object {
|
||||
val TAG = Log.tag(DecryptionsDrainedMigrationJob::class.java)
|
||||
const val KEY = "DecryptionsDrainedMigrationJob"
|
||||
}
|
||||
|
||||
override fun getFactoryKey(): String = KEY
|
||||
|
||||
override fun isUiBlocking(): Boolean = false
|
||||
|
||||
override fun performMigration() {
|
||||
ApplicationDependencies.getJobManager().add(PushDecryptDrainedJob())
|
||||
}
|
||||
|
||||
override fun shouldRetry(e: Exception): Boolean = false
|
||||
|
||||
class Factory : Job.Factory<DecryptionsDrainedMigrationJob> {
|
||||
override fun create(parameters: Parameters, data: Data): DecryptionsDrainedMigrationJob {
|
||||
return DecryptionsDrainedMigrationJob(parameters)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user