Skip to content

Commit

Permalink
Sync archive status changes after thread updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
greyson-signal committed Jul 27, 2021
1 parent 712b0c1 commit 0478757
Showing 1 changed file with 11 additions and 4 deletions.
Expand Up @@ -212,16 +212,23 @@ private void updateThread(long threadId, long count, String body, @Nullable Uri
contentValues.put(READ_RECEIPT_COUNT, readReceiptCount);
contentValues.put(EXPIRES_IN, expiresIn);

if (unarchive) {
contentValues.put(ARCHIVED, 0);
}

if (count != getConversationMessageCount(threadId)) {
contentValues.put(LAST_SCROLLED, 0);
}

SQLiteDatabase db = databaseHelper.getWritableDatabase();
db.update(TABLE_NAME, contentValues, ID + " = ?", new String[] {threadId + ""});

if (unarchive) {
ContentValues archiveValues = new ContentValues();
archiveValues.put(ARCHIVED, 0);

SqlUtil.Query query = SqlUtil.buildTrueUpdateQuery(ID_WHERE, SqlUtil.buildArgs(threadId), archiveValues);
if (db.update(TABLE_NAME, archiveValues, query.getWhere(), query.getWhereArgs()) > 0) {
StorageSyncHelper.scheduleSyncForDataChange();
}
}

notifyConversationListListeners();
}

Expand Down

0 comments on commit 0478757

Please sign in to comment.