Skip to content

Persist audio/subtitle track selections across player exits (web parity) - #50

Merged
Quick104 merged 2 commits into
mainfrom
claude/sleepy-jemison-1b6429
Jul 3, 2026
Merged

Quick104 merged 2 commits into
mainfrom
claude/sleepy-jemison-1b6429

Conversation

@Quick104

@Quick104 Quick104 commented Jul 3, 2026 •

Copy link
Copy Markdown
Contributor

What

Audio and subtitle selections — made on the item detail page or mid-playback — now persist to the server's per-series preference endpoints on iOS, tvOS, and macOS, so they survive exiting the player and revisiting or restarting the video. This matches the web app.

  • New TrackSelectionPersistence (shared): pref-key resolution (episodes key by series id so one pick covers the show; movies by their own content id — the key the server's detail resolver reads movie prefs from), pure request builders, and best-effort fire-and-forget PUT/DELETE writers.
  • In-player changes stick: selectAudio / selectSubtitle / disableSubtitles persist the pick on all three platforms. Offline playback and ephemeral live-AI subtitle tracks are excluded. Signatures are built from the server's own probed metadata (currentSelectedVersion) when possible so re-resolution gets an exact match.
  • Detail-page selector changes stick (iOS ItemDetailView + tvOS TVItemDetailView), including the next-up selectors on season/series pages. Semantics mirror the web: pick → mode always, Off → mode off + index −1, "Auto" → DELETE the override so the library/profile cascade applies again.
  • Model fix: AudioTrack/SubtitleTrack now decode embedded_title / hearing_impaired. The server's signature matcher compares title and embedded_title separately, so omitting them silently broke exact cross-episode track matching.
  • Start-time fix: PlaybackSessionBridge sends preferredAudioTrackIndex ?? selectedVersion.effectiveAudioTrackIndex. /playback/start only consults saved audio prefs for episodes (its series-id lookup is empty for movies), so a movie's remembered audio track was otherwise dropped at session start even though the watch detail had already resolved it.

Why

The read path already existed end-to-end — the server cascades per-series → per-library → profile prefs into effective_* fields that the detail selectors and SubtitleAutoResolver consume — but the Apple clients never wrote anything, so every explicit pick was lost on exit. Version choice needed no work: last-played version hints on watch_progress (written server-side at stop) plus series-level traits already round-trip and are honored by DetailVersionSelection and selectVersion.

Reviewer notes

  • Writes are deliberately best-effort (matching the web's silent-failure pattern): a failed PUT costs a remembered preference, never playback.
  • Wire shapes were verified against silo-server (audio_prefs.go, subtitle_prefs.go, playback.SelectAudioTrack, catalog/detail.go); the subtitle mode derivation matches the web's derivePersistedSubtitleMode.
  • Not yet validated against a live server. Smoke test: pick a track (detail page or in-player), exit, re-open → selector row and next playback should reflect it; for episodes, the pick should carry to other episodes of the same series.

Testing

  • Silo (iOS), SiloTV, SiloMac all build clean.
  • 313 tests pass, including 9 new TrackSelectionPersistenceTests pinning the request builders (index spaces, signature fields, off/auto semantics, external-subtitle path).

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Track selections for audio and subtitles now persist across playback sessions on supported devices.
    • Selection memory now works for both episode and movie detail flows, including “Off” subtitle choices and forced-subtitle handling.
    • Playback now better restores the last chosen audio track when starting a session.
  • Bug Fixes

    • Improved visibility of the now-playing mini bar and control bar during remote-control and reconnect states.
    • Better handling of track metadata so selected audio/subtitle options stay accurate.

Quick104 and others added 2 commits July 2, 2026 23:19
Dismissing the remote sheet flipped isShowingRemoteControl, which
re-attached the tabViewBottomAccessory and triggered the system's
accessory slide-in — a second animation on top of the sheet dismissal.
Keep the bar visible (covered by the sheet) so dismissal just reveals it.

Co-Authored-By: Claude Fable 5 <[email protected]>
Track picks on the detail page and in the player were transient: the
web app writes them to /audio-prefs and /subtitle-prefs (episodes key
by series id, movies by content id) and the server folds them back
into the effective_* fields both clients already read, but the Apple
clients never wrote anything — every selection died with the view.

- New TrackSelectionPersistence: pref key resolution, pure request
  builders (pick → mode "always", off → "off"/index -1, Auto → DELETE
  the override), best-effort fire-and-forget writers.
- PlayerViewModel selectAudio/selectSubtitle/disableSubtitles persist
  the choice; offline playback and live AI tracks are excluded, and
  signatures prefer the server's probed metadata from the selected
  version so re-resolution gets an exact match.
- iOS + tvOS detail selector callbacks persist (movie/episode branch
  and next-up selectors on season/series pages).
- AudioTrack/SubtitleTrack decode embedded_title / hearing_impaired;
  the server's signature matcher compares them separately, so omitting
  them broke exact cross-episode matching.
- PlaybackSessionBridge falls back to the detail-resolved effective
  audio index: /playback/start only consults saved audio prefs for
  episodes, so movie audio prefs were dropped at start otherwise.

Version choice needed no work: last-played hints on watch_progress
(written at stop) and series-level traits already round-trip.

Co-Authored-By: Claude Fable 5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Jul 3, 2026 •

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds server-backed persistence of user audio/subtitle track selections via a new TrackSelectionPersistence networking layer, wires it into PlayerViewModel and detail views (phone and tvOS), extends track models with embeddedTitle/hearingImpaired fields, adjusts iOS control-bar visibility logic, and adds an audio index fallback in playback session start.

Changes

Track Selection Persistence

Layer / File(s) Summary
Track model metadata
iosApp/iosApp/Networking/Models.swift
AudioTrack and SubtitleTrack gain embeddedTitle (and hearingImpaired for subtitles) fields with matching CodingKeys.
Persistence core & tests
iosApp/iosApp/Networking/TrackSelectionPersistence.swift, iosApp/Tests/TrackSelectionPersistenceTests.swift
New TrackSelectionPersistence builds audio/subtitle preference requests from server metadata or PlayerTrack, computes prefKey, and provides fire-and-forget save/clear calls against ContinuumAPI; unit tests cover key precedence, request building, and edge cases.
PlayerViewModel wiring
iosApp/iosApp/Screens/Player/PlayerViewModel.swift
Adds trackPrefPersistKey and calls persistAudioSelection/persistSubtitleSelection on explicit audio/subtitle selection or disabling.
Phone detail view wiring
iosApp/iosApp/Screens/Detail/ItemDetailView.swift
Adds prefKey/persistAudioSelection/persistSubtitleSelection helpers and wires them into season/series next-up and movie track selection handlers.
tvOS detail view wiring
iosApp/iosApp/tvOS/Screens/Detail/TVItemDetailView.swift
Adds equivalent persistence helpers and wires them into season/series next-up and movie track selection handlers.
Playback session audio fallback
iosApp/iosApp/Screens/Player/PlaybackSessionBridge.swift
startSession falls back to selectedVersion.effectiveAudioTrackIndex when no explicit audio track index is provided.

iOS Control Bar Visibility

Layer / File(s) Summary
Mini bar/shelf visibility logic
iosApp/iosApp/Control/iOS/NowPlayingShelf.swift, iosApp/iosApp/Control/iOS/SiloControlMiniBar.swift
Removes the isShowingRemoteControl-based hidden override from control-bar/mini-bar visibility, basing visibility solely on active-session/reconnect state, and removes a related animation trigger.

Estimated code review effort: 3 (Moderate) | ~30 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant PlayerViewModel
  participant TrackSelectionPersistence
  participant ContinuumAPI

  User->>PlayerViewModel: select audio/subtitle track
  PlayerViewModel->>PlayerViewModel: compute trackPrefPersistKey
  alt server-backed item
    PlayerViewModel->>TrackSelectionPersistence: persistAudioSelection / persistSubtitleSelection
    TrackSelectionPersistence->>ContinuumAPI: PUT or DELETE preference
    ContinuumAPI-->>TrackSelectionPersistence: success or error
    TrackSelectionPersistence-->>PlayerViewModel: warning logged on failure
  else offline playback
    PlayerViewModel-->>PlayerViewModel: no-op (nil pref key)
  end
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: persisting audio and subtitle track selections across exits with web parity.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/sleepy-jemison-1b6429

Comment @coderabbitai help to get the list of available commands.

@Quick104
Quick104 merged commit afa817d into main Jul 3, 2026
1 check was pending
@Quick104
Quick104 deleted the claude/sleepy-jemison-1b6429 branch July 3, 2026 04:24

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 11ab974ff7

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

) {
guard let prefKey else { return }
guard let requested else {
TrackSelectionPersistence.clearAudio(prefKey: prefKey)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Await Auto clears before starting playback

When a user selects Auto for audio on the detail page and immediately taps Play, this unawaited DELETE can race with PlaybackSessionBridge.startSession: the next /watch fetch may still include the old per-series audio override, and the new bridge code then passes that stale selectedVersion.effectiveAudioTrackIndex explicitly to /playback/start. The UI has switched to Auto, but the old audio track can still start; the clear needs to complete or be carried as an explicit inherit sentinel for that start.

Useful? React with 👍 / 👎.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (2)
iosApp/iosApp/Control/iOS/NowPlayingShelf.swift (1)

23-29: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Duplicate visibility formula across two files.

This formula (control.hasActiveSession && !control.isAutoResuming) || control.isReconnecting is now duplicated verbatim in SiloControlMiniBar.isVisible (iosApp/iosApp/Control/iOS/SiloControlMiniBar.swift, lines 21-23). Consider extracting a shared computed property (e.g., on SiloControlClient) to prevent the two copies from silently drifting apart in future edits.

♻️ Proposed consolidation
// SiloControlClient.swift
+    var isMiniBarVisible: Bool {
+        (hasActiveSession && !isAutoResuming) || isReconnecting
+    }
// NowPlayingShelf.swift
-    static func controlBarVisible(_ control: SiloControlClient) -> Bool {
-        (control.hasActiveSession && !control.isAutoResuming) || control.isReconnecting
-    }
+    static func controlBarVisible(_ control: SiloControlClient) -> Bool {
+        control.isMiniBarVisible
+    }
// SiloControlMiniBar.swift
-    private var isVisible: Bool {
-        (controller.hasActiveSession && !controller.isAutoResuming) || controller.isReconnecting
-    }
+    private var isVisible: Bool {
+        controller.isMiniBarVisible
+    }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@iosApp/iosApp/Control/iOS/NowPlayingShelf.swift` around lines 23 - 29, The
visibility check is duplicated between NowPlayingShelf.controlBarVisible and
SiloControlMiniBar.isVisible, so extract the shared formula into a single
computed property on SiloControlClient (or another shared helper) and update
both call sites to use it. Keep the existing logic exactly the same while
removing the verbatim copy so future changes only need to be made in one place.
iosApp/iosApp/Screens/Detail/ItemDetailView.swift (1)

626-680: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Duplicate persistence helpers across ItemDetailView and TVItemDetailView.

prefKey(for:), persistAudioSelection(prefKey:version:requested:sanitized:), and persistSubtitleSelection(...) here are near-identical to the ones added in TVItemDetailView.swift (Lines 512-554). Consider hoisting this shared "requested == sanitized → persist, nil → clear" logic into TrackSelectionPersistence as static helpers, called from both detail views. This would also have prevented the showForced inconsistency flagged in TVItemDetailView.swift.

♻️ Proposed consolidation sketch (in TrackSelectionPersistence.swift)
extension TrackSelectionPersistence {
    static func persistAudioSelection(prefKey: String?, version: FileVersion?, requested: Int?, sanitized: Int?) {
        guard let prefKey else { return }
        guard let requested else {
            clearAudio(prefKey: prefKey)
            return
        }
        guard requested == sanitized, let version,
              let request = audioRequest(version: version, ordinal: requested)
        else { return }
        saveAudio(prefKey: prefKey, request: request)
    }

    static func persistSubtitleSelection(prefKey: String?, version: FileVersion?, requested: Int?, sanitized: Int?, showForced: Bool?) {
        guard let prefKey else { return }
        guard let requested else {
            clearSubtitle(prefKey: prefKey)
            return
        }
        guard requested == sanitized, let version,
              let request = subtitleRequest(version: version, ffIndex: requested, showForced: showForced)
        else { return }
        saveSubtitle(prefKey: prefKey, request: request)
    }
}

Both detail views would then just call TrackSelectionPersistence.persistAudioSelection(...) / persistSubtitleSelection(...), dropping their local private copies.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@iosApp/iosApp/Screens/Detail/ItemDetailView.swift` around lines 626 - 680,
Duplicate track-selection persistence logic is still defined locally in
ItemDetailView via prefKey(for:),
persistAudioSelection(prefKey:version:requested:sanitized:), and
persistSubtitleSelection(...), even though the same “requested == sanitized
persist, nil clear” behavior belongs in TrackSelectionPersistence. Move this
shared logic into static helpers on TrackSelectionPersistence and update both
ItemDetailView and TVItemDetailView to call those helpers, so the persistence
behavior stays consistent and the showForced handling remains centralized.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@iosApp/iosApp/Networking/TrackSelectionPersistence.swift`:
- Around line 156-211: The fire-and-forget writers in TrackSelectionPersistence
can race when saveAudio, saveSubtitle, clearAudio, and clearSubtitle are called
back-to-back for the same prefKey, allowing an older network response to
overwrite a newer track choice. Add per-prefKey serialization in these helpers,
such as tracking the in-flight Task or a generation/token per key and canceling
or ignoring stale work before starting the next ContinuumAPI.shared request.
Make the fix around the existing saveAudio/saveSubtitle/clearAudio/clearSubtitle
methods so each prefKey only persists the latest selection.

In `@iosApp/iosApp/tvOS/Screens/Detail/TVItemDetailView.swift`:
- Around line 154-173: The next-up subtitle save in TVItemDetailView is dropping
the forced-subtitle preference by passing a nil value. Update the
onSelectNextUpSubtitleTrack flow to thread the existing
effectiveShowForcedSubtitles value into persistSubtitleSelection, using the same
prefKey(for:), effectiveVersion(for:versionFileId:), and
sanitizedSubtitleTrackIndex path so the saved subtitle choice matches iOS
behavior.

---

Nitpick comments:
In `@iosApp/iosApp/Control/iOS/NowPlayingShelf.swift`:
- Around line 23-29: The visibility check is duplicated between
NowPlayingShelf.controlBarVisible and SiloControlMiniBar.isVisible, so extract
the shared formula into a single computed property on SiloControlClient (or
another shared helper) and update both call sites to use it. Keep the existing
logic exactly the same while removing the verbatim copy so future changes only
need to be made in one place.

In `@iosApp/iosApp/Screens/Detail/ItemDetailView.swift`:
- Around line 626-680: Duplicate track-selection persistence logic is still
defined locally in ItemDetailView via prefKey(for:),
persistAudioSelection(prefKey:version:requested:sanitized:), and
persistSubtitleSelection(...), even though the same “requested == sanitized
persist, nil clear” behavior belongs in TrackSelectionPersistence. Move this
shared logic into static helpers on TrackSelectionPersistence and update both
ItemDetailView and TVItemDetailView to call those helpers, so the persistence
behavior stays consistent and the showForced handling remains centralized.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 4de0d08e-6b85-41f7-be28-488cbcc28585

📥 Commits

Reviewing files that changed from the base of the PR and between b74da5a and 11ab974.

📒 Files selected for processing (9)
  • iosApp/Tests/TrackSelectionPersistenceTests.swift
  • iosApp/iosApp/Control/iOS/NowPlayingShelf.swift
  • iosApp/iosApp/Control/iOS/SiloControlMiniBar.swift
  • iosApp/iosApp/Networking/Models.swift
  • iosApp/iosApp/Networking/TrackSelectionPersistence.swift
  • iosApp/iosApp/Screens/Detail/ItemDetailView.swift
  • iosApp/iosApp/Screens/Player/PlaybackSessionBridge.swift
  • iosApp/iosApp/Screens/Player/PlayerViewModel.swift
  • iosApp/iosApp/tvOS/Screens/Detail/TVItemDetailView.swift

Comment on lines +156 to +211
// MARK: - Fire-and-forget writers

static func saveAudio(prefKey: String, request: AudioPrefRequest) {
Task {
do {
try await ContinuumAPI.shared.setAudioPref(seriesId: prefKey, body: request)
} catch {
logger.warning(
"audio pref save failed key=\(prefKey, privacy: .public): \(String(describing: error), privacy: .public)"
)
}
}
}

static func saveSubtitle(prefKey: String, request: SubtitlePrefRequest) {
Task {
do {
try await ContinuumAPI.shared.setSubtitlePref(seriesId: prefKey, body: request)
} catch {
logger.warning(
"subtitle pref save failed key=\(prefKey, privacy: .public): \(String(describing: error), privacy: .public)"
)
}
}
}

/// The detail selectors' "Auto" choice — remove the sticky override
/// so the library/profile cascade applies again. A 404 just means
/// no override existed.
static func clearAudio(prefKey: String) {
Task {
do {
try await ContinuumAPI.shared.deleteAudioPref(seriesId: prefKey)
} catch HTTPError.http(let code, _) where code == 404 {
// Nothing to clear.
} catch {
logger.warning(
"audio pref clear failed key=\(prefKey, privacy: .public): \(String(describing: error), privacy: .public)"
)
}
}
}

static func clearSubtitle(prefKey: String) {
Task {
do {
try await ContinuumAPI.shared.deleteSubtitlePref(seriesId: prefKey)
} catch HTTPError.http(let code, _) where code == 404 {
// Nothing to clear.
} catch {
logger.warning(
"subtitle pref clear failed key=\(prefKey, privacy: .public): \(String(describing: error), privacy: .public)"
)
}
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect the target file around the reported lines
FILE="iosApp/iosApp/Networking/TrackSelectionPersistence.swift"
wc -l "$FILE"
sed -n '1,260p' "$FILE" | cat -n | sed -n '130,240p'

# Find call sites and related coordination logic
rg -n "saveAudio\(|saveSubtitle\(|clearAudio\(|clearSubtitle\(" iosApp/iosApp
rg -n "TrackSelectionPersistence|prefKey|AudioPrefRequest|SubtitlePrefRequest|deboun|seriali|Task\s*\{" iosApp/iosApp

Repository: Silo-Server/silo-apple

Length of output: 50378


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect the exact call sites for track-selection persistence
sed -n '4260,4325p' iosApp/iosApp/Screens/Player/PlayerViewModel.swift | cat -n
sed -n '635,685p' iosApp/iosApp/Screens/Detail/ItemDetailView.swift | cat -n
sed -n '515,560p' iosApp/iosApp/tvOS/Screens/Detail/TVItemDetailView.swift | cat -n

# Look for any dedicated serialization/cancellation around track-selection writes
rg -n "TrackSelectionPersistence|inFlight|cancel\(\)|debounce|prefKey" iosApp/iosApp/Networking iosApp/iosApp/Screens/Player iosApp/iosApp/Screens/Detail iosApp/iosApp/tvOS/Screens/Detail

Repository: Silo-Server/silo-apple

Length of output: 36064


Serialize track-selection writes per prefKey. These helpers are called directly from the player/detail selection handlers, so back-to-back audio/subtitle changes can issue overlapping PUT/DELETE requests and let an older response overwrite the newer choice. A per-key cancel/replace task or generation check would prevent stale preferences from being persisted.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@iosApp/iosApp/Networking/TrackSelectionPersistence.swift` around lines 156 -
211, The fire-and-forget writers in TrackSelectionPersistence can race when
saveAudio, saveSubtitle, clearAudio, and clearSubtitle are called back-to-back
for the same prefKey, allowing an older network response to overwrite a newer
track choice. Add per-prefKey serialization in these helpers, such as tracking
the in-flight Task or a generation/token per key and canceling or ignoring stale
work before starting the next ContinuumAPI.shared request. Make the fix around
the existing saveAudio/saveSubtitle/clearAudio/clearSubtitle methods so each
prefKey only persists the latest selection.

Comment on lines +154 to +173
persistAudioSelection(
prefKey: prefKey(for: nextUpPlaybackDetail),
version: effectiveVersion(for: nextUpPlaybackDetail, versionFileId: preferredNextUpFileId),
requested: index,
sanitized: preferredNextUpAudioTrackIndex
)
},
onSelectNextUpSubtitleTrack: { index in
preferredNextUpSubtitleTrackIndex = sanitizedSubtitleTrackIndex(
for: nextUpPlaybackDetail,
versionFileId: preferredNextUpFileId,
candidate: index
)
persistSubtitleSelection(
prefKey: prefKey(for: nextUpPlaybackDetail),
version: effectiveVersion(for: nextUpPlaybackDetail, versionFileId: preferredNextUpFileId),
requested: index,
sanitized: preferredNextUpSubtitleTrackIndex,
showForced: nil
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Confirm whether WatchDetail carries a forced-subtitles field that could be
# threaded through ItemDetail via enrichPlaybackMetadata, or whether ItemDetail
# genuinely has no equivalent.
rg -n "effectiveShowForcedSubtitles" --type=swift -C3
rg -n "struct WatchDetail" --type=swift -A30
rg -n "struct ItemDetail" --type=swift -A40

Repository: Silo-Server/silo-apple

Length of output: 160


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== Relevant Swift files =="
fd -a 'TVItemDetailView.swift|ItemDetailView.swift|WatchDetail|ItemDetail' iosApp/iosApp -t f

echo
echo "== Outline tvOS detail view =="
ast-grep outline iosApp/iosApp/tvOS/Screens/Detail/TVItemDetailView.swift --view expanded || true

echo
echo "== Outline iOS detail view =="
ast-grep outline iosApp/iosApp/Screens/Detail/ItemDetailView.swift --view expanded || true

echo
echo "== Search for forced-subtitle related identifiers =="
rg -n "showForced|forced subtitle|forcedSubtitles|effectiveShowForced" iosApp/iosApp -g '*.swift' -C 2 || true

Repository: Silo-Server/silo-apple

Length of output: 33211


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== Detail view files =="
git ls-files 'iosApp/iosApp/**/Detail/*View.swift' 'iosApp/iosApp/**/Detail/**/*.swift' | sed -n '1,200p'

echo
echo "== tvOS detail view excerpts =="
rg -n "onSelectNextUpSubtitleTrack|persistSubtitleSelection|nextUpPlaybackDetail|nextUpWatchDetail|showForced" iosApp/iosApp/tvOS/Screens/Detail/TVItemDetailView.swift -n -C 4 || true

echo
echo "== iOS detail view excerpts =="
rg -n "onSelectNextUpSubtitleTrack|persistSubtitleSelection|nextUpPlaybackDetail|nextUpWatchDetail|showForced" iosApp/iosApp/Screens/Detail/ItemDetailView.swift -n -C 4 || true

echo
echo "== model / helper excerpts =="
rg -n "func persistSubtitleSelection|struct ItemDetail|struct WatchDetail|effectiveShowForcedSubtitles|enrichPlaybackMetadata" iosApp/iosApp -g '*.swift' -C 4 || true

Repository: Silo-Server/silo-apple

Length of output: 39256


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== persistSubtitleSelection definition and callsites =="
rg -n "func persistSubtitleSelection|persistSubtitleSelection\(" iosApp/iosApp -g '*.swift' -C 5 || true

echo
echo "== subtitle selection related definitions =="
rg -n "showForced|forced subtitle|subtitleTrack" iosApp/iosApp -g '*.swift' -C 3 || true

Repository: Silo-Server/silo-apple

Length of output: 50379


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== TrackSelectionPersistence subtitle helpers =="
sed -n '1,220p' iosApp/iosApp/Networking/TrackSelectionPersistence.swift

echo
echo "== tvOS enrichPlaybackMetadata =="
sed -n '652,700p' iosApp/iosApp/tvOS/Screens/Detail/TVItemDetailView.swift

echo
echo "== ItemDetail / WatchDetail fields around forced subtitles =="
sed -n '344,430p' iosApp/iosApp/Networking/Models.swift
echo
sed -n '974,1020p' iosApp/iosApp/Networking/Models.swift

Repository: Silo-Server/silo-apple

Length of output: 16472


Pass effectiveShowForcedSubtitles into tvOS next-up subtitle saves

showForced: nil drops the user’s forced-subtitle preference from the write, so the next-up selection can’t preserve that setting. Thread the flag through from the watch detail here to match iOS behavior.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@iosApp/iosApp/tvOS/Screens/Detail/TVItemDetailView.swift` around lines 154 -
173, The next-up subtitle save in TVItemDetailView is dropping the
forced-subtitle preference by passing a nil value. Update the
onSelectNextUpSubtitleTrack flow to thread the existing
effectiveShowForcedSubtitles value into persistSubtitleSelection, using the same
prefKey(for:), effectiveVersion(for:versionFileId:), and
sanitizedSubtitleTrackIndex path so the saved subtitle choice matches iOS
behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant