Perfom a migration to notify users of new contacts.

This commit is contained in:
Greyson Parrelli
2021-01-11 22:33:11 -05:00
parent f012a41345
commit 141cab1105
6 changed files with 165 additions and 8 deletions

View File

@@ -1196,6 +1196,21 @@ public class ThreadDatabase extends Database {
return Objects.requireNonNull(getThreadRecord(getThreadIdFor(recipient)));
}
public @NonNull Set<RecipientId> getAllThreadRecipients() {
SQLiteDatabase db = databaseHelper.getReadableDatabase();
Set<RecipientId> ids = new HashSet<>();
try (Cursor cursor = db.query(TABLE_NAME, new String[] { RECIPIENT_ID }, null, null, null, null, null)) {
while (cursor.moveToNext()) {
ids.add(RecipientId.from(CursorUtil.requireString(cursor, RECIPIENT_ID)));
}
}
return ids;
}
@NonNull MergeResult merge(@NonNull RecipientId primaryRecipientId, @NonNull RecipientId secondaryRecipientId) {
if (!databaseHelper.getWritableDatabase().inTransaction()) {
throw new IllegalStateException("Must be in a transaction!");