Skip to content
This repository was archived by the owner on Oct 24, 2025. It is now read-only.

Commit 8de1102

Browse files
committed
fix: notify when entry is null
1 parent b8385c3 commit 8de1102

File tree

9 files changed

+934
-920
lines changed

9 files changed

+934
-920
lines changed

AsyncStorageSQLiteKMP/SQLiteStorageKMP.xcframework/Info.plist

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,34 +10,34 @@
1010
<key>DebugSymbolsPath</key>
1111
<string>dSYMs</string>
1212
<key>LibraryIdentifier</key>
13-
<string>ios-arm64_x86_64-simulator</string>
13+
<string>ios-arm64</string>
1414
<key>LibraryPath</key>
1515
<string>SQLiteStorageKMP.framework</string>
1616
<key>SupportedArchitectures</key>
1717
<array>
1818
<string>arm64</string>
19-
<string>x86_64</string>
2019
</array>
2120
<key>SupportedPlatform</key>
2221
<string>ios</string>
23-
<key>SupportedPlatformVariant</key>
24-
<string>simulator</string>
2522
</dict>
2623
<dict>
2724
<key>BinaryPath</key>
2825
<string>SQLiteStorageKMP.framework/SQLiteStorageKMP</string>
2926
<key>DebugSymbolsPath</key>
3027
<string>dSYMs</string>
3128
<key>LibraryIdentifier</key>
32-
<string>ios-arm64</string>
29+
<string>ios-arm64_x86_64-simulator</string>
3330
<key>LibraryPath</key>
3431
<string>SQLiteStorageKMP.framework</string>
3532
<key>SupportedArchitectures</key>
3633
<array>
3734
<string>arm64</string>
35+
<string>x86_64</string>
3836
</array>
3937
<key>SupportedPlatform</key>
4038
<string>ios</string>
39+
<key>SupportedPlatformVariant</key>
40+
<string>simulator</string>
4141
</dict>
4242
</array>
4343
<key>CFBundlePackageType</key>

AsyncStorageSQLiteKMP/SQLiteStorageKMP.xcframework/ios-arm64/dSYMs/SQLiteStorageKMP.framework.dSYM/Contents/Resources/Relocations/aarch64/SQLiteStorageKMP.yml

Lines changed: 919 additions & 915 deletions
Large diffs are not rendered by default.

sqlite-storage/src/commonMain/kotlin/org/asyncstorage/sqlitestorage/DefaultSQLiteStorage.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ internal class DefaultSQLiteStorage(
3838
return queries.getMany(keys, ::Entry)
3939
.asFlow()
4040
.mapToList(dispatcher)
41+
.map { current ->
42+
keys.map { key ->
43+
current.find { it.key == key } ?: Entry(key, null)
44+
}
45+
}
4146
}
4247

4348
override suspend fun write(entry: Entry) =

sqlite-storage/src/commonMain/kotlin/org/asyncstorage/sqlitestorage/SQLiteStorage.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ interface SQLiteStorage {
3939

4040
/**
4141
* Equivalent to [readMany] function, but returns a Flow of List of entries instead.
42+
* If at least one entry in the [keys] list changes, all of them are being retrieved and returned.
4243
* Throws if DB connection is closed.
4344
*/
4445
@Throws(Throwable::class)

sqlite-storage/src/commonTest/kotlin/org/asyncstorage/sqlitestorage/SQLiteStorageTest.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,10 @@ class SQLiteStorageTest {
155155
// bring back to original value
156156
db.write(Entry("1", "value1"))
157157
assertEquals(entries, awaitItem(), "entries not matching expected original value")
158+
159+
// should report all requested entries, even if some were removed
160+
db.remove("1")
161+
assertEquals(listOf(Entry("1", null), Entry("2", "value2")), awaitItem())
158162
}
159163
}
160164

0 commit comments

Comments
 (0)