diff options
-rw-r--r-- | src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java | 7 | ||||
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/ImportBackupActivity.java | 17 |
2 files changed, 17 insertions, 7 deletions
diff --git a/src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java b/src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java index d3220a875..941ee6a47 100644 --- a/src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java +++ b/src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java @@ -60,7 +60,7 @@ import rocks.xmpp.addr.Jid; public class DatabaseBackend extends SQLiteOpenHelper { public static final String DATABASE_NAME = "history"; - public static final int DATABASE_VERSION = 45; // = Conversations DATABASE_VERSION + 1 + public static final int DATABASE_VERSION = 46; // = Conversations DATABASE_VERSION + 2 private static DatabaseBackend instance = null; private static String CREATE_CONTATCS_STATEMENT = "create table " @@ -136,6 +136,7 @@ public class DatabaseBackend extends SQLiteOpenHelper { + SQLiteAxolotlStore.OWN + " INTEGER, " + SQLiteAxolotlStore.FINGERPRINT + " TEXT, " + SQLiteAxolotlStore.CERTIFICATE + " BLOB, " + + SQLiteAxolotlStore.TRUSTED + " TEXT, " + SQLiteAxolotlStore.TRUST + " TEXT, " + SQLiteAxolotlStore.ACTIVE + " NUMBER, " + SQLiteAxolotlStore.LAST_ACTIVATION + " NUMBER," @@ -552,6 +553,10 @@ public class DatabaseBackend extends SQLiteOpenHelper { db.execSQL(CREATE_MESSAGE_RELATIVE_FILE_PATH_INDEX); db.execSQL(CREATE_MESSAGE_TYPE_INDEX); } + + if (oldVersion < 46 && newVersion >= 46) { + db.execSQL("ALTER TABLE " + SQLiteAxolotlStore.IDENTITIES_TABLENAME + " ADD COLUMN " + SQLiteAxolotlStore.TRUSTED); // TODO - just to make old databases importable, column isn't needed at all + } } private void canonicalizeJids(SQLiteDatabase db) { diff --git a/src/main/java/de/pixart/messenger/ui/ImportBackupActivity.java b/src/main/java/de/pixart/messenger/ui/ImportBackupActivity.java index 4f9386963..f66d8f47c 100644 --- a/src/main/java/de/pixart/messenger/ui/ImportBackupActivity.java +++ b/src/main/java/de/pixart/messenger/ui/ImportBackupActivity.java @@ -116,12 +116,17 @@ public class ImportBackupActivity extends XmppActivity implements ServiceConnect @Override public void onBackupRestored() { - runOnUiThread(() -> { - Intent intent = new Intent(this, StartUI.class); - intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); - startActivity(intent); - finish(); - }); + runOnUiThread(this::restart); + } + + private void restart() { + Log.d(Config.LOGTAG, "Restarting " + getBaseContext().getPackageManager().getLaunchIntentForPackage(getBaseContext().getPackageName())); + Intent intent = getBaseContext().getPackageManager().getLaunchIntentForPackage(getBaseContext().getPackageName()); + intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + startActivity(intent); + overridePendingTransition(R.animator.fade_in, R.animator.fade_out); + System.exit(0); } @Override |