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`), and Calendar, plus search and profile actions. Reading/ebooks are excluded.
- Requests is live on phone and TV, server-gated by `requests_enabled` (profile menu + search entry points, matching Apple). Admin surfaces are not exposed in the Android clients — no STATS dashboard, and none of the richer admin screens (users/sessions/logs/scans) — and neither is Watch Together. 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`), 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). Admins who can moderate requests approve, decline, and retry them in the Requests screens, as on Apple; limits and auto-approval stay in web admin. Other admin surfaces are not exposed in the Android clients — no STATS dashboard, and none of the richer admin screens (users/sessions/logs/scans) — and neither is Watch Together. 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.

## Build, Test, and Development Commands

Expand Down
8 changes: 4 additions & 4 deletions FEATURES.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ A detailed inventory of what the Android **phone** and **TV** clients do today.

File pointers are repository-relative.

> **Important exposure note:** Requests is live on both Android surfaces, gated by the server's `requests_enabled` flag (`/api/v1/requests/status`), and reached from the profile menu and search — matching the Apple clients. The admin stats dashboard is live for acting admins via Settings. The richer admin screens (users/sessions/logs/scans) and Watch Together remain inaccessible.
> **Important exposure note:** Requests is live on both Android surfaces, gated by the server's `requests_enabled` flag (`/api/v2/requests/status`), and reached from the profile menu and search on phone and from a top-bar tab and search on TV — matching the Apple clients. Admins who can moderate approve, decline, and retry requests there. The richer admin screens (users/sessions/logs/scans) and Watch Together remain inaccessible.

---

Expand Down Expand Up @@ -82,7 +82,7 @@ File pointers are repository-relative.
| Release calendar | ✅ | ✅ | Top-level mobile tab and TV top-menu tab |
| Live home refresh (events websocket) | ✅ | ✅ | `HomeRealtimeCoordinator`: user_state/catalog channels, 2s debounce; TV also refreshes on resume |
| System "Watch Next" row integration | ➖ | ✅ | `WatchNextRepository` (tvprovider) |
| Requests | ✅ | ✅ | Server-gated by `requests_enabled`; profile menu + search entry points |
| Requests | ✅ | ✅ | Server-gated by `requests_enabled`; phone: profile menu + search; TV: top-bar tab + search; admin approve/decline/retry |

## Reading (ebooks)

Expand Down Expand Up @@ -128,7 +128,7 @@ File pointers are repository-relative.
| Favorites & watchlist | ✅ | ✅ | TV: from Settings |
| Ratings | ✅ | ✅ | |
| Watch history | ✅ | ✅ | |
| Content requests (browse/search TMDB, status tracking) | 🚧 | 🚧 | Not currently accessible in either Android app |
| Content requests (browse/search TMDB, status tracking) | ✅ | ✅ | Four-step status track, My Requests, admin approvals; see Requests above |
| Release calendar | ✅ | ✅ | |
| Notifications inbox (paginated, realtime updates, mark-read) | ✅ | ✅ | REST + WebSocket |

Expand All @@ -153,6 +153,6 @@ File pointers are repository-relative.

**TV** is a 10-foot, D-pad client focused on browsing and playback, including audiobooks, calendar, the subtitle suite, person detail, and system Watch Next integration. It intentionally omits ebooks/reading and downloads management.

**Not currently exposed on either Android surface:** full admin management (users/sessions/logs/scans) and Watch Together. The admin **stats dashboard** is exposed (Settings → Admin, acting admins only).
**Not currently exposed on either Android surface:** the admin stats dashboard, full admin management (users/sessions/logs/scans), and Watch Together. Request moderation (approve, decline, retry) is the one admin action the Requests screens offer.

Both apps share the same networking, auth, repositories, most ViewModels, and the entire Media3 playback/capability stack.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Built as a Kotlin Multiplatform project: one shared business-logic core, two Jet

> **Status:** WIP (`v0.3.x`). Silo Android is pre-1.0 and some areas remain under active development (see [Roadmap](#roadmap)).
>
> **Current exposure note:** Requests is live on both Android surfaces, gated by the server's `requests_enabled` flag (`/api/v1/requests/status`), and reached from the profile menu and search — matching the Apple clients. Admin surfaces, session management, and Watch Together are not exposed in the Android clients.
> **Current exposure note:** Requests is live on both Android surfaces, gated by the server's `requests_enabled` flag (`/api/v2/requests/status`), and reached from the profile menu and search on phone and from a top-bar tab and search on TV — matching the Apple clients. Admins who can moderate approve, decline, and retry requests there. Other admin surfaces, session management, and Watch Together are not exposed in the Android clients.

---

Expand Down Expand Up @@ -84,7 +84,7 @@ WorkManager-backed downloads of video, audiobooks, and books to public device st
- **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 (profile menu + search). **Not exposed** — admin surfaces, session management, and Watch Together are not reachable app surfaces today.
- **Requests** — live on phone and TV behind the server's `requests_enabled` flag (phone: profile menu + search; TV: top-bar tab + search), with request moderation for admins. **Not exposed** — other admin surfaces, session management, and Watch Together 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 Expand Up @@ -240,7 +240,7 @@ Active design work lives in `docs/superpowers/specs/` with phased plans in `docs
- **Ebook reader enhancements** — in-text search, highlights, and notes, with coordinated server work where the shared contract changes.
- **Admin management (users/sessions/logs/scans), Watch Together** — code/design work exists, but these are not currently exposed to users in the Android apps and need product/navigation decisions before being treated as live features.

Known gaps the docs track: TV has no reader/ebooks and no downloads management by design; admin surfaces, session management, and Watch Together are not accessible on either Android surface today.
Known gaps the docs track: TV has no reader/ebooks and no downloads management by design; admin surfaces other than request moderation, session management, and Watch Together are not accessible on either Android surface today.

---

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package org.siloserver.silo.common.requests

import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberUpdatedState
import org.siloserver.silo.model.request.MediaRequest
import org.siloserver.silo.model.request.RequestMediaResult
import org.siloserver.silo.model.request.libraryItemToOpen
import org.siloserver.silo.repository.RequestDetailCache
import org.siloserver.silo.repository.RequestsRepository
import org.siloserver.silo.repository.cacheKey

/**
* The standard taps on request cards and rows, on phone and TV: a title that
* reads "In library" opens the library item; anything else opens the request
* detail, seeded with what the tapped card already knows so the page is
* complete on its first frame. Only an approval queue opens a page pinned to
* one request; every other way in opens an ordinary page.
*/
class RequestRouter internal constructor(
private val repository: RequestsRepository,
private val openLibraryItem: () -> (String) -> Unit,
private val openRequestDetail: () -> (mediaType: String, tmdbId: Int) -> Unit,
) {
fun openResult(result: RequestMediaResult) {
repository.cache.seed(result)
repository.cache.unpinModeration(RequestDetailCache.Key(result.mediaType, result.tmdbId))
result.libraryItemToOpen()?.let { openLibraryItem()(it) } ?: openRequestDetail()(result.mediaType, result.tmdbId)
}

fun openRecord(record: MediaRequest) {
repository.cache.unpinModeration(record.cacheKey())
record.libraryItemToOpen()?.let { openLibraryItem()(it) } ?: openRequestDetail()(record.mediaType, record.tmdbId)
}

/** Opens someone else's request from an approval queue: the page decides on that exact request. */
fun openModerationRecord(record: MediaRequest) {
repository.cache.pinModeration(record)
openRequestDetail()(record.mediaType, record.tmdbId)
}
}

@Composable
fun rememberRequestRouter(
repository: RequestsRepository,
onLibraryItemClick: (String) -> Unit,
onRequestDetailClick: (mediaType: String, tmdbId: Int) -> Unit,
): RequestRouter {
val library = rememberUpdatedState(onLibraryItemClick)
val detail = rememberUpdatedState(onRequestDetailClick)
return remember(repository) { RequestRouter(repository, { library.value }, { detail.value }) }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
package org.siloserver.silo.common.requests

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.semantics.contentDescription
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import java.time.Instant
import java.time.ZoneId
import java.time.format.DateTimeFormatter
import java.util.Locale
import org.siloserver.silo.model.request.MediaRequest
import org.siloserver.silo.model.request.RequestDisplayState
import org.siloserver.silo.model.request.RequestMediaType
import org.siloserver.silo.model.request.RequestProgress
import org.siloserver.silo.model.request.RequestStatusTint
import org.siloserver.silo.model.request.RequestStep
import org.siloserver.silo.model.request.RequestTargetSummary
import org.siloserver.silo.model.request.requestReasonCopy

/**
* The request status colors, shared by phone and TV and matching the Apple
* clients. Status text stays monochrome; the dot and the current stage are the
* only chromatic elements.
*/
object RequestColors {
val Amber = Color(0xFFF59E0B)
val Sky = Color(0xFF38BDF8)
val Emerald = Color(0xFF34D399)
val Rose = Color(0xFFFB7185)
}

fun RequestStatusTint.color(neutral: Color): Color = when (this) {
RequestStatusTint.Amber -> RequestColors.Amber
RequestStatusTint.Sky -> RequestColors.Sky
RequestStatusTint.Emerald -> RequestColors.Emerald
RequestStatusTint.Rose -> RequestColors.Rose
RequestStatusTint.Neutral -> neutral
}

/**
* Four-segment stage track: steps behind the request are solid, the step it's
* on carries the status tint, and the rest stay dim.
*/
@Composable
fun RequestStageTrack(
progress: RequestProgress,
modifier: Modifier = Modifier,
height: Dp = 4.dp,
doneColor: Color = Color(0xFFEDEDED).copy(alpha = 0.82f),
restColor: Color = Color.White.copy(alpha = 0.14f),
) {
Row(
modifier = modifier
.fillMaxWidth()
.semantics { contentDescription = progress.longLabel },
horizontalArrangement = Arrangement.spacedBy(height),
) {
RequestStep.entries.forEach { step ->
val fill = when {
step == progress.currentStep -> progress.tint.color(restColor)
step.ordinal < progress.completedSteps -> doneColor
else -> restColor
}
Box(
modifier = Modifier
.weight(1f)
.height(height)
.background(fill, RoundedCornerShape(50)),
)
}
}
}

/** Row and caption copy shared by the phone list and the TV preview panel. */
object RequestRowCopy {
private val dayFormat = DateTimeFormatter.ofPattern("MMM d", Locale.getDefault())
private val stampFormat = DateTimeFormatter.ofPattern("MMM d 'at' h:mm a", Locale.getDefault())

fun mediaTypeLabel(mediaType: String): String = when (mediaType) {
RequestMediaType.Movie -> "Movie"
RequestMediaType.Series -> "Series"
else -> "Title"
}

/** "Sep 24" for a server timestamp, or null when it can't be read. */
fun day(timestamp: String?): String? = format(timestamp, dayFormat)

/** "Sep 10 at 8:50 AM", for the detail page's step timestamps. */
fun stamp(timestamp: String?): String? = format(timestamp, stampFormat)

/** "Movie · Requested Sep 24", or "Movie · Added Sep 13" once it landed. */
fun meta(record: MediaRequest, progress: RequestProgress): String {
val kind = mediaTypeLabel(record.mediaType)
if (progress.display == RequestDisplayState.InLibrary) {
day(record.completedAt)?.let { return "$kind · Added $it" }
}
return day(record.createdAt)?.let { "$kind · Requested $it" } ?: kind
}

/**
* The status line under the stage track: the long label, plus the
* per-quality summary while in flight or the reason when stuck.
*/
fun status(record: MediaRequest, progress: RequestProgress): String {
val display = progress.display
if (display is RequestDisplayState.NeedsAttention) {
requestReasonCopy(display.reason)?.let { return "${progress.longLabel} · $it" }
}
if (display == RequestDisplayState.OnTheWay) {
RequestTargetSummary.text(record.targets)?.let { return "${progress.longLabel} · $it" }
}
return progress.longLabel
}

/** "Series · 1080p · 4K" for admin rows. */
fun kindAndQuality(record: MediaRequest): String =
listOfNotNull(mediaTypeLabel(record.mediaType), RequestTargetSummary.qualities(record.targets)).joinToString(" · ")

private fun format(timestamp: String?, formatter: DateTimeFormatter): String? {
val value = timestamp?.takeIf { it.isNotBlank() } ?: return null
return runCatching { formatter.format(Instant.parse(value).atZone(ZoneId.systemDefault())) }.getOrNull()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -442,9 +442,12 @@ val androidModule = module {
viewModel { HistoryViewModel(get(), get()) }
viewModel { CollectionsViewModel(get()) }
viewModel { params -> CollectionDetailViewModel(get(), get(), params.get()) }
viewModel { RequestsViewModel(get()) }
viewModel { RequestsViewModel(get(), get()) }
viewModel { RequestSearchViewModel(get()) }
viewModel { MyRequestsViewModel(get()) }
viewModel { params ->
org.siloserver.silo.viewmodel.RequestApprovalsViewModel(get(), loadOnInit = params.getOrNull<Boolean>() ?: true)
}
// Platform supplies "today" and the IANA timezone; the shared ViewModel's
// week math stays deterministic in commonTest (no Clock.System default).
viewModel {
Expand All @@ -461,6 +464,7 @@ val androidModule = module {
repository = get(),
mediaType = args.first,
tmdbId = args.second,
featureStore = get(),
)
}
viewModel { SettingsViewModel(get(), get(), get(), get(), get(), get(), get(), get(), get(), get(), get()) }
Expand Down
Loading
Loading