From 0cafef9b74eb16b56ca250ca5e937d639a1eb807 Mon Sep 17 00:00:00 2001 From: Damontecres Date: Thu, 19 Feb 2026 21:13:30 -0500 Subject: [PATCH 1/2] Fix a few customize home bugs --- .../ui/main/settings/HomeLibraryRowTypeList.kt | 2 +- .../ui/main/settings/HomeSettingsPage.kt | 11 ++++++++--- .../ui/main/settings/HomeSettingsRowList.kt | 2 +- .../ui/main/settings/HomeSettingsViewModel.kt | 18 ++++++++++-------- app/src/main/res/values/strings.xml | 4 ++-- 5 files changed, 22 insertions(+), 15 deletions(-) diff --git a/app/src/main/java/com/github/damontecres/wholphin/ui/main/settings/HomeLibraryRowTypeList.kt b/app/src/main/java/com/github/damontecres/wholphin/ui/main/settings/HomeLibraryRowTypeList.kt index 64cdd2464..4236c03ad 100644 --- a/app/src/main/java/com/github/damontecres/wholphin/ui/main/settings/HomeLibraryRowTypeList.kt +++ b/app/src/main/java/com/github/damontecres/wholphin/ui/main/settings/HomeLibraryRowTypeList.kt @@ -127,6 +127,6 @@ enum class LibraryRowType( TV_CHANNELS(R.string.channels), TV_PROGRAMS(R.string.live_tv), RECENTLY_RECORDED(R.string.recently_recorded), - COLLECTION(R.string.collections), + COLLECTION(R.string.collection), PLAYLIST(R.string.playlist), } diff --git a/app/src/main/java/com/github/damontecres/wholphin/ui/main/settings/HomeSettingsPage.kt b/app/src/main/java/com/github/damontecres/wholphin/ui/main/settings/HomeSettingsPage.kt index 26126b82d..1185f719e 100644 --- a/app/src/main/java/com/github/damontecres/wholphin/ui/main/settings/HomeSettingsPage.kt +++ b/app/src/main/java/com/github/damontecres/wholphin/ui/main/settings/HomeSettingsPage.kt @@ -66,13 +66,18 @@ fun HomeSettingsPage( val discoverEnabled = false // by viewModel.discoverEnabled.collectAsState(false) // Adds a row, waits until its done loading, then scrolls to the new row - fun addRow(func: () -> Job) { + fun addRow( + scrollToBottom: Boolean = true, + func: () -> Job, + ) { scope.launch(ExceptionHandler(autoToast = true)) { while (backStack.size > 1) { backStack.removeAt(backStack.lastIndex) } func.invoke().join() - listState.animateScrollToItem(state.rows.lastIndex) + if (scrollToBottom) { + listState.animateScrollToItem(state.rows.lastIndex) + } } } @@ -273,7 +278,7 @@ fun HomeSettingsPage( onClickReset = { showConfirmDialog = ShowConfirm(R.string.overwrite_local_settings) { - viewModel.resetToDefault() + addRow(false) { viewModel.resetToDefault() } } }, modifier = destModifier, diff --git a/app/src/main/java/com/github/damontecres/wholphin/ui/main/settings/HomeSettingsRowList.kt b/app/src/main/java/com/github/damontecres/wholphin/ui/main/settings/HomeSettingsRowList.kt index 231243ce7..5a0ac9651 100644 --- a/app/src/main/java/com/github/damontecres/wholphin/ui/main/settings/HomeSettingsRowList.kt +++ b/app/src/main/java/com/github/damontecres/wholphin/ui/main/settings/HomeSettingsRowList.kt @@ -141,7 +141,7 @@ fun HomeSettingsRowList( ) } item { - TitleText(stringResource(R.string.home_rows)) + TitleText(stringResource(R.string.home_rows) + " (${state.rows.size})") HorizontalDivider() } itemsIndexed(state.rows, key = { _, row -> row.id }) { index, row -> diff --git a/app/src/main/java/com/github/damontecres/wholphin/ui/main/settings/HomeSettingsViewModel.kt b/app/src/main/java/com/github/damontecres/wholphin/ui/main/settings/HomeSettingsViewModel.kt index 73d659bca..33c8cdaf9 100644 --- a/app/src/main/java/com/github/damontecres/wholphin/ui/main/settings/HomeSettingsViewModel.kt +++ b/app/src/main/java/com/github/damontecres/wholphin/ui/main/settings/HomeSettingsViewModel.kt @@ -114,7 +114,7 @@ class HomeSettingsViewModel } private suspend fun fetchRowData() { - val limit = 6 + val limit = 8 val semaphore = Semaphore(4) val rows = serverRepository.currentUserDto.value?.let { userDto -> @@ -219,7 +219,7 @@ class HomeSettingsViewModel MetaRowType.NEXT_UP -> { HomeRowConfigDisplay( id = id, - title = context.getString(R.string.continue_watching), + title = context.getString(R.string.next_up), config = NextUp(), ) } @@ -480,6 +480,7 @@ class HomeSettingsViewModel result.rows.mapIndexed { index, config -> homeSettingsService.resolve(index, config) } + idCounter = newRows.maxOfOrNull { it.id }?.plus(1) ?: 0 _state.update { it.copy(rows = newRows) } @@ -509,6 +510,7 @@ class HomeSettingsViewModel val result = homeSettingsService.parseFromWebConfig(user.id) if (result != null) { Timber.v("Got web settings") + idCounter = result.rows.maxOfOrNull { it.id }?.plus(1) ?: 0 _state.update { it.copy(rows = result.rows) } @@ -593,17 +595,17 @@ class HomeSettingsViewModel } } - fun resetToDefault() { + fun resetToDefault() = viewModelScope.launchIO { val userId = serverRepository.currentUser.value?.id ?: return@launchIO _state.update { it.copy(loading = LoadingState.Loading) } val result = homeSettingsService.createDefault(userId) + idCounter = result.rows.maxOfOrNull { it.id }?.plus(1) ?: 0 _state.update { - it.copy(rows = result.rows) + it.copy(rows = result.rows, rowData = emptyList()) } fetchRowData() } - } private suspend fun showSaveToast() = showToast( @@ -729,9 +731,9 @@ data class HomePageSettingsState( val EMPTY = HomePageSettingsState( LoadingState.Pending, - listOf(), - listOf(), - listOf(), + emptyList(), + emptyList(), + emptyList(), ) } } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 3d7b1b5c3..5a4d24bf5 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -505,8 +505,8 @@ Apply to all rows Customize home page Home rows - Load from server - Save to server + Load from server user profile + Save to server user profile Load from web client Use series image Add row for %1$s From 1cbeb20b59621068028dff3f38ebfe4fa3a98cd8 Mon Sep 17 00:00:00 2001 From: Damontecres Date: Thu, 19 Feb 2026 21:29:49 -0500 Subject: [PATCH 2/2] Fix favorite row titles --- .../wholphin/services/HomeSettingsService.kt | 16 +++++++++++++--- .../ui/main/settings/HomeSettingsViewModel.kt | 6 +++++- app/src/main/res/values/strings.xml | 1 + 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/github/damontecres/wholphin/services/HomeSettingsService.kt b/app/src/main/java/com/github/damontecres/wholphin/services/HomeSettingsService.kt index 346319344..93dc32d29 100644 --- a/app/src/main/java/com/github/damontecres/wholphin/services/HomeSettingsService.kt +++ b/app/src/main/java/com/github/damontecres/wholphin/services/HomeSettingsService.kt @@ -13,6 +13,7 @@ import com.github.damontecres.wholphin.ui.DefaultItemFields import com.github.damontecres.wholphin.ui.SlimItemFields import com.github.damontecres.wholphin.ui.components.getGenreImageMap import com.github.damontecres.wholphin.ui.main.settings.Library +import com.github.damontecres.wholphin.ui.main.settings.favoriteOptions import com.github.damontecres.wholphin.ui.toBaseItems import com.github.damontecres.wholphin.ui.toServerString import com.github.damontecres.wholphin.util.GetGenresRequestHandler @@ -511,7 +512,11 @@ class HomeSettingsService } is HomeRowConfig.Favorite -> { - val name = context.getString(R.string.favorites) // TODO "Favorite " + val name = + context.getString( + R.string.favorite_items, + context.getString(favoriteOptions[config.kind]!!), + ) HomeRowConfigDisplay(id, name, config) } @@ -785,6 +790,11 @@ class HomeSettingsService } is HomeRowConfig.Favorite -> { + val title = + context.getString( + R.string.favorite_items, + context.getString(favoriteOptions[row.kind]!!), + ) if (row.kind == BaseItemKind.PERSON) { val request = GetPersonsRequest( @@ -801,7 +811,7 @@ class HomeSettingsService .map { BaseItem(it, true) } .let { Success( - context.getString(R.string.favorites), // TODO + title, it, row.viewOptions, ) @@ -822,7 +832,7 @@ class HomeSettingsService .map { BaseItem(it, row.viewOptions.useSeries) } .let { Success( - context.getString(R.string.favorites), // TODO + title, it, row.viewOptions, ) diff --git a/app/src/main/java/com/github/damontecres/wholphin/ui/main/settings/HomeSettingsViewModel.kt b/app/src/main/java/com/github/damontecres/wholphin/ui/main/settings/HomeSettingsViewModel.kt index 33c8cdaf9..9110af121 100644 --- a/app/src/main/java/com/github/damontecres/wholphin/ui/main/settings/HomeSettingsViewModel.kt +++ b/app/src/main/java/com/github/damontecres/wholphin/ui/main/settings/HomeSettingsViewModel.kt @@ -356,7 +356,11 @@ class HomeSettingsViewModel val newRow = HomeRowConfigDisplay( id = id, - title = context.getString(favoriteOptions[type]!!), + title = + context.getString( + R.string.favorite_items, + context.getString(favoriteOptions[type]!!), + ), config = HomeRowConfig.Favorite(type), ) updateState { diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 5a4d24bf5..c4f3db4f5 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -188,6 +188,7 @@ Samples Featurettes Shorts + Favorite %s Trailers