-
Notifications
You must be signed in to change notification settings - Fork 12
feat(playback): add independent subtitle text opacity and a gray color option #413
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Quick104
merged 12 commits into
Silo-Server:main
from
Joloxx9:feat/subtitle-text-opacity
Sep 30, 2026
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
c235074
feat(playback): add independent subtitle text opacity and a gray colo…
4356b38
fix(playback): keep TV opacity pickers in sync with off-cadence values
8085453
fix(playback): apply subtitle-appearance edits as a transform, not a …
1669810
fix(playback): make subtitle-appearance updates atomic at the store
7604730
Merge remote-tracking branch 'origin/main' into pr-413-review
Quick104 e25120b
chore(settings): re-vendor settings contract at manifest revision 14
Quick104 c409353
fix(playback): gate subtitle text opacity on settings revision 14
Quick104 a931d0b
fix(playback): enqueue subtitle appearance writes in commit order
Quick104 8aed962
fix(playback): close the keyboard when a subtitle percentage is done
Quick104 45fc7f1
fix(settings): drop a revision probe answered by a different server
Quick104 45fd38d
fix(tv): start text opacity pickers at a readable value
Quick104 2f76d5f
chore(settings): point the vendored contract at its merged server commit
Quick104 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
...ed/src/androidMain/kotlin/org/siloserver/silo/common/settings/SettingsContractRevision.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| package org.siloserver.silo.common.settings | ||
|
|
||
| import org.siloserver.silo.model.settings.SettingsContractCapabilities | ||
| import org.siloserver.silo.network.ApiResult | ||
| import kotlinx.coroutines.flow.MutableStateFlow | ||
| import kotlinx.coroutines.flow.StateFlow | ||
| import kotlinx.coroutines.flow.asStateFlow | ||
| import kotlinx.coroutines.sync.Mutex | ||
| import kotlinx.coroutines.sync.withLock | ||
|
|
||
| /** | ||
| * The settings manifest revision of the connected server, read from the | ||
| * contract capabilities endpoint and cached per server URL. | ||
| * | ||
| * The settings flusher asks for it before sending a write whose shape depends | ||
| * on the revision, and the settings UI hides controls the server would | ||
| * discard. Both share one instance so they agree on what the server supports. | ||
| */ | ||
| class SettingsContractRevision( | ||
| private val fetchCapabilities: suspend () -> ApiResult<SettingsContractCapabilities>, | ||
| /** The server requests currently address; null when it cannot be read. */ | ||
| private val getServerUrl: suspend () -> String? = { null }, | ||
| ) { | ||
| data class Known(val serverUrl: String, val manifestRevision: Int) | ||
|
|
||
| private val mutex = Mutex() | ||
| private val _known = MutableStateFlow<Known?>(null) | ||
|
|
||
| /** The last revision a probe answered, with the server that answered it. */ | ||
| val known: StateFlow<Known?> = _known.asStateFlow() | ||
|
|
||
| /** | ||
| * The cached revision for [serverUrl], probing when none is cached. | ||
| * Null means unknown: the probe failed, or [serverUrl] is not the server | ||
| * requests would reach, so any answer would describe a different server. | ||
| */ | ||
| suspend fun revisionFor(serverUrl: String): Int? { | ||
| cachedFor(serverUrl)?.let { return it } | ||
| return mutex.withLock { | ||
| cachedFor(serverUrl) ?: probe(serverUrl) | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * Re-read the revision for [serverUrl] even when one is cached, so a | ||
| * server upgraded while the app runs is noticed. A failed probe keeps the | ||
| * cached value. | ||
| */ | ||
| suspend fun refresh(serverUrl: String): Int? = mutex.withLock { | ||
| probe(serverUrl) ?: cachedFor(serverUrl) | ||
| } | ||
|
|
||
| private fun cachedFor(serverUrl: String): Int? = | ||
| _known.value?.takeIf { it.serverUrl == serverUrl }?.manifestRevision | ||
|
|
||
| private suspend fun probe(serverUrl: String): Int? { | ||
| if (!isActive(serverUrl)) return null | ||
| val revision = when (val result = fetchCapabilities()) { | ||
| is ApiResult.Success -> result.data.manifestRevision | ||
| // No capabilities route: the server predates every revision gate. | ||
| is ApiResult.Error -> if (result.code == 404) 0 else null | ||
| is ApiResult.NetworkError -> null | ||
| } ?: return null | ||
| // The request goes to whichever server is active when it is sent, so a | ||
| // switch during the fetch means the answer describes another server. | ||
| if (!isActive(serverUrl)) return null | ||
| _known.value = Known(serverUrl, revision) | ||
| return revision | ||
| } | ||
|
|
||
| private suspend fun isActive(serverUrl: String): Boolean { | ||
| val active = runCatching { getServerUrl() }.getOrNull() | ||
| return active == null || active == serverUrl | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.