Skip to content

Commit e5f7405

Browse files
committed
remove string conversion for address
1 parent 8227a04 commit e5f7405

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

app/src/main/java/org/session/libsession/avatars/AvatarCacheCleaner.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class AvatarCacheCleaner @Inject constructor(
3131
* Deletes avatar files under cache/remote_files that are no longer referenced
3232
* in the current config. Returns number of files deleted.
3333
*/
34-
suspend fun cleanUpAvatars(): Int = withContext(Dispatchers.IO) {
34+
private suspend fun cleanUpAvatars(): Int = withContext(Dispatchers.IO) {
3535
// 1) Build the set of still-wanted Avatars from:
3636
// -> Config
3737

app/src/main/java/org/thoughtcrime/securesms/database/RecipientSettingsDatabase.kt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ class RecipientSettingsDatabase @Inject constructor(
177177

178178
fun getAllRecipientAddresses(): Set<Address> {
179179
return readableDatabase.rawQuery(
180-
"SELECT $COL_ADDRESS FROM $TABLE_NAME", emptyArray()
180+
"SELECT $COL_ADDRESS FROM $TABLE_NAME"
181181
).use { cursor ->
182182
buildSet {
183183
while (cursor.moveToNext()) {
@@ -195,12 +195,9 @@ class RecipientSettingsDatabase @Inject constructor(
195195
fun cleanupRecipientSettings(addressesToKeep: Set<Address>): Int {
196196
if (addressesToKeep.isEmpty()) return 0
197197

198-
// Build a temporary lookup of strings
199-
val keepSet = addressesToKeep.mapTo(hashSetOf()) { it.toString() }
200-
201198
// Collect all rows, figure out orphans in memory
202199
val allRecipientAddresses = getAllRecipientAddresses()
203-
val orphans = allRecipientAddresses.filter { it.toString() !in keepSet }
200+
val orphans = allRecipientAddresses.filter { it !in addressesToKeep }
204201

205202
if (orphans.isEmpty()) return 0
206203

@@ -216,7 +213,6 @@ class RecipientSettingsDatabase @Inject constructor(
216213
)
217214
if (rows > 0) {
218215
cache.remove(address)
219-
mutableChangeNotification.tryEmit(address)
220216
deleted += rows
221217
}
222218
}

0 commit comments

Comments
 (0)