Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ This repository contains only the Silo Android clients. Shared Kotlin logic live

- Ebooks/Reading are phone-only. Do not expose ebooks or Reading on Android TV.
- Android mobile navigation is Home, Libraries, For You, Calendar, and Downloads only when the active profile has downloads. Video, Audio, and Reading are library modes reached through Libraries, not bottom-nav tabs.
- Android TV navigation is Home, available media-type tabs from server libraries, For You (with its Watchlist/Favorites dropdown, mirroring tvOS `.recommendations`), Calendar, and Requests while the server enables it (mirroring tvOS `.requests`), plus search and profile actions. Reading/ebooks are excluded.
- Requests is live on phone and TV, server-gated by `requests_enabled` (phone: profile menu + search; TV: a top-bar tab + search, matching Apple). Request administration (approve, decline, retry, limits, auto-approve) is web-admin only: the Requests screens offer users request, cancel of their own pending request, and status, and never moderation (a source guard test enforces this). Other admin surfaces are not exposed in the Android clients — no STATS dashboard, and none of the richer admin screens (users/sessions/logs/scans). Session management (seeing where you are signed in and signing other devices out) is not exposed either; device pairing stays. This is a deliberate divergence from Apple, which does surface the STATS dashboard. Do not add any of it back to menus without an explicit product decision.
- Android TV navigation is Home, available media-type tabs from server libraries, For You (with its Watchlist/Favorites dropdown, mirroring tvOS `.recommendations`), and Calendar, with search left of the tabs and the profile avatar on the right. The order is fixed, matching tvOS and Roku. Requests lives in the profile menu while the server enables it. Reading/ebooks are excluded.
- Requests is live on phone and TV, server-gated by `requests_enabled` (phone and TV: profile menu + search, matching Apple and Roku). Request administration (approve, decline, retry, limits, auto-approve) is web-admin only: the Requests screens offer users request, cancel of their own pending request, and status, and never moderation (a source guard test enforces this). Other admin surfaces are not exposed in the Android clients — no STATS dashboard, and none of the richer admin screens (users/sessions/logs/scans). Session management (seeing where you are signed in and signing other devices out) is not exposed either; device pairing stays. This is a deliberate divergence from Apple, which does surface the STATS dashboard. Do not add any of it back to menus without an explicit product decision.
- Watch Party (synchronized playback) is experimental on phone and TV. Its entry points (profile menu, the detail page's party action, and phone `silo://watch-party` invitations) appear only while Settings → Experimental → Watch Party is on, a device-local toggle that defaults on in debug builds and off in release builds, and it works only when the server advertises the room and playback capabilities. Keep it behind the toggle until the qualification matrix in `docs/watch-party-implementation-plan.md` passes.

## Build, Test, and Development Commands
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@ WorkManager-backed downloads of video, audiobooks, and books to public device st

### 📚 Library, browse & discovery (phone + TV)
- **Phone navigation** — Home, Libraries, For You, Calendar, and Downloads when the active profile has downloads. Video / Audio / Reading are library modes, not bottom-nav tabs.
- **TV navigation** — Home, visible media-type tabs derived from server libraries (Movies/TV/Music/Audiobooks), For You, and Calendar. Reading/ebooks are intentionally excluded from TV.
- **TV navigation** — Search, then Home, visible media-type tabs derived from server libraries (Movies/Series/Music/Audiobooks), For You, and Calendar. Requests sits in the profile menu. Reading/ebooks are intentionally excluded from TV.
- **Home** with Continue Watching, Recently Added/Released, and server-curated recommendation rows.
- **Browse** with genre/rating filters, sorting, and infinite-scroll grids; **collections** are browse-only in the Android clients, while collection authoring/management remains web-only.
- **Item detail** for movies and series includes seasons → episodes, multi-version files, cast/crew, local download controls, and phone-to-TV playback handoff.
- **Search** scoped by media type, debounced and paginated.
- **Requests** — live on phone and TV behind the server's `requests_enabled` flag (phone: profile menu + search; TV: top-bar tab + search); request administration stays in web admin. **Experimental** — Watch Party, behind Settings → Experimental. **Not exposed** — other admin surfaces and session management are not reachable app surfaces today.
- **Requests** — live on phone and TV behind the server's `requests_enabled` flag (phone and TV: profile menu + search); request administration stays in web admin. **Experimental** — Watch Party, behind Settings → Experimental. **Not exposed** — other admin surfaces and session management are not reachable app surfaces today.

### 📖 Reading & 🎧 Audio
- **Ebook reader (phone only)** — EPUB, PDF, CBZ (comics), TXT/Markdown, FB2/FBZ, plus MOBI/AZW/AZW3 when the server can convert to EPUB; CBR and unsupported originals can be downloaded/opened externally. Themes, text size, margins, table of contents, bookmarks, and progress are supported.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ import org.siloserver.silo.viewmodel.MyRequestsViewModel
import org.siloserver.silo.viewmodel.RequestsViewModel

/**
* The top-bar Requests tab in the Skyline layout Home and the library tabs
* use: an ambient backdrop and a passive preview panel that follow the focused
* The Requests page, opened from the profile menu, in the Skyline layout
* Home and the library tabs use: an ambient backdrop and a passive preview panel that follow the focused
* card, including its request status and stage track, over horizontally
* scrolling rows in the bottom band (the tvOS `TVRequestsPage`). Rows: the
* user's own requests, then the discover carousels. Request administration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import androidx.compose.material.icons.filled.Bookmark
import androidx.compose.material.icons.filled.Dns
import androidx.compose.material.icons.filled.Favorite
import androidx.compose.material.icons.filled.History
import androidx.compose.material.icons.filled.Inbox
import androidx.compose.material.icons.filled.People
import androidx.compose.material.icons.filled.Settings
import androidx.compose.runtime.Composable
Expand Down Expand Up @@ -319,8 +320,8 @@ fun TvMainShell(
showAudiobooksTab = runCatching { tvLibraryScopeStore.getShowAudiobooksTab() }.getOrDefault(false)
showAudiobooksTabResolved = true
}
val visibleRoots = remember(libraries, showAudiobooksTab, requestsEnabled) {
visibleTvRoots(libraries, showAudiobooks = showAudiobooksTab, requestsEnabled = requestsEnabled)
val visibleRoots = remember(libraries, showAudiobooksTab) {
visibleTvRoots(libraries, showAudiobooks = showAudiobooksTab)
}

// In-session scope/pill selections per library type. Scope selections are
Expand Down Expand Up @@ -618,7 +619,7 @@ fun TvMainShell(
// top), while ordinary content re-entry keeps the focusRestorer()'s
// last-focused card.
var contentFocusRequest by remember { mutableIntStateOf(0) }
// Bumped only when the Requests tab is selected from the bar. Saveable, so
// Bumped only when Requests is opened from the profile menu. Saveable, so
// a return to the shell from an outer route (a library title opened from
// Requests) restores the last card instead of reading as a fresh entry.
var requestsEntryRequest by rememberSaveable { mutableIntStateOf(0) }
Expand Down Expand Up @@ -695,8 +696,8 @@ fun TvMainShell(
// For You tab they were opened from — they are not tab roots (no highlight,
// Back still pops), but Up from them must land on their tab, not on
// whatever the geometric search picks (the Search icon, from the left edge).
val selectedMenuFocusTarget = (selectedRoot ?: menuFocusRootForRoute(currentRoute))
?.let(TvTopMenuPanel::Root)
val selectedMenuFocusTarget =
selectedRoot?.let(TvTopMenuPanel::Root) ?: menuFocusTargetForRoute(currentRoute)

// Which libraries actually HAVE collections — gates the cascade's
// Collections pill so an empty library doesn't offer a dead-end section
Expand Down Expand Up @@ -870,6 +871,15 @@ fun TvMainShell(
moveFocusToContent(TvMainRoute.ForYou.route)
}

// Requests opens from the profile menu. The page claims its first card
// from the shell token, so the menu closes without moving focus itself.
val openRequests: () -> Unit = {
requestsFocusHandoffPending = true
requestsEntryRequest++
navigateToSecondary(TvMainRoute.Requests.route)
focusState.closeProfileMenuForContent()
}

val onSelectRoot: (TvRootDestination) -> Unit = { dest ->
val route = dest.toRoute()
if (dest == TvRootDestination.ForYou) {
Expand All @@ -890,10 +900,6 @@ fun TvMainShell(
if (dest == TvRootDestination.Calendar) {
calendarFocusHandoffPending = true
}
if (dest == TvRootDestination.Requests) {
requestsFocusHandoffPending = true
requestsEntryRequest++
}
// A dwell preview can still be open when Center commits For You (or a
// library root). Close it without returning focus to the bar before the
// content handoff, otherwise the overlay lingers and races page focus.
Expand Down Expand Up @@ -925,9 +931,6 @@ fun TvMainShell(
// transition. Leave focus on the Calendar tab until its screen is
// composed, then let TvCalendarScreen target the filter directly.
focusState.closeProfileMenuForContent()
} else if (dest == TvRootDestination.Requests) {
// The Requests page claims its first card from the shell token.
focusState.closeProfileMenuForContent()
} else if (dest == TvRootDestination.Home) {
// Home's contentFocusRequest targets row 0 / card 0 directly.
// Re-entering the parent content focusRestorer here would restore
Expand Down Expand Up @@ -1034,18 +1037,21 @@ fun TvMainShell(
}
}

LaunchedEffect(currentRoute, visibleRoots, librariesLoaded, showAudiobooksTabResolved, requestsResolved) {
LaunchedEffect(currentRoute, visibleRoots, librariesLoaded, showAudiobooksTabResolved, requestsResolved, requestsEnabled) {
// Wait until libraries have actually loaded — before that `visibleRoots`
// is just Home + Calendar, and a restored/deep-linked `main/movies` route
// would be wrongly ejected even though that type exists. Likewise wait for
// the async Audiobooks-tab read to resolve: until it lands `visibleRoots`
// omits Audiobooks, so a restored `main/audiobooks` route would be ejected
// to Home before the DataStore read completes.
if (!librariesLoaded || !showAudiobooksTabResolved) return@LaunchedEffect
// Likewise the Requests tab appears only once the server's requests
// status has been read; a restored Requests route (or a return from
// a title opened there) must not be ejected while that read runs.
if (currentRoute == TvMainRoute.Requests.route && !requestsResolved) return@LaunchedEffect
// Requests closes once the server's requests status reads as off. A
// restored Requests route (or a return from a title opened there) must
// not be ejected while that read runs.
if (currentRoute == TvMainRoute.Requests.route) {
if (requestsResolved && !requestsEnabled) navigateToRoute(firstTvRoute())
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
return@LaunchedEffect
}
// Only media-root tabs are eligible for the "tab no longer visible"
// redirect. Non-tab routes (Settings, Favorites, Search, …) map
// to null and must be left alone — otherwise navigating to Settings
Expand Down Expand Up @@ -1490,7 +1496,7 @@ fun TvMainShell(
onFocusHandoffFailed = {
requestsFocusHandoffPending = false
focusState.requestMenuFocus(
target = TvTopMenuPanel.Root(TvRootDestination.Requests),
target = selectedMenuFocusTarget,
suppressDwellPreview = true,
)
},
Expand Down Expand Up @@ -1577,8 +1583,8 @@ fun TvMainShell(
onInitialContentFocus = { focusState.closeProfileMenuForContent() },
)
}
// My Requests became the Requests tab's "Your requests" row; a
// saved back stack naming it lands on the tab.
// My Requests became the Requests page's "Your requests" row; a
// saved back stack naming it lands on the page.
composable(route = "main/requests/mine") {
LaunchedEffect(Unit) {
nestedNav.navigate(TvMainRoute.Requests.route) {
Expand Down Expand Up @@ -1808,6 +1814,8 @@ fun TvMainShell(
navigateToSecondary(TvMainRoute.History.route)
moveFocusToContent(TvMainRoute.History.route)
},
showRequests = requestsEnabled,
onRequests = openRequests,
showWatchParty = watchPartyEnabled,
onWatchParty = closeMenuAnd(onOpenWatchParty),
onSettings = {
Expand Down Expand Up @@ -1955,24 +1963,27 @@ private fun mapRouteToRoot(route: String): TvRootDestination? = when (route) {
TvMainRoute.Audiobooks.route -> TvRootDestination.LibraryType(TvLibraryTabType.Audiobooks)
TvMainRoute.Calendar.route -> TvRootDestination.Calendar
TvMainRoute.ForYou.route -> TvRootDestination.ForYou
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
TvMainRoute.Requests.route -> TvRootDestination.Requests
// Search maps to null so no top tab is highlighted (trailing icon).
// Request detail/Settings/Audio/Libraries are likewise non-tab.
else -> null
}

/** Bar tab that owns a non-root route for content→bar Up (see selectedMenuFocusTarget). */
private fun menuFocusRootForRoute(route: String): TvRootDestination? = when (route) {
/**
* Bar element that owns a non-root route for content→bar Up (see
* selectedMenuFocusTarget): For You for its saved lists, and the profile
* avatar for Requests, which opens from the profile menu.
*/
internal fun menuFocusTargetForRoute(route: String): TvTopMenuPanel? = when (route) {
TvMainRoute.Watchlist.route,
TvMainRoute.Favorites.route -> TvRootDestination.ForYou
TvMainRoute.Favorites.route -> TvTopMenuPanel.Root(TvRootDestination.ForYou)
TvMainRoute.Requests.route -> TvTopMenuPanel.Profile
else -> null
}

private fun TvRootDestination.toRoute(): String = when (this) {
TvRootDestination.Home -> TvMainRoute.Home.route
TvRootDestination.ForYou -> TvMainRoute.ForYou.route
TvRootDestination.Calendar -> TvMainRoute.Calendar.route
TvRootDestination.Requests -> TvMainRoute.Requests.route
is TvRootDestination.LibraryType -> when (type) {
TvLibraryTabType.Movies -> TvMainRoute.Movies.route
TvLibraryTabType.Series -> TvMainRoute.Series.route
Expand Down Expand Up @@ -2031,9 +2042,9 @@ private fun cascadePanelOffset(
* consumes input and focuses its first row on open; Back/Menu closes it and
* returns focus to the avatar via [onDismiss].
*
* Row set + order mirrors tvOS: Switch Profile · Watchlist · Favorites ·
* History · Watch Party (Settings → Experimental) · Settings · Switch Server ·
* Sign Out. Calendar and Requests are top-level tabs.
* Row set + order mirrors tvOS and Roku: Switch Profile · Watchlist ·
* Favorites · History · Requests (while the server has it enabled) · Watch
* Party (Settings → Experimental) · Settings · Switch Server · Sign Out.
*/
@OptIn(ExperimentalComposeUiApi::class)
@Composable
Expand All @@ -2045,6 +2056,8 @@ private fun TvProfileDropdown(
onWatchlist: () -> Unit,
onFavorites: () -> Unit,
onHistory: () -> Unit,
showRequests: Boolean,
onRequests: () -> Unit,
showWatchParty: Boolean,
onWatchParty: () -> Unit,
onSettings: () -> Unit,
Expand Down Expand Up @@ -2092,6 +2105,9 @@ private fun TvProfileDropdown(
ProfileDropdownRow(label = "Watchlist", icon = Icons.Filled.Bookmark, onClick = onWatchlist)
ProfileDropdownRow(label = "Favorites", icon = Icons.Filled.Favorite, onClick = onFavorites)
ProfileDropdownRow(label = "History", icon = Icons.Filled.History, onClick = onHistory)
if (showRequests) {
ProfileDropdownRow(label = "Requests", icon = Icons.Filled.Inbox, onClick = onRequests)
}
if (showWatchParty) {
ProfileDropdownRow(
label = "Watch Party",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,16 @@ import org.siloserver.silo.tv.ui.navigation.TvMainRoute
/**
* Skyline content-type-first shell (§3.1): a fixed root order of `Home`, then
* one tab per [TvLibraryTabType] the profile can actually see (a library of
* that type exists), then For You and `Calendar`, then Requests while the
* server has it enabled. Search is a trailing icon button.
* that type exists), then For You and `Calendar`. Search sits left of the
* tabs; Requests lives in the profile menu.
*
* Mirrors tvOS `TVMainTabView.visibleRoots`.
* Mirrors tvOS `TVRootDestination.visibleRoots` and the Roku top bar.
*/
fun visibleTvRoots(
libraries: List<UserLibrary>,
/** tvOS navPrefs.showAudiobooks parity: the Audiobooks tab is opt-in
* (hidden by default) even when an audiobook library exists. */
showAudiobooks: Boolean = false,
/** Requests is a server capability, not a customizable menu item: it
* trails the content tabs whenever the server has it enabled. */
requestsEnabled: Boolean = false,
): List<TvRootDestination> = buildList {
add(TvRootDestination.Home)
TvLibraryTabType.entries
Expand All @@ -28,7 +25,6 @@ fun visibleTvRoots(
// tvOS root order: libraries, then For You, then Calendar.
add(TvRootDestination.ForYou)
add(TvRootDestination.Calendar)
if (requestsEnabled) add(TvRootDestination.Requests)
}

fun firstTvRoute(): String = TvMainRoute.Home.route
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
package org.siloserver.silo.tv.ui.shell

/**
* Identifies which top-level destination the menu bar selects/highlights.
*
* Migrated to a sealed hierarchy (Skyline §3.1) so the bar is content-type-first
* — `Home`, one tab per visible [TvLibraryTabType], then `Calendar`. Search and
* For You are no longer root tabs (Search is a trailing icon button; For You
* becomes a Home row in a later stage). Mirrors tvOS `TVRootDestination`.
* Identifies which top-level destination the menu bar selects/highlights:
* `Home`, one tab per visible [TvLibraryTabType], For You, then `Calendar`.
* Search and the profile avatar sit outside the tabs, and Requests lives in
* the profile menu. Mirrors tvOS `TVRootDestination`.
*/
sealed class TvRootDestination {
/** Curated landing surface. Always the first tab. */
Expand All @@ -20,10 +18,4 @@ sealed class TvRootDestination {

/** Upcoming releases by week. */
data object Calendar : TvRootDestination()

/**
* Media requests, tvOS `.requests`. Present only while the server has
* requests enabled for this profile; it trails the content tabs.
*/
data object Requests : TvRootDestination()
}
Loading
Loading