Sync archive status changes after thread updates.
This commit is contained in:
parent
712b0c147a
commit
0478757af4
1 changed files with 11 additions and 4 deletions
|
@ -212,16 +212,23 @@ public class ThreadDatabase extends Database {
|
||||||
contentValues.put(READ_RECEIPT_COUNT, readReceiptCount);
|
contentValues.put(READ_RECEIPT_COUNT, readReceiptCount);
|
||||||
contentValues.put(EXPIRES_IN, expiresIn);
|
contentValues.put(EXPIRES_IN, expiresIn);
|
||||||
|
|
||||||
if (unarchive) {
|
|
||||||
contentValues.put(ARCHIVED, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (count != getConversationMessageCount(threadId)) {
|
if (count != getConversationMessageCount(threadId)) {
|
||||||
contentValues.put(LAST_SCROLLED, 0);
|
contentValues.put(LAST_SCROLLED, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
SQLiteDatabase db = databaseHelper.getWritableDatabase();
|
SQLiteDatabase db = databaseHelper.getWritableDatabase();
|
||||||
db.update(TABLE_NAME, contentValues, ID + " = ?", new String[] {threadId + ""});
|
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();
|
notifyConversationListListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue