mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-22 01:40:07 +01:00
Add support for GV1->GV2 forced migration.
This commit is contained in:
@@ -220,7 +220,7 @@ public final class GroupDatabase extends Database {
|
||||
return noMetadata && noMembers;
|
||||
}
|
||||
|
||||
public Reader getGroupsFilteredByTitle(String constraint, boolean includeInactive) {
|
||||
public Reader getGroupsFilteredByTitle(String constraint, boolean includeInactive, boolean excludeV1) {
|
||||
String query;
|
||||
String[] queryArgs;
|
||||
|
||||
@@ -232,6 +232,10 @@ public final class GroupDatabase extends Database {
|
||||
queryArgs = new String[]{"%" + constraint + "%", "1"};
|
||||
}
|
||||
|
||||
if (excludeV1) {
|
||||
query += " AND " + EXPECTED_V2_ID + " IS NULL";
|
||||
}
|
||||
|
||||
Cursor cursor = databaseHelper.getReadableDatabase().query(TABLE_NAME, null, query, queryArgs, null, null, TITLE + " COLLATE NOCASE ASC");
|
||||
|
||||
return new Reader(cursor);
|
||||
|
||||
@@ -93,7 +93,7 @@ public class RecipientDatabase extends Database {
|
||||
public static final String PHONE = "phone";
|
||||
public static final String EMAIL = "email";
|
||||
static final String GROUP_ID = "group_id";
|
||||
private static final String GROUP_TYPE = "group_type";
|
||||
static final String GROUP_TYPE = "group_type";
|
||||
private static final String BLOCKED = "blocked";
|
||||
private static final String MESSAGE_RINGTONE = "message_ringtone";
|
||||
private static final String MESSAGE_VIBRATE = "message_vibrate";
|
||||
|
||||
@@ -545,11 +545,11 @@ public class ThreadDatabase extends Database {
|
||||
return cursor;
|
||||
}
|
||||
|
||||
public Cursor getRecentConversationList(int limit, boolean includeInactiveGroups) {
|
||||
return getRecentConversationList(limit, includeInactiveGroups, false);
|
||||
public Cursor getRecentConversationList(int limit, boolean includeInactiveGroups, boolean hideV1Groups) {
|
||||
return getRecentConversationList(limit, includeInactiveGroups, false, hideV1Groups);
|
||||
}
|
||||
|
||||
public Cursor getRecentConversationList(int limit, boolean includeInactiveGroups, boolean groupsOnly) {
|
||||
public Cursor getRecentConversationList(int limit, boolean includeInactiveGroups, boolean groupsOnly, boolean hideV1Groups) {
|
||||
SQLiteDatabase db = databaseHelper.getReadableDatabase();
|
||||
String query = !includeInactiveGroups ? MESSAGE_COUNT + " != 0 AND (" + GroupDatabase.TABLE_NAME + "." + GroupDatabase.ACTIVE + " IS NULL OR " + GroupDatabase.TABLE_NAME + "." + GroupDatabase.ACTIVE + " = 1)"
|
||||
: MESSAGE_COUNT + " != 0";
|
||||
@@ -558,6 +558,10 @@ public class ThreadDatabase extends Database {
|
||||
query += " AND " + RecipientDatabase.TABLE_NAME + "." + RecipientDatabase.GROUP_ID + " NOT NULL";
|
||||
}
|
||||
|
||||
if (hideV1Groups) {
|
||||
query += " AND " + RecipientDatabase.TABLE_NAME + "." + RecipientDatabase.GROUP_TYPE + " != " + RecipientDatabase.GroupType.SIGNAL_V1.getId();
|
||||
}
|
||||
|
||||
return db.rawQuery(createQuery(query, 0, limit, true), null);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user