Add a write-through cache to the identity store.

This commit is contained in:
Greyson Parrelli
2021-08-25 13:39:59 -04:00
committed by GitHub
parent 28d86886bd
commit 0a67731830
17 changed files with 208 additions and 103 deletions

View File

@@ -222,12 +222,16 @@ public class IdentityDatabase extends Database {
}
public void setApproval(@NonNull RecipientId recipientId, boolean nonBlockingApproval) {
setApproval(Recipient.resolved(recipientId).requireServiceId(), recipientId, nonBlockingApproval);
}
public void setApproval(@NonNull String addressName, @NonNull RecipientId recipientId, boolean nonBlockingApproval) {
SQLiteDatabase database = databaseHelper.getSignalWritableDatabase();
ContentValues contentValues = new ContentValues(2);
contentValues.put(NONBLOCKING_APPROVAL, nonBlockingApproval);
database.update(TABLE_NAME, contentValues, ADDRESS + " = ?", SqlUtil.buildArgs(Recipient.resolved(recipientId).requireServiceId()));
database.update(TABLE_NAME, contentValues, ADDRESS + " = ?", SqlUtil.buildArgs(addressName));
DatabaseFactory.getRecipientDatabase(context).markNeedsSync(recipientId);
}