From 5516dd595c0ec577bec5e927ae5ff4099bcaafd4 Mon Sep 17 00:00:00 2001 From: Matt Ramotar Date: Fri, 31 Mar 2023 14:26:13 -0400 Subject: [PATCH] Clean up Signed-off-by: Matt Ramotar --- .../store/store5/impl/RealStoreBuilder.kt | 36 ++++++------------- 1 file changed, 11 insertions(+), 25 deletions(-) diff --git a/store/src/commonMain/kotlin/org/mobilenativefoundation/store/store5/impl/RealStoreBuilder.kt b/store/src/commonMain/kotlin/org/mobilenativefoundation/store/store5/impl/RealStoreBuilder.kt index b07b5ff01..e4dae7da3 100644 --- a/store/src/commonMain/kotlin/org/mobilenativefoundation/store/store5/impl/RealStoreBuilder.kt +++ b/store/src/commonMain/kotlin/org/mobilenativefoundation/store/store5/impl/RealStoreBuilder.kt @@ -65,36 +65,22 @@ internal class RealStoreBuilder toMutableStoreBuilder(): MutableStoreBuilder { - val storeBuilder = this fetcher as Fetcher return if (sourceOfTruth == null) { - mutableStoreBuilderFromFetcher(fetcher).apply { - if (storeBuilder.scope != null) { - scope(storeBuilder.scope!!) - } - - if (storeBuilder.cachePolicy != null) { - cachePolicy(storeBuilder.cachePolicy) - } - - if (storeBuilder.validator != null) { - validator(storeBuilder.validator!!) - } - } + mutableStoreBuilderFromFetcher(fetcher) } else { - sourceOfTruth as SourceOfTruth - mutableStoreBuilderFromFetcherAndSourceOfTruth(fetcher, sourceOfTruth).apply { - if (storeBuilder.scope != null) { - scope(storeBuilder.scope!!) - } + mutableStoreBuilderFromFetcherAndSourceOfTruth(fetcher, sourceOfTruth as SourceOfTruth) + }.apply { + if (this@RealStoreBuilder.scope != null) { + scope(this@RealStoreBuilder.scope!!) + } - if (storeBuilder.cachePolicy != null) { - cachePolicy(storeBuilder.cachePolicy) - } + if (this@RealStoreBuilder.cachePolicy != null) { + cachePolicy(this@RealStoreBuilder.cachePolicy) + } - if (storeBuilder.validator != null) { - validator(storeBuilder.validator!!) - } + if (this@RealStoreBuilder.validator != null) { + validator(this@RealStoreBuilder.validator!!) } } }