mirror of
https://github.com/oxen-io/session-android.git
synced 2025-10-25 22:38:49 +00:00
Clearing the snode and onion request dbs on launch
This commit is contained in:
@@ -50,6 +50,8 @@ object OnionRequestAPI {
|
||||
get() {
|
||||
val paths = _paths.get()
|
||||
|
||||
Log.d("", "***** Getting ONION from database: ${paths?.count()}")
|
||||
|
||||
if (paths != null) { return paths }
|
||||
|
||||
// Storing this in an atomic variable as it was causing a number of background
|
||||
|
||||
@@ -153,6 +153,8 @@ object SnodeAPI {
|
||||
internal fun getRandomSnode(): Promise<Snode, Exception> {
|
||||
val snodePool = this.snodePool
|
||||
|
||||
Log.d("", "***** Getting snode pool from database: ${snodePool.count()}")
|
||||
|
||||
if (snodePool.count() < minimumSnodePoolCount) {
|
||||
val target = seedNodePool.random()
|
||||
val url = "$target/json_rpc"
|
||||
|
||||
@@ -292,6 +292,8 @@ interface TextSecurePreferences {
|
||||
|
||||
const val ALLOW_MESSAGE_REQUESTS = "libsession.ALLOW_MESSAGE_REQUESTS"
|
||||
|
||||
const val PATCH_SNODE_VERSION_2024_07_23 = "libsession.patch_snode_version_2024_07_23"
|
||||
|
||||
@JvmStatic
|
||||
fun getLastConfigurationSyncTime(context: Context): Long {
|
||||
return getLongPreference(context, LAST_CONFIGURATION_SYNC_TIME, 0)
|
||||
@@ -1013,6 +1015,16 @@ interface TextSecurePreferences {
|
||||
fun clearAll(context: Context) {
|
||||
getDefaultSharedPreferences(context).edit().clear().commit()
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun hasAppliedPatchSnodeVersion(context: Context): Boolean {
|
||||
return getBooleanPreference(context, PATCH_SNODE_VERSION_2024_07_23, false)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun setHasAppliedPatchSnodeVersion(context: Context, applied: Boolean) {
|
||||
setBooleanPreference(context, PATCH_SNODE_VERSION_2024_07_23, applied)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user