mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-24 19:00:26 +01:00
Add the ability to migrate to new KBS enclaves.
This commit is contained in:
committed by
Alan Evans
parent
e22384b6b4
commit
474963dcf1
@@ -0,0 +1,53 @@
|
||||
package org.thoughtcrime.securesms.migrations;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies;
|
||||
import org.thoughtcrime.securesms.jobmanager.Data;
|
||||
import org.thoughtcrime.securesms.jobmanager.Job;
|
||||
import org.thoughtcrime.securesms.jobs.KbsEnclaveMigrationWorkerJob;
|
||||
|
||||
/**
|
||||
* A job to be run whenever we add a new KBS enclave. In order to prevent this moderately-expensive
|
||||
* task from blocking the network for too long, this task simply enqueues another non-migration job,
|
||||
* {@link KbsEnclaveMigrationWorkerJob}, to do the heavy lifting.
|
||||
*/
|
||||
public class KbsEnclaveMigrationJob extends MigrationJob {
|
||||
|
||||
public static final String KEY = "KbsEnclaveMigrationJob";
|
||||
|
||||
KbsEnclaveMigrationJob() {
|
||||
this(new Parameters.Builder().build());
|
||||
}
|
||||
|
||||
private KbsEnclaveMigrationJob(@NonNull Parameters parameters) {
|
||||
super(parameters);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUiBlocking() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull String getFactoryKey() {
|
||||
return KEY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void performMigration() {
|
||||
ApplicationDependencies.getJobManager().add(new KbsEnclaveMigrationWorkerJob());
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean shouldRetry(@NonNull Exception e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static class Factory implements Job.Factory<KbsEnclaveMigrationJob> {
|
||||
@Override
|
||||
public @NonNull KbsEnclaveMigrationJob create(@NonNull Parameters parameters, @NonNull Data data) {
|
||||
return new KbsEnclaveMigrationJob(parameters);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user