mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-25 19:29:54 +01:00
Improve local encrypted PIN storage.
This commit is contained in:
@@ -39,7 +39,7 @@ public class ApplicationMigrations {
|
||||
|
||||
private static final int LEGACY_CANONICAL_VERSION = 455;
|
||||
|
||||
public static final int CURRENT_VERSION = 14;
|
||||
public static final int CURRENT_VERSION = 15;
|
||||
|
||||
private static final class Version {
|
||||
static final int LEGACY = 1;
|
||||
@@ -56,6 +56,7 @@ public class ApplicationMigrations {
|
||||
static final int STORAGE_KEY_ROTATE = 12;
|
||||
static final int REMOVE_AVATAR_ID = 13;
|
||||
static final int STORAGE_CAPABILITY = 14;
|
||||
static final int PIN_REMINDER = 15;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -226,6 +227,10 @@ public class ApplicationMigrations {
|
||||
jobs.put(Version.STORAGE_CAPABILITY, new StorageCapabilityMigrationJob());
|
||||
}
|
||||
|
||||
if (lastSeenVersion < Version.PIN_REMINDER) {
|
||||
jobs.put(Version.PIN_REMINDER, new PinReminderMigrationJob());
|
||||
}
|
||||
|
||||
return jobs;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
package org.thoughtcrime.securesms.migrations;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import org.thoughtcrime.securesms.jobmanager.Data;
|
||||
import org.thoughtcrime.securesms.jobmanager.Job;
|
||||
import org.thoughtcrime.securesms.keyvalue.SignalStore;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class PinReminderMigrationJob extends MigrationJob {
|
||||
|
||||
public static final String KEY = "PinReminderMigrationJob";
|
||||
|
||||
PinReminderMigrationJob() {
|
||||
this(new Job.Parameters.Builder().build());
|
||||
}
|
||||
|
||||
private PinReminderMigrationJob(@NonNull Parameters parameters) {
|
||||
super(parameters);
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean isUiBlocking() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull String getFactoryKey() {
|
||||
return KEY;
|
||||
}
|
||||
|
||||
@Override
|
||||
void performMigration() {
|
||||
SignalStore.pinValues().setNextReminderIntervalToAtMost(TimeUnit.DAYS.toMillis(3));
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean shouldRetry(@NonNull Exception e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static class Factory implements Job.Factory<PinReminderMigrationJob> {
|
||||
|
||||
@Override
|
||||
public @NonNull PinReminderMigrationJob create(@NonNull Parameters parameters, @NonNull Data data) {
|
||||
return new PinReminderMigrationJob(parameters);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user