diff --git a/cache/src/commonMain/kotlin/org/mobilenativefoundation/store/cache5/StoreMultiCache.kt b/cache/src/commonMain/kotlin/org/mobilenativefoundation/store/cache5/StoreMultiCache.kt index b334d8ec4..baa7db834 100644 --- a/cache/src/commonMain/kotlin/org/mobilenativefoundation/store/cache5/StoreMultiCache.kt +++ b/cache/src/commonMain/kotlin/org/mobilenativefoundation/store/cache5/StoreMultiCache.kt @@ -109,7 +109,7 @@ class StoreMultiCache, Single : StoreData.Single, Single : StoreData.Single> { - fun from(key: StoreKey.Collection, value: Single): StoreKey.Single - fun from(key: StoreKey.Single, value: Single): StoreKey.Collection + fun fromCollection(key: StoreKey.Collection, value: Single): StoreKey.Single + fun fromSingle(key: StoreKey.Single, value: Single): StoreKey.Collection } \ No newline at end of file diff --git a/paging/src/commonTest/kotlin/org/mobilenativefoundation/store/paging5/util/PostStoreFactory.kt b/paging/src/commonTest/kotlin/org/mobilenativefoundation/store/paging5/util/PostStoreFactory.kt index d8ed2dbeb..f6d201a56 100644 --- a/paging/src/commonTest/kotlin/org/mobilenativefoundation/store/paging5/util/PostStoreFactory.kt +++ b/paging/src/commonTest/kotlin/org/mobilenativefoundation/store/paging5/util/PostStoreFactory.kt @@ -4,10 +4,17 @@ package org.mobilenativefoundation.store.paging5.util import kotlinx.coroutines.flow.flow import org.mobilenativefoundation.store.cache5.Cache -import org.mobilenativefoundation.store.core5.KeyProvider import org.mobilenativefoundation.store.cache5.StoreMultiCache +import org.mobilenativefoundation.store.core5.KeyProvider import org.mobilenativefoundation.store.core5.StoreKey -import org.mobilenativefoundation.store.store5.* +import org.mobilenativefoundation.store.store5.Converter +import org.mobilenativefoundation.store.store5.ExperimentalStoreApi +import org.mobilenativefoundation.store.store5.Fetcher +import org.mobilenativefoundation.store.store5.MutableStore +import org.mobilenativefoundation.store.store5.SourceOfTruth +import org.mobilenativefoundation.store.store5.StoreBuilder +import org.mobilenativefoundation.store.store5.Updater +import org.mobilenativefoundation.store.store5.UpdaterResult import kotlin.math.floor class PostStoreFactory(private val api: PostApi, private val db: PostDatabase) { @@ -102,11 +109,14 @@ class PostStoreFactory(private val api: PostApi, private val db: PostDatabase) { private fun createPagingCacheKeyProvider(): KeyProvider = object : KeyProvider { - override fun from(key: StoreKey.Collection, value: PostData.Post): StoreKey.Single { + override fun fromCollection( + key: StoreKey.Collection, + value: PostData.Post + ): StoreKey.Single { return PostKey.Single(value.postId) } - override fun from(key: StoreKey.Single, value: PostData.Post): StoreKey.Collection { + override fun fromSingle(key: StoreKey.Single, value: PostData.Post): StoreKey.Collection { val id = value.postId.toInt() val cursor = (floor(id.toDouble() / 10) * 10) + 1 return PostKey.Cursor(cursor.toInt().toString(), 10)