Skip to content

Commit 0fe9df3

Browse files
greyson-signalcody-signal
authored andcommitted
Properly clear unknown ids from storage service.
1 parent cb126a2 commit 0fe9df3

3 files changed

Lines changed: 17 additions & 1 deletion

File tree

app/src/main/java/org/thoughtcrime/securesms/database/UnknownStorageIdTable.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,19 @@ public List<StorageId> getAllWithTypes(List<Integer> types) {
8282
return ids;
8383
}
8484

85+
public void deleteAllWithTypes(List<Integer> types) {
86+
SQLiteDatabase db = getWritableDatabase();
87+
db.beginTransaction();
88+
try {
89+
for (int type : types) {
90+
db.delete(TABLE_NAME, TYPE + " = ?", SqlUtil.buildArgs(type));
91+
}
92+
db.setTransactionSuccessful();
93+
} finally {
94+
db.endTransaction();
95+
}
96+
}
97+
8598
public @Nullable SignalStorageRecord getById(@NonNull byte[] rawId) {
8699
String query = STORAGE_ID + " = ?";
87100
String[] args = new String[] { Base64.encodeWithPadding(rawId) };

app/src/main/java/org/thoughtcrime/securesms/jobs/StorageSyncJob.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ private boolean performSync() throws IOException, RetryLaterException, InvalidKe
386386
db.beginTransaction();
387387
try {
388388
processKnownRecords(context, records);
389-
SignalDatabase.unknownStorageIds().getAllWithTypes(knownTypes);
389+
SignalDatabase.unknownStorageIds().deleteAllWithTypes(knownTypes);
390390
db.setTransactionSuccessful();
391391
} finally {
392392
db.endTransaction();

app/src/spinner/java/org/thoughtcrime/securesms/StorageServicePlugin.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ class StorageServicePlugin : Plugin {
3737
} else if (record.storyDistributionList.isPresent) {
3838
row += "Distribution List"
3939
row += record.storyDistributionList.get().toProto().toString()
40+
} else if (record.callLink.isPresent) {
41+
row += "Call Link"
42+
row += record.callLink.get().toProto().toString()
4043
} else {
4144
row += "Unknown"
4245
row += ""

0 commit comments

Comments
 (0)