fixed tv issue and cross-provider cache

This commit is contained in:
LagradOst 2022-05-28 16:52:36 +02:00
parent 57128dbc7d
commit 45a7977a53
2 changed files with 5 additions and 4 deletions

View file

@ -15,7 +15,7 @@ class RepoLinkGenerator(
) : IGenerator {
companion object {
const val TAG = "RepoLink"
val cache: HashMap<Int, Pair<MutableSet<ExtractorLink>, MutableSet<SubtitleData>>> = hashMapOf()
val cache: HashMap<Pair<String, Int>, Pair<MutableSet<ExtractorLink>, MutableSet<SubtitleData>>> = 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
}

View file

@ -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")
}
}