That fuck shit the fascists are using
at master 51 lines 1.3 kB view raw
1package org.tm.archive.migrations; 2 3import androidx.annotation.NonNull; 4import androidx.annotation.Nullable; 5 6import org.tm.archive.database.SignalDatabase; 7import org.tm.archive.jobmanager.Job; 8 9/** 10 * Triggers a database access, forcing the database to upgrade if it hasn't already. Should be used 11 * when you expect a database migration to take a particularly long time. 12 */ 13public class DatabaseMigrationJob extends MigrationJob { 14 15 public static final String KEY = "DatabaseMigrationJob"; 16 17 DatabaseMigrationJob() { 18 this(new Parameters.Builder().build()); 19 } 20 21 private DatabaseMigrationJob(@NonNull Parameters parameters) { 22 super(parameters); 23 } 24 25 @Override 26 public boolean isUiBlocking() { 27 return true; 28 } 29 30 @Override 31 public @NonNull String getFactoryKey() { 32 return KEY; 33 } 34 35 @Override 36 public void performMigration() { 37 SignalDatabase.triggerDatabaseAccess(); 38 } 39 40 @Override 41 boolean shouldRetry(@NonNull Exception e) { 42 return false; 43 } 44 45 public static class Factory implements Job.Factory<DatabaseMigrationJob> { 46 @Override 47 public @NonNull DatabaseMigrationJob create(@NonNull Parameters parameters, @Nullable byte[] serializedData) { 48 return new DatabaseMigrationJob(parameters); 49 } 50 } 51}