mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-09-28 00:45:23 +08:00
Properly clear unknown ids from storage service.
This commit is contained in:

committed by
Cody Henthorne

parent
cb126a2f08
commit
0fe9df3023
@ -82,6 +82,19 @@ public class UnknownStorageIdTable extends DatabaseTable {
|
|||||||
return ids;
|
return ids;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void deleteAllWithTypes(List<Integer> types) {
|
||||||
|
SQLiteDatabase db = getWritableDatabase();
|
||||||
|
db.beginTransaction();
|
||||||
|
try {
|
||||||
|
for (int type : types) {
|
||||||
|
db.delete(TABLE_NAME, TYPE + " = ?", SqlUtil.buildArgs(type));
|
||||||
|
}
|
||||||
|
db.setTransactionSuccessful();
|
||||||
|
} finally {
|
||||||
|
db.endTransaction();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public @Nullable SignalStorageRecord getById(@NonNull byte[] rawId) {
|
public @Nullable SignalStorageRecord getById(@NonNull byte[] rawId) {
|
||||||
String query = STORAGE_ID + " = ?";
|
String query = STORAGE_ID + " = ?";
|
||||||
String[] args = new String[] { Base64.encodeWithPadding(rawId) };
|
String[] args = new String[] { Base64.encodeWithPadding(rawId) };
|
||||||
|
@ -386,7 +386,7 @@ public class StorageSyncJob extends BaseJob {
|
|||||||
db.beginTransaction();
|
db.beginTransaction();
|
||||||
try {
|
try {
|
||||||
processKnownRecords(context, records);
|
processKnownRecords(context, records);
|
||||||
SignalDatabase.unknownStorageIds().getAllWithTypes(knownTypes);
|
SignalDatabase.unknownStorageIds().deleteAllWithTypes(knownTypes);
|
||||||
db.setTransactionSuccessful();
|
db.setTransactionSuccessful();
|
||||||
} finally {
|
} finally {
|
||||||
db.endTransaction();
|
db.endTransaction();
|
||||||
|
@ -37,6 +37,9 @@ class StorageServicePlugin : Plugin {
|
|||||||
} else if (record.storyDistributionList.isPresent) {
|
} else if (record.storyDistributionList.isPresent) {
|
||||||
row += "Distribution List"
|
row += "Distribution List"
|
||||||
row += record.storyDistributionList.get().toProto().toString()
|
row += record.storyDistributionList.get().toProto().toString()
|
||||||
|
} else if (record.callLink.isPresent) {
|
||||||
|
row += "Call Link"
|
||||||
|
row += record.callLink.get().toProto().toString()
|
||||||
} else {
|
} else {
|
||||||
row += "Unknown"
|
row += "Unknown"
|
||||||
row += ""
|
row += ""
|
||||||
|
Reference in New Issue
Block a user