Fix open group polling from seqno instead of last hash (#939)

* fix: reset seqno to get recent messages from open groups

* build: upgrade build numbers

* fix: actually run the migration
pull/941/head 1.14.1
Harris 2 years ago committed by GitHub
parent 7dcb566a57
commit c65feba683
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -159,8 +159,8 @@ dependencies {
testImplementation 'org.robolectric:shadows-multidex:4.4'
}
def canonicalVersionCode = 292
def canonicalVersionName = "1.14.0"
def canonicalVersionCode = 293
def canonicalVersionName = "1.14.1"
def postFixSize = 10
def abiPostFix = ['armeabi-v7a' : 1,

@ -59,9 +59,9 @@ class LokiAPIDatabase(context: Context, helper: SQLCipherOpenHelper) : Database(
private val token = "token"
@JvmStatic val createOpenGroupAuthTokenTableCommand = "CREATE TABLE $openGroupAuthTokenTable ($server TEXT PRIMARY KEY, $token TEXT);"
// Last message server IDs
private val lastMessageServerIDTable = "loki_api_last_message_server_id_cache"
private const val lastMessageServerIDTable = "loki_api_last_message_server_id_cache"
private val lastMessageServerIDTableIndex = "loki_api_last_message_server_id_cache_index"
private val lastMessageServerID = "last_message_server_id"
private const val lastMessageServerID = "last_message_server_id"
@JvmStatic val createLastMessageServerIDTableCommand = "CREATE TABLE $lastMessageServerIDTable ($lastMessageServerIDTableIndex STRING PRIMARY KEY, $lastMessageServerID INTEGER DEFAULT 0);"
// Last deletion server IDs
private val lastDeletionServerIDTable = "loki_api_last_deletion_server_id_cache"
@ -153,6 +153,9 @@ class LokiAPIDatabase(context: Context, helper: SQLCipherOpenHelper) : Database(
"$requestSignature STRING NULLABLE DEFAULT NULL, $authorizationSignature STRING NULLABLE DEFAULT NULL, PRIMARY KEY ($masterPublicKey, $slavePublicKey));"
private val sessionRequestTimestampCache = "session_request_timestamp_cache"
@JvmStatic val createSessionRequestTimestampCacheCommand = "CREATE TABLE $sessionRequestTimestampCache ($publicKey STRING PRIMARY KEY, $timestamp STRING);"
const val RESET_SEQ_NO = "UPDATE $lastMessageServerIDTable SET $lastMessageServerID = 0;"
// endregion
}

@ -70,9 +70,10 @@ public class SQLCipherOpenHelper extends SQLiteOpenHelper {
private static final int lokiV33 = 54;
private static final int lokiV34 = 55;
private static final int lokiV35 = 56;
private static final int lokiV36 = 57;
// Loki - onUpgrade(...) must be updated to use Loki version numbers if Signal makes any database changes
private static final int DATABASE_VERSION = lokiV35;
private static final int DATABASE_VERSION = lokiV36;
private static final String DATABASE_NAME = "signal.db";
private final Context context;
@ -169,6 +170,7 @@ public class SQLCipherOpenHelper extends SQLiteOpenHelper {
db.execSQL(LokiAPIDatabase.DROP_LEGACY_RECEIVED_HASHES);
db.execSQL(BlindedIdMappingDatabase.CREATE_BLINDED_ID_MAPPING_TABLE_COMMAND);
db.execSQL(GroupMemberDatabase.CREATE_GROUP_MEMBER_TABLE_COMMAND);
db.execSQL(LokiAPIDatabase.RESET_SEQ_NO); // probably not needed but consistent with all migrations
executeStatements(db, SmsDatabase.CREATE_INDEXS);
executeStatements(db, MmsDatabase.CREATE_INDEXS);
@ -385,6 +387,10 @@ public class SQLCipherOpenHelper extends SQLiteOpenHelper {
db.execSQL(GroupMemberDatabase.CREATE_GROUP_MEMBER_TABLE_COMMAND);
}
if (oldVersion < lokiV36) {
db.execSQL(LokiAPIDatabase.RESET_SEQ_NO);
}
db.setTransactionSuccessful();
} finally {
db.endTransaction();

Loading…
Cancel
Save