Add dev/production update channels, clearer Euchre table, bolder Sequence highlight
Update channels - ci.yml now publishes each green push to dev as a prerelease tagged v1.0.<n>-dev, so the dev channel has something to install. Workflow artifacts could not serve this: downloading one needs authentication, which the app does not have. - Prereleases specifically, because GitHub's "latest release" endpoint skips them — a production install can never be handed a dev build. Pull requests build and check but never publish. - Settings gains a channel picker. The two channels are numbered by separate workflow run counters, so versions are only compared within a channel; the app reads the -dev suffix in its own versionName to know where it stands, and treats a channel change as an explicit switch. The screen warns that such a switch can be a downgrade Android will refuse. - PLG_RELEASE becomes PLG_CHANNEL, naming the channel rather than a flag. Euchre - Cards in a trick now sit on the side of the table belonging to whoever played them, rotated to face them, labelled You / Left / Partner / Right. Previously they were a flat row tagged with seat numbers, which made it hard to tell who had played what. - Bidding says what it will actually do. As dealer the button reads "Pick it up" rather than "Order up", since the turn card comes to your hand, and a line of explanatory text spells out the consequence either way. Sequence - Playable squares get a much heavier outline, scaled off cell size and in a fixed amber that reads against a white card, a green corner and a chip alike. The old 2dp theme-coloured border was hard to see. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_015qjfMiPUDshdKEUa6vxqzN
This commit is contained in:
@@ -10,6 +10,7 @@ import androidx.datastore.preferences.core.stringPreferencesKey
|
||||
import androidx.datastore.preferences.preferencesDataStore
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.map
|
||||
import org.prolibertate.games.update.UpdateChannel
|
||||
|
||||
private val Context.dataStore: DataStore<Preferences> by preferencesDataStore(name = "settings")
|
||||
|
||||
@@ -25,6 +26,8 @@ data class Settings(
|
||||
val animationSpeed: Float = 1.0f,
|
||||
val checkForUpdatesOnLaunch: Boolean = true,
|
||||
val playerName: String = "Player",
|
||||
/** Which builds the updater offers. Production unless deliberately changed. */
|
||||
val updateChannel: UpdateChannel = UpdateChannel.PRODUCTION,
|
||||
) {
|
||||
/** Scales a nominal duration by the chosen speed. */
|
||||
fun scaled(millis: Long): Long =
|
||||
@@ -43,6 +46,7 @@ class SettingsRepository(private val context: Context) {
|
||||
val SPEED = floatPreferencesKey("animation_speed")
|
||||
val UPDATE_ON_LAUNCH = booleanPreferencesKey("check_updates_on_launch")
|
||||
val NAME = stringPreferencesKey("player_name")
|
||||
val CHANNEL = stringPreferencesKey("update_channel")
|
||||
}
|
||||
|
||||
val settings: Flow<Settings> = context.dataStore.data.map { prefs ->
|
||||
@@ -51,9 +55,16 @@ class SettingsRepository(private val context: Context) {
|
||||
animationSpeed = prefs[Keys.SPEED] ?: 1.0f,
|
||||
checkForUpdatesOnLaunch = prefs[Keys.UPDATE_ON_LAUNCH] ?: true,
|
||||
playerName = prefs[Keys.NAME] ?: "Player",
|
||||
updateChannel = prefs[Keys.CHANNEL]
|
||||
?.let { stored -> runCatching { UpdateChannel.valueOf(stored) }.getOrNull() }
|
||||
?: UpdateChannel.PRODUCTION,
|
||||
)
|
||||
}
|
||||
|
||||
suspend fun setUpdateChannel(channel: UpdateChannel) {
|
||||
context.dataStore.edit { it[Keys.CHANNEL] = channel.name }
|
||||
}
|
||||
|
||||
suspend fun setSoundEnabled(enabled: Boolean) {
|
||||
context.dataStore.edit { it[Keys.SOUND] = enabled }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user