use of net.sqlcipher.database.SQLiteDatabase in project Signal-Android by signalapp.
the class GroupReceiptDatabase method deleteAllRows.
void deleteAllRows() {
SQLiteDatabase db = databaseHelper.getWritableDatabase();
db.delete(TABLE_NAME, null, null);
}
use of net.sqlcipher.database.SQLiteDatabase in project Signal-Android by signalapp.
the class GroupReceiptDatabase method insert.
public void insert(List<Address> addresses, long mmsId, int status, long timestamp) {
SQLiteDatabase db = databaseHelper.getWritableDatabase();
for (Address address : addresses) {
ContentValues values = new ContentValues(4);
values.put(MMS_ID, mmsId);
values.put(ADDRESS, address.serialize());
values.put(STATUS, status);
values.put(TIMESTAMP, timestamp);
db.insert(TABLE_NAME, null, values);
}
}
use of net.sqlcipher.database.SQLiteDatabase in project Signal-Android by signalapp.
the class GroupReceiptDatabase method deleteRowsForMessage.
void deleteRowsForMessage(long mmsId) {
SQLiteDatabase db = databaseHelper.getWritableDatabase();
db.delete(TABLE_NAME, MMS_ID + " = ?", new String[] { String.valueOf(mmsId) });
}
use of net.sqlcipher.database.SQLiteDatabase in project Signal-Android by signalapp.
the class IdentityDatabase method saveIdentity.
public void saveIdentity(Address address, IdentityKey identityKey, VerifiedStatus verifiedStatus, boolean firstUse, long timestamp, boolean nonBlockingApproval) {
SQLiteDatabase database = databaseHelper.getWritableDatabase();
String identityKeyString = Base64.encodeBytes(identityKey.serialize());
ContentValues contentValues = new ContentValues();
contentValues.put(ADDRESS, address.serialize());
contentValues.put(IDENTITY_KEY, identityKeyString);
contentValues.put(TIMESTAMP, timestamp);
contentValues.put(VERIFIED, verifiedStatus.toInt());
contentValues.put(NONBLOCKING_APPROVAL, nonBlockingApproval ? 1 : 0);
contentValues.put(FIRST_USE, firstUse ? 1 : 0);
database.replace(TABLE_NAME, null, contentValues);
EventBus.getDefault().post(new IdentityRecord(address, identityKey, verifiedStatus, firstUse, timestamp, nonBlockingApproval));
}
use of net.sqlcipher.database.SQLiteDatabase in project Signal-Android by signalapp.
the class IdentityDatabase method setVerified.
public void setVerified(Address address, IdentityKey identityKey, VerifiedStatus verifiedStatus) {
SQLiteDatabase database = databaseHelper.getWritableDatabase();
ContentValues contentValues = new ContentValues(1);
contentValues.put(VERIFIED, verifiedStatus.toInt());
int updated = database.update(TABLE_NAME, contentValues, ADDRESS + " = ? AND " + IDENTITY_KEY + " = ?", new String[] { address.serialize(), Base64.encodeBytes(identityKey.serialize()) });
if (updated > 0) {
Optional<IdentityRecord> record = getIdentity(address);
if (record.isPresent())
EventBus.getDefault().post(record.get());
}
}
Aggregations