From 45a7977a533c57d394877a48b7fb9c78ef35fa93 Mon Sep 17 00:00:00 2001 From: LagradOst <11805592+LagradOst@users.noreply.github.com> Date: Sat, 28 May 2022 16:52:36 +0200 Subject: [PATCH] fixed tv issue and cross-provider cache --- .../lagradost/cloudstream3/ui/player/RepoLinkGenerator.kt | 6 +++--- .../lagradost/cloudstream3/ui/settings/SettingsFragment.kt | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/lagradost/cloudstream3/ui/player/RepoLinkGenerator.kt b/app/src/main/java/com/lagradost/cloudstream3/ui/player/RepoLinkGenerator.kt index 801378e3..9ac1e2c6 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/ui/player/RepoLinkGenerator.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/ui/player/RepoLinkGenerator.kt @@ -15,7 +15,7 @@ class RepoLinkGenerator( ) : IGenerator { companion object { const val TAG = "RepoLink" - val cache: HashMap, MutableSet>> = hashMapOf() + val cache: HashMap, Pair, MutableSet>> = hashMapOf() } override val hasCache = true @@ -71,7 +71,7 @@ class RepoLinkGenerator( val (currentLinkCache, currentSubsCache) = if (clearCache) { Pair(mutableSetOf(), mutableSetOf()) } else { - cache[current.id] ?: Pair(mutableSetOf(), mutableSetOf()) + cache[Pair(current.apiName, current.id)] ?: Pair(mutableSetOf(), mutableSetOf()) } //val currentLinkCache = if (clearCache) mutableSetOf() else linkCache[index].toMutableSet() @@ -137,7 +137,7 @@ class RepoLinkGenerator( } } ) - cache[current.id] = Pair(currentLinkCache, currentSubsCache) + cache[Pair(current.apiName, current.id)] = Pair(currentLinkCache, currentSubsCache) return result } diff --git a/app/src/main/java/com/lagradost/cloudstream3/ui/settings/SettingsFragment.kt b/app/src/main/java/com/lagradost/cloudstream3/ui/settings/SettingsFragment.kt index d10fabff..6987102a 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/ui/settings/SettingsFragment.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/ui/settings/SettingsFragment.kt @@ -75,9 +75,10 @@ class SettingsFragment : Fragment() { private fun Context.isAutoTv(): Boolean { val uiModeManager = getSystemService(Context.UI_MODE_SERVICE) as UiModeManager? // AFT = Fire TV + val model = Build.MODEL.lowercase() return uiModeManager?.currentModeType == Configuration.UI_MODE_TYPE_TELEVISION || Build.MODEL.contains( "AFT" - ) + ) || model.contains("firestick") || model.contains("fire tv") || model.contains("chromecast") } }