mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-20 16:49:40 +01:00
Fix ApplicationMigrations UI.
This commit is contained in:
@@ -227,8 +227,6 @@ public class DatabaseFactory {
|
||||
}
|
||||
|
||||
private DatabaseFactory(@NonNull Context context) {
|
||||
SQLiteDatabase.loadLibs(context);
|
||||
|
||||
DatabaseSecret databaseSecret = DatabaseSecretProvider.getOrCreateDatabaseSecret(context);
|
||||
AttachmentSecret attachmentSecret = AttachmentSecretProvider.getInstance(context).getOrCreateAttachmentSecret();
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.annimon.stream.Stream;
|
||||
import net.sqlcipher.database.SQLiteOpenHelper;
|
||||
import net.sqlcipher.database.SQLiteDatabase;
|
||||
|
||||
import org.signal.core.util.concurrent.SignalExecutors;
|
||||
import org.signal.core.util.logging.Log;
|
||||
import org.thoughtcrime.securesms.crypto.DatabaseSecret;
|
||||
import org.thoughtcrime.securesms.crypto.DatabaseSecretProvider;
|
||||
@@ -140,9 +141,11 @@ public class JobDatabase extends SQLiteOpenHelper implements SignalDatabase {
|
||||
public void onOpen(SQLiteDatabase db) {
|
||||
Log.i(TAG, "onOpen()");
|
||||
|
||||
dropTableIfPresent("job_spec");
|
||||
dropTableIfPresent("constraint_spec");
|
||||
dropTableIfPresent("dependency_spec");
|
||||
SignalExecutors.BOUNDED.execute(() -> {
|
||||
dropTableIfPresent("job_spec");
|
||||
dropTableIfPresent("constraint_spec");
|
||||
dropTableIfPresent("dependency_spec");
|
||||
});
|
||||
}
|
||||
|
||||
public synchronized void insertJobs(@NonNull List<FullSpec> fullSpecs) {
|
||||
|
||||
@@ -10,6 +10,7 @@ import net.sqlcipher.database.SQLiteDatabase;
|
||||
import net.sqlcipher.database.SQLiteDatabaseHook;
|
||||
import net.sqlcipher.database.SQLiteOpenHelper;
|
||||
|
||||
import org.signal.core.util.concurrent.SignalExecutors;
|
||||
import org.signal.core.util.logging.Log;
|
||||
import org.thoughtcrime.securesms.crypto.DatabaseSecret;
|
||||
import org.thoughtcrime.securesms.crypto.DatabaseSecretProvider;
|
||||
@@ -88,10 +89,12 @@ public class KeyValueDatabase extends SQLiteOpenHelper implements SignalDatabase
|
||||
public void onOpen(SQLiteDatabase db) {
|
||||
Log.i(TAG, "onOpen()");
|
||||
|
||||
if (DatabaseFactory.getInstance(application).hasTable("key_value")) {
|
||||
Log.i(TAG, "Dropping original key_value table from the main database.");
|
||||
DatabaseFactory.getInstance(application).getRawDatabase().rawExecSQL("DROP TABLE key_value");
|
||||
}
|
||||
SignalExecutors.BOUNDED.execute(() -> {
|
||||
if (DatabaseFactory.getInstance(application).hasTable("key_value")) {
|
||||
Log.i(TAG, "Dropping original key_value table from the main database.");
|
||||
DatabaseFactory.getInstance(application).getRawDatabase().rawExecSQL("DROP TABLE key_value");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public @NonNull KeyValueDataSet getDataSet() {
|
||||
|
||||
@@ -9,6 +9,7 @@ import androidx.annotation.NonNull;
|
||||
import net.sqlcipher.database.SQLiteDatabase;
|
||||
import net.sqlcipher.database.SQLiteOpenHelper;
|
||||
|
||||
import org.signal.core.util.concurrent.SignalExecutors;
|
||||
import org.signal.core.util.logging.Log;
|
||||
import org.thoughtcrime.securesms.crypto.DatabaseSecret;
|
||||
import org.thoughtcrime.securesms.crypto.DatabaseSecretProvider;
|
||||
@@ -91,10 +92,12 @@ public class MegaphoneDatabase extends SQLiteOpenHelper implements SignalDatabas
|
||||
public void onOpen(SQLiteDatabase db) {
|
||||
Log.i(TAG, "onOpen()");
|
||||
|
||||
if (DatabaseFactory.getInstance(application).hasTable("megaphone")) {
|
||||
Log.i(TAG, "Dropping original megaphone table from the main database.");
|
||||
DatabaseFactory.getInstance(application).getRawDatabase().rawExecSQL("DROP TABLE megaphone");
|
||||
}
|
||||
SignalExecutors.BOUNDED.execute(() -> {
|
||||
if (DatabaseFactory.getInstance(application).hasTable("megaphone")) {
|
||||
Log.i(TAG, "Dropping original megaphone table from the main database.");
|
||||
DatabaseFactory.getInstance(application).getRawDatabase().rawExecSQL("DROP TABLE megaphone");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void insert(@NonNull Collection<Event> events) {
|
||||
|
||||
Reference in New Issue
Block a user