kopia lustrzana https://github.com/ryukoposting/Signal-Android
Fix crash when adding person to an existing mms group.
rodzic
2bfe1198d1
commit
1dca3698d2
|
@ -213,7 +213,7 @@ public class ContactsCursorLoader extends AbstractContactsCursorLoader {
|
||||||
|
|
||||||
private Cursor getGroupsCursor() {
|
private Cursor getGroupsCursor() {
|
||||||
MatrixCursor groupContacts = ContactsCursorRows.createMatrixCursor();
|
MatrixCursor groupContacts = ContactsCursorRows.createMatrixCursor();
|
||||||
try (GroupDatabase.Reader reader = DatabaseFactory.getGroupDatabase(getContext()).getGroupsFilteredByTitle(getFilter(), flagSet(mode, DisplayMode.FLAG_INACTIVE_GROUPS), hideGroupsV1(mode))) {
|
try (GroupDatabase.Reader reader = DatabaseFactory.getGroupDatabase(getContext()).getGroupsFilteredByTitle(getFilter(), flagSet(mode, DisplayMode.FLAG_INACTIVE_GROUPS), hideGroupsV1(mode), !smsEnabled(mode))) {
|
||||||
GroupDatabase.GroupRecord groupRecord;
|
GroupDatabase.GroupRecord groupRecord;
|
||||||
while ((groupRecord = reader.getNext()) != null) {
|
while ((groupRecord = reader.getNext()) != null) {
|
||||||
groupContacts.addRow(ContactsCursorRows.forGroup(groupRecord));
|
groupContacts.addRow(ContactsCursorRows.forGroup(groupRecord));
|
||||||
|
|
|
@ -241,7 +241,7 @@ private static final String[] GROUP_PROJECTION = {
|
||||||
return noMetadata && noMembers;
|
return noMetadata && noMembers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Reader getGroupsFilteredByTitle(String constraint, boolean includeInactive, boolean excludeV1) {
|
public Reader getGroupsFilteredByTitle(String constraint, boolean includeInactive, boolean excludeV1, boolean excludeMms) {
|
||||||
String query;
|
String query;
|
||||||
String[] queryArgs;
|
String[] queryArgs;
|
||||||
|
|
||||||
|
@ -257,6 +257,10 @@ private static final String[] GROUP_PROJECTION = {
|
||||||
query += " AND " + EXPECTED_V2_ID + " IS NULL";
|
query += " AND " + EXPECTED_V2_ID + " IS NULL";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (excludeMms) {
|
||||||
|
query += " AND " + MMS + " = 0";
|
||||||
|
}
|
||||||
|
|
||||||
Cursor cursor = databaseHelper.getReadableDatabase().query(TABLE_NAME, null, query, queryArgs, null, null, TITLE + " COLLATE NOCASE ASC");
|
Cursor cursor = databaseHelper.getReadableDatabase().query(TABLE_NAME, null, query, queryArgs, null, null, TITLE + " COLLATE NOCASE ASC");
|
||||||
|
|
||||||
return new Reader(cursor);
|
return new Reader(cursor);
|
||||||
|
|
|
@ -543,7 +543,8 @@ public class ThreadDatabase extends Database {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hideSms) {
|
if (hideSms) {
|
||||||
query += " AND (" + RecipientDatabase.TABLE_NAME + "." + RecipientDatabase.GROUP_ID + " NOT NULL OR " + RecipientDatabase.TABLE_NAME + "." + RecipientDatabase.REGISTERED + " = " + RecipientDatabase.RegisteredState.REGISTERED.getId() + ")";
|
query += " AND ((" + RecipientDatabase.TABLE_NAME + "." + RecipientDatabase.GROUP_ID + " NOT NULL AND " + RecipientDatabase.TABLE_NAME + "." + RecipientDatabase.GROUP_TYPE + " != " + RecipientDatabase.GroupType.MMS.getId() + ")" +
|
||||||
|
" OR " + RecipientDatabase.TABLE_NAME + "." + RecipientDatabase.REGISTERED + " = " + RecipientDatabase.RegisteredState.REGISTERED.getId() + ")";
|
||||||
query += " AND " + RecipientDatabase.TABLE_NAME + "." + RecipientDatabase.FORCE_SMS_SELECTION + " = 0";
|
query += " AND " + RecipientDatabase.TABLE_NAME + "." + RecipientDatabase.FORCE_SMS_SELECTION + " = 0";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -120,7 +120,7 @@ class CameraContactsRepository {
|
||||||
|
|
||||||
List<Recipient> recipients = new ArrayList<>();
|
List<Recipient> recipients = new ArrayList<>();
|
||||||
|
|
||||||
try (GroupDatabase.Reader reader = groupDatabase.getGroupsFilteredByTitle(query, false, true)) {
|
try (GroupDatabase.Reader reader = groupDatabase.getGroupsFilteredByTitle(query, false, true, true)) {
|
||||||
GroupDatabase.GroupRecord groupRecord;
|
GroupDatabase.GroupRecord groupRecord;
|
||||||
while ((groupRecord = reader.getNext()) != null) {
|
while ((groupRecord = reader.getNext()) != null) {
|
||||||
RecipientId recipientId = recipientDatabase.getOrInsertFromGroupId(groupRecord.getId());
|
RecipientId recipientId = recipientDatabase.getOrInsertFromGroupId(groupRecord.getId());
|
||||||
|
|
|
@ -168,7 +168,7 @@ public class SearchRepository {
|
||||||
}
|
}
|
||||||
|
|
||||||
GroupDatabase.GroupRecord record;
|
GroupDatabase.GroupRecord record;
|
||||||
try (GroupDatabase.Reader reader = DatabaseFactory.getGroupDatabase(context).getGroupsFilteredByTitle(query, true, false)) {
|
try (GroupDatabase.Reader reader = DatabaseFactory.getGroupDatabase(context).getGroupsFilteredByTitle(query, true, false, false)) {
|
||||||
while ((record = reader.getNext()) != null) {
|
while ((record = reader.getNext()) != null) {
|
||||||
recipientIds.add(record.getRecipientId());
|
recipientIds.add(record.getRecipientId());
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue