From ed9a65b2f059cd30ce951223727d39e238f59a0a Mon Sep 17 00:00:00 2001 From: Kelvin Date: Wed, 20 Dec 2023 18:35:13 +0100 Subject: [PATCH] Filter cache results by enabled clients --- .../java/com/futo/platformplayer/states/StateCache.kt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/futo/platformplayer/states/StateCache.kt b/app/src/main/java/com/futo/platformplayer/states/StateCache.kt index 409a503c..b922d756 100644 --- a/app/src/main/java/com/futo/platformplayer/states/StateCache.kt +++ b/app/src/main/java/com/futo/platformplayer/states/StateCache.kt @@ -49,13 +49,17 @@ class StateCache { Logger.i(TAG, "Subscriptions CachePager get subscriptions"); val subs = StateSubscriptions.instance.getSubscriptions(); Logger.i(TAG, "Subscriptions CachePager polycentric urls"); - val allUrls = subs.map { + val allUrls = subs + .map { val otherUrls = PolycentricCache.instance.getCachedProfile(it.channel.url)?.profile?.ownedClaims?.mapNotNull { c -> c.claim.resolveChannelUrl() } ?: listOf(); if(!otherUrls.contains(it.channel.url)) return@map listOf(listOf(it.channel.url), otherUrls).flatten(); else return@map otherUrls; - }.flatten().distinct(); + } + .flatten() + .distinct() + .filter { StatePlatform.instance.hasEnabledChannelClient(it) }; Logger.i(TAG, "Subscriptions CachePager get pagers"); val pagers: List>;