mirror of
https://github.com/oxen-io/session-android.git
synced 2025-08-12 16:07:56 +00:00
Fix various bugs
This commit is contained in:
@@ -55,6 +55,7 @@ public class SQLCipherOpenHelper extends SQLiteOpenHelper {
|
||||
private static final int lokiV21 = 42;
|
||||
private static final int lokiV22 = 43;
|
||||
private static final int lokiV23 = 44;
|
||||
private static final int lokiV24 = 45;
|
||||
|
||||
// Loki - onUpgrade(...) must be updated to use Loki version numbers if Signal makes any database changes
|
||||
private static final int DATABASE_VERSION = lokiV23;
|
||||
@@ -281,6 +282,15 @@ public class SQLCipherOpenHelper extends SQLiteOpenHelper {
|
||||
db.execSQL(LokiMessageDatabase.getUpdateMessageMappingTable());
|
||||
}
|
||||
|
||||
if (oldVersion < lokiV24) {
|
||||
String swarmTable = LokiAPIDatabase.Companion.getSwarmTable();
|
||||
String snodePoolTable = LokiAPIDatabase.Companion.getSnodePoolTable();
|
||||
db.execSQL("DROP TABLE " + swarmTable);
|
||||
db.execSQL("DROP TABLE " + snodePoolTable);
|
||||
db.execSQL(LokiAPIDatabase.getCreateSnodePoolTableCommand());
|
||||
db.execSQL(LokiAPIDatabase.getCreateSwarmTableCommand());
|
||||
}
|
||||
|
||||
db.setTransactionSuccessful();
|
||||
} finally {
|
||||
db.endTransaction();
|
||||
|
@@ -27,7 +27,7 @@ class LokiAPIDatabase(context: Context, helper: SQLCipherOpenHelper) : Database(
|
||||
private val timestamp = "timestamp"
|
||||
private val snode = "snode"
|
||||
// Snode pool
|
||||
private val snodePoolTable = "loki_snode_pool_cache"
|
||||
public val snodePoolTable = "loki_snode_pool_cache"
|
||||
private val dummyKey = "dummy_key"
|
||||
private val snodePool = "snode_pool_key"
|
||||
@JvmStatic val createSnodePoolTableCommand = "CREATE TABLE $snodePoolTable ($dummyKey TEXT PRIMARY KEY, $snodePool TEXT);"
|
||||
@@ -36,7 +36,7 @@ class LokiAPIDatabase(context: Context, helper: SQLCipherOpenHelper) : Database(
|
||||
private val indexPath = "index_path"
|
||||
@JvmStatic val createOnionRequestPathTableCommand = "CREATE TABLE $onionRequestPathTable ($indexPath TEXT PRIMARY KEY, $snode TEXT);"
|
||||
// Swarms
|
||||
private val swarmTable = "loki_api_swarm_cache"
|
||||
public val swarmTable = "loki_api_swarm_cache"
|
||||
private val swarmPublicKey = "hex_encoded_public_key"
|
||||
private val swarm = "swarm"
|
||||
@JvmStatic val createSwarmTableCommand = "CREATE TABLE $swarmTable ($swarmPublicKey TEXT PRIMARY KEY, $swarm TEXT);"
|
||||
|
@@ -17,7 +17,7 @@ object MultiDeviceProtocol {
|
||||
val userPublicKey = TextSecurePreferences.getLocalNumber(context) ?: return
|
||||
val lastSyncTime = TextSecurePreferences.getLastConfigurationSyncTime(context)
|
||||
val now = System.currentTimeMillis()
|
||||
if (now - lastSyncTime < 2 * 24 * 60 * 60 * 1000) return
|
||||
if (now - lastSyncTime < 7 * 24 * 60 * 60 * 1000) return
|
||||
val contacts = ContactUtilities.getAllContacts(context).filter { recipient ->
|
||||
!recipient.isBlocked && !recipient.name.isNullOrEmpty() && !recipient.isLocalNumber && recipient.address.serialize().isNotEmpty()
|
||||
}.map { recipient ->
|
||||
|
Reference in New Issue
Block a user