Filter cache results by enabled clients

This commit is contained in:
Kelvin 2023-12-20 18:35:13 +01:00
parent 8a53297be2
commit ed9a65b2f0

View file

@ -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<IPager<IPlatformContent>>;