Skip to content

Remove unused ApolloStoreInterceptor #6612

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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<String, Map<String, Pair<Int, Map<String, Any?>>>> {
return {
dump().map { (cacheClass, cacheRecords) ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ val CacheAndNetworkInterceptor = object : ApolloInterceptor {
}
}

internal object FetchPolicyRouterInterceptor : ApolloInterceptor, ApolloStoreInterceptor {
internal object FetchPolicyRouterInterceptor : ApolloInterceptor {
override fun <D : Operation.Data> intercept(request: ApolloRequest<D>, chain: ApolloInterceptorChain): Flow<ApolloResponse<D>> {
if (request.operation !is Query) {
// Subscriptions and Mutations do not support fetchPolicies
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -38,7 +37,7 @@ import kotlinx.coroutines.launch

internal class ApolloCacheInterceptor(
val store: ApolloStore,
) : ApolloInterceptor, ApolloStoreInterceptor {
) : ApolloInterceptor {
private suspend fun <D : Operation.Data> maybeAsync(request: ApolloRequest<D>, block: suspend () -> Unit) {
if (request.writeToCacheAsynchronously) {
val scope = request.executionContext[ConcurrencyInfo]!!.coroutineScope
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 <D : Operation.Data> intercept(request: ApolloRequest<D>, chain: ApolloInterceptorChain): Flow<ApolloResponse<D>> {
val watchContext = request.watchContext ?: return chain.proceed(request)

Expand Down
Loading