From 68d9e1c19e21b6c8c6fcaaf69cdc86ceb3e0b77a Mon Sep 17 00:00:00 2001 From: KhooLy <73142442+KhooLy@users.noreply.github.com> Date: Tue, 14 Jul 2026 22:26:13 +0300 Subject: [PATCH] Load every Nuvio folder source --- .../com/fluxa/app/ui/catalog/HomeViewModel.kt | 26 +++++++++++++++++-- .../NuvioAccountImportCoordinator.kt | 2 +- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/fluxa/app/ui/catalog/HomeViewModel.kt b/app/src/main/java/com/fluxa/app/ui/catalog/HomeViewModel.kt index b62a31c..749aeb4 100644 --- a/app/src/main/java/com/fluxa/app/ui/catalog/HomeViewModel.kt +++ b/app/src/main/java/com/fluxa/app/ui/catalog/HomeViewModel.kt @@ -926,11 +926,11 @@ class HomeViewModel @Inject constructor( try { val catalogSources = category.catalogSources.orEmpty() val remoteSources = category.remoteSources.orEmpty() - if (catalogSources.isNotEmpty()) { + if (catalogSources.isNotEmpty() || remoteSources.isNotEmpty()) { val nextSkip = if (category.items.isEmpty()) 0 else category.skip + 20 val lang = currentActiveProfile?.safeLanguage ?: "en" val semaphore = Semaphore(permits = 4) - val newItems = coroutineScope { + val addonItems = coroutineScope { catalogSources.map { source -> async(Dispatchers.IO) { semaphore.withPermit { @@ -950,6 +950,28 @@ class HomeViewModel @Inject constructor( } }.awaitAll().flatten() } + val remoteItems = if (remoteSources.isEmpty()) { + emptyList() + } else { + val result = dispatchHeadless( + mapOf( + "type" to "catalogPageRequested", + "categoryId" to categoryId, + "transportUrl" to null, + "contentType" to category.type, + "catalogId" to category.catalogId, + "skip" to nextSkip, + "genre" to null, + "search" to null, + "remoteSource" to remoteSources, + "profile" to currentActiveProfile + ) + ) + val home = result.state["home"] as? Map<*, *> ?: emptyMap() + val paging = home["paging"] as? Map<*, *> ?: emptyMap() + fromStateList(paging["items"], metaListType) + } + val newItems = addonItems + remoteItems updateHomeCategory(categoryId) { existing -> existing.copy( items = if (newItems.isEmpty()) existing.items else (existing.items + newItems).distinctBy { "${it.type}:${it.id}" }, diff --git a/data/src/main/java/com/fluxa/app/data/repository/NuvioAccountImportCoordinator.kt b/data/src/main/java/com/fluxa/app/data/repository/NuvioAccountImportCoordinator.kt index 6ecc2e8..2a81592 100644 --- a/data/src/main/java/com/fluxa/app/data/repository/NuvioAccountImportCoordinator.kt +++ b/data/src/main/java/com/fluxa/app/data/repository/NuvioAccountImportCoordinator.kt @@ -235,7 +235,7 @@ class NuvioAccountImportCoordinator( id = collection.id ?: java.util.UUID.randomUUID().toString(), title = collection.title ?: "", imageUrl = collection.backdropImageUrl, - showOnHome = collection.showOnHome ?: collection.pinToTop, + showOnHome = collection.showOnHome ?: true, pinToTop = collection.pinToTop, viewMode = collection.viewMode, showAllTab = collection.showAllTab,