Fixing Source List Displaying Empty Items (#810)

* Fixing source list displaying empty items
This commit is contained in:
yueehaoo 2023-12-14 03:49:42 +08:00 committed by GitHub
parent 410cedc128
commit 6e5a52e440
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -112,7 +112,7 @@ class RepoLinkGenerator(
isCasting = LoadType.Chromecast == type,
subtitleCallback = { file ->
val correctFile = PlayerSubtitleHelper.getSubtitleData(file)
if (!currentSubsUrls.contains(correctFile.url)) {
if (correctFile.url.isNotEmpty() && !currentSubsUrls.contains(correctFile.url)) {
currentSubsUrls.add(correctFile.url)
// this part makes sure that all names are unique for UX
@ -135,15 +135,15 @@ class RepoLinkGenerator(
},
callback = { link ->
Log.d(TAG, "Loaded ExtractorLink: $link")
if (!currentLinks.contains(link.url)) {
if (!currentLinkCache.contains(link)) {
if (link.url.isNotEmpty() && !currentLinks.contains(link.url) && !currentLinkCache.contains(link)) {
currentLinks.add(link.url)
if (allowedTypes.contains(link.type)) {
callback(Pair(link, null))
}
currentLinkCache.add(link)
//linkCache[index] = currentLinkCache
}
// linkCache[index] = currentLinkCache
}
}
)