From a42df4ee133c3255044d78fe1b1481a558704033 Mon Sep 17 00:00:00 2001 From: BoD Date: Mon, 7 Jul 2025 11:00:31 +0200 Subject: [PATCH] Remove unused ApolloStoreInterceptor --- .../apollographql/apollo/cache/normalized/ApolloStore.kt | 7 +------ .../apollo/cache/normalized/FetchPolicyInterceptors.kt | 2 +- .../cache/normalized/internal/ApolloCacheInterceptor.kt | 3 +-- .../apollo/cache/normalized/internal/WatcherInterceptor.kt | 3 +-- 4 files changed, 4 insertions(+), 11 deletions(-) diff --git a/libraries/apollo-normalized-cache/src/commonMain/kotlin/com/apollographql/apollo/cache/normalized/ApolloStore.kt b/libraries/apollo-normalized-cache/src/commonMain/kotlin/com/apollographql/apollo/cache/normalized/ApolloStore.kt index f8d340cdd86..83c16f9c791 100644 --- a/libraries/apollo-normalized-cache/src/commonMain/kotlin/com/apollographql/apollo/cache/normalized/ApolloStore.kt +++ b/libraries/apollo-normalized-cache/src/commonMain/kotlin/com/apollographql/apollo/cache/normalized/ApolloStore.kt @@ -4,6 +4,7 @@ import com.apollographql.apollo.api.CustomScalarAdapters import com.apollographql.apollo.api.Fragment import com.apollographql.apollo.api.Operation import com.apollographql.apollo.api.json.JsonNumber +import com.apollographql.apollo.cache.normalized.ApolloStore.Companion.ALL_KEYS import com.apollographql.apollo.cache.normalized.api.CacheHeaders import com.apollographql.apollo.cache.normalized.api.CacheKey import com.apollographql.apollo.cache.normalized.api.CacheKeyGenerator @@ -14,7 +15,6 @@ import com.apollographql.apollo.cache.normalized.api.NormalizedCacheFactory import com.apollographql.apollo.cache.normalized.api.Record import com.apollographql.apollo.cache.normalized.api.TypePolicyCacheKeyGenerator import com.apollographql.apollo.cache.normalized.internal.DefaultApolloStore -import com.apollographql.apollo.interceptor.ApolloInterceptor import com.benasher44.uuid.Uuid import kotlinx.coroutines.flow.SharedFlow import kotlin.reflect.KClass @@ -281,11 +281,6 @@ fun ApolloStore( cacheResolver: CacheResolver = FieldPolicyCacheResolver, ): ApolloStore = DefaultApolloStore(normalizedCacheFactory, cacheKeyGenerator, cacheResolver) -/** - * Interface that marks all interceptors added when configuring a `store()` on ApolloClient.Builder. - */ -internal interface ApolloStoreInterceptor : ApolloInterceptor - internal fun ApolloStore.cacheDumpProvider(): () -> Map>>> { return { dump().map { (cacheClass, cacheRecords) -> diff --git a/libraries/apollo-normalized-cache/src/commonMain/kotlin/com/apollographql/apollo/cache/normalized/FetchPolicyInterceptors.kt b/libraries/apollo-normalized-cache/src/commonMain/kotlin/com/apollographql/apollo/cache/normalized/FetchPolicyInterceptors.kt index 7466ece0462..94d9c20e906 100644 --- a/libraries/apollo-normalized-cache/src/commonMain/kotlin/com/apollographql/apollo/cache/normalized/FetchPolicyInterceptors.kt +++ b/libraries/apollo-normalized-cache/src/commonMain/kotlin/com/apollographql/apollo/cache/normalized/FetchPolicyInterceptors.kt @@ -129,7 +129,7 @@ val CacheAndNetworkInterceptor = object : ApolloInterceptor { } } -internal object FetchPolicyRouterInterceptor : ApolloInterceptor, ApolloStoreInterceptor { +internal object FetchPolicyRouterInterceptor : ApolloInterceptor { override fun intercept(request: ApolloRequest, chain: ApolloInterceptorChain): Flow> { if (request.operation !is Query) { // Subscriptions and Mutations do not support fetchPolicies diff --git a/libraries/apollo-normalized-cache/src/commonMain/kotlin/com/apollographql/apollo/cache/normalized/internal/ApolloCacheInterceptor.kt b/libraries/apollo-normalized-cache/src/commonMain/kotlin/com/apollographql/apollo/cache/normalized/internal/ApolloCacheInterceptor.kt index 25cfb7cf270..a227d3c430d 100644 --- a/libraries/apollo-normalized-cache/src/commonMain/kotlin/com/apollographql/apollo/cache/normalized/internal/ApolloCacheInterceptor.kt +++ b/libraries/apollo-normalized-cache/src/commonMain/kotlin/com/apollographql/apollo/cache/normalized/internal/ApolloCacheInterceptor.kt @@ -9,7 +9,6 @@ import com.apollographql.apollo.api.Operation import com.apollographql.apollo.api.Query import com.apollographql.apollo.api.Subscription import com.apollographql.apollo.cache.normalized.ApolloStore -import com.apollographql.apollo.cache.normalized.ApolloStoreInterceptor import com.apollographql.apollo.cache.normalized.CacheInfo import com.apollographql.apollo.cache.normalized.api.ApolloCacheHeaders import com.apollographql.apollo.cache.normalized.api.CacheHeaders @@ -38,7 +37,7 @@ import kotlinx.coroutines.launch internal class ApolloCacheInterceptor( val store: ApolloStore, -) : ApolloInterceptor, ApolloStoreInterceptor { +) : ApolloInterceptor { private suspend fun maybeAsync(request: ApolloRequest, block: suspend () -> Unit) { if (request.writeToCacheAsynchronously) { val scope = request.executionContext[ConcurrencyInfo]!!.coroutineScope diff --git a/libraries/apollo-normalized-cache/src/commonMain/kotlin/com/apollographql/apollo/cache/normalized/internal/WatcherInterceptor.kt b/libraries/apollo-normalized-cache/src/commonMain/kotlin/com/apollographql/apollo/cache/normalized/internal/WatcherInterceptor.kt index 05456f2c1fa..17780fc78b8 100644 --- a/libraries/apollo-normalized-cache/src/commonMain/kotlin/com/apollographql/apollo/cache/normalized/internal/WatcherInterceptor.kt +++ b/libraries/apollo-normalized-cache/src/commonMain/kotlin/com/apollographql/apollo/cache/normalized/internal/WatcherInterceptor.kt @@ -6,7 +6,6 @@ import com.apollographql.apollo.api.CustomScalarAdapters import com.apollographql.apollo.api.Operation import com.apollographql.apollo.api.Query import com.apollographql.apollo.cache.normalized.ApolloStore -import com.apollographql.apollo.cache.normalized.ApolloStoreInterceptor import com.apollographql.apollo.cache.normalized.api.dependentKeys import com.apollographql.apollo.cache.normalized.watchContext import com.apollographql.apollo.exception.DefaultApolloException @@ -24,7 +23,7 @@ import kotlinx.coroutines.flow.onSubscription internal val WatcherSentinel = DefaultApolloException("The watcher has started") -internal class WatcherInterceptor(val store: ApolloStore) : ApolloInterceptor, ApolloStoreInterceptor { +internal class WatcherInterceptor(val store: ApolloStore) : ApolloInterceptor { override fun intercept(request: ApolloRequest, chain: ApolloInterceptorChain): Flow> { val watchContext = request.watchContext ?: return chain.proceed(request)