mirror of
https://github.com/oxen-io/session-android.git
synced 2025-10-21 14:58:45 +00:00
Clearing the snode and onion request dbs on launch
This commit is contained in:
@@ -214,6 +214,17 @@ public class ApplicationContext extends Application implements DefaultLifecycleO
|
||||
DatabaseModule.init(this);
|
||||
MessagingModuleConfiguration.configure(this);
|
||||
super.onCreate();
|
||||
|
||||
// we need to clear the snode and onionrequest databases once on first launch
|
||||
// in order to apply a patch that adds a version number to the Snode objects.
|
||||
if(!TextSecurePreferences.hasAppliedPatchSnodeVersion(this)) {
|
||||
ThreadUtils.queue(() -> {
|
||||
lokiAPIDatabase.clearSnodePool();
|
||||
lokiAPIDatabase.clearOnionRequestPaths();
|
||||
TextSecurePreferences.setHasAppliedPatchSnodeVersion(this, true);
|
||||
});
|
||||
}
|
||||
|
||||
messagingModuleConfiguration = new MessagingModuleConfiguration(
|
||||
this,
|
||||
storage,
|
||||
|
@@ -255,6 +255,11 @@ class LokiAPIDatabase(context: Context, helper: SQLCipherOpenHelper) : Database(
|
||||
return result
|
||||
}
|
||||
|
||||
override fun clearSnodePool() {
|
||||
val database = databaseHelper.writableDatabase
|
||||
database.delete(snodePoolTable, null, null)
|
||||
}
|
||||
|
||||
override fun clearOnionRequestPaths() {
|
||||
val database = databaseHelper.writableDatabase
|
||||
fun delete(indexPath: String) {
|
||||
|
Reference in New Issue
Block a user