Release 1.0.48

- Keep the vibration switch only in Settings > Sound, with a short subtitle
- Remove the connection log and network counters from the Permissions screen
- Add Material Symbols icons to the Board appearance options
- Bump version to 1.0.48 (6) and add changelogs mentioning the Gitea mirror
This commit is contained in:
2026-11-08 11:05:25 +02:00
parent 74ae8458d1
commit f8fce1675f
23 changed files with 97 additions and 189 deletions
@@ -24,7 +24,6 @@ data class NetworkEvent(
val text: String
)
/** In-memory connection log, copied into the diagnostics report from Settings. */
object NetworkLog {
private const val CAPACITY = 60
@@ -42,11 +41,4 @@ object NetworkLog {
_lastReason.value = reason
log(transport, reason.userText + (detail?.let { ": $it" } ?: ""))
}
fun asText(): String {
val format = java.text.SimpleDateFormat("HH:mm:ss", java.util.Locale.getDefault())
return _events.value.joinToString("\n") { e ->
"${format.format(java.util.Date(e.at))} [${e.transport}] ${e.text}"
}
}
}
@@ -37,22 +37,4 @@ object NetworkMetrics {
fun duplicateChunk() { duplicateChunks.incrementAndGet() }
fun messageCorrupted() { corruptedMessages.incrementAndGet(); touch() }
fun messageDropped() { messagesDropped.incrementAndGet(); touch() }
private fun retryPercent(): Int {
val sent = chunksSent.get()
if (sent == 0L) return 0
return ((chunkRetries.get() * 100) / sent).toInt()
}
fun asText(res: android.content.res.Resources): String = buildString {
appendLine(res.getString(cc.skysparkle.matewave.R.string.metrics_connect_attempts,
connectAttempts.get(), connectSuccesses.get()))
val last = lastConnectMillis.get()
if (last > 0) appendLine(res.getString(cc.skysparkle.matewave.R.string.metrics_last_connect, last))
appendLine(res.getString(cc.skysparkle.matewave.R.string.metrics_chunks,
chunksSent.get(), chunkRetries.get(), retryPercent()))
appendLine(res.getString(cc.skysparkle.matewave.R.string.metrics_duplicates, duplicateChunks.get()))
appendLine(res.getString(cc.skysparkle.matewave.R.string.metrics_corrupted, corruptedMessages.get()))
appendLine(res.getString(cc.skysparkle.matewave.R.string.metrics_dropped, messagesDropped.get()))
}
}
@@ -85,30 +85,35 @@ fun AppearanceScreen(onBack: () -> Unit) {
}
AppearanceToggle(
icon = R.drawable.ic_coordinates,
title = stringResource(R.string.appearance_coordinates),
subtitle = stringResource(R.string.appearance_coordinates_hint),
checked = coords
) { coords = it; appearance.showCoordinates = it }
AppearanceToggle(
icon = R.drawable.ic_image_pieces,
title = stringResource(R.string.appearance_image_pieces),
subtitle = stringResource(R.string.appearance_image_pieces_hint),
checked = images
) { images = it; appearance.useImagePieces = it }
AppearanceToggle(
icon = R.drawable.ic_last_move,
title = stringResource(R.string.appearance_last_move),
subtitle = stringResource(R.string.appearance_last_move_hint),
checked = lastMove
) { lastMove = it; appearance.showLastMove = it }
AppearanceToggle(
icon = R.drawable.ic_check_alert,
title = stringResource(R.string.appearance_check),
subtitle = stringResource(R.string.appearance_check_hint),
checked = checkGlow
) { checkGlow = it; appearance.showCheckHighlight = it }
AppearanceToggle(
icon = R.drawable.ic_move_list,
title = stringResource(R.string.appearance_opening_in_game),
subtitle = stringResource(R.string.appearance_opening_in_game_hint),
checked = openingBar
@@ -160,6 +165,7 @@ private fun ThemePreview(theme: BoardTheme, showPieces: Boolean) {
@Composable
private fun AppearanceToggle(
icon: Int,
title: String,
subtitle: String,
checked: Boolean,
@@ -167,6 +173,7 @@ private fun AppearanceToggle(
) {
GlassCard(modifier = Modifier.fillMaxWidth()) {
Row(verticalAlignment = Alignment.CenterVertically) {
cc.skysparkle.matewave.ui.components.ButtonIcon(icon, size = 24.dp)
Column(modifier = Modifier.weight(1f)) {
Text(title, color = ink, style = MaterialTheme.typography.titleMedium)
Text(subtitle, color = ink.copy(alpha = 0.7f), style = MaterialTheme.typography.bodySmall)
@@ -12,7 +12,6 @@ import androidx.compose.material3.SwitchDefaults
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
@@ -26,10 +25,7 @@ import androidx.compose.ui.unit.dp
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.height
import cc.skysparkle.matewave.R
import cc.skysparkle.matewave.settings.FeedbackSettings
import cc.skysparkle.matewave.network.AppPermissions
import cc.skysparkle.matewave.network.DisconnectReason
import cc.skysparkle.matewave.network.NetworkLog
import cc.skysparkle.matewave.network.NetworkRequirements
import cc.skysparkle.matewave.ui.components.GlassCard
import cc.skysparkle.matewave.ui.components.GlassOutlinedButton
@@ -95,37 +91,6 @@ fun PermissionsScreen(onBack: () -> Unit) {
}
}
val feedbackSettings = remember { FeedbackSettings(context) }
var vibration by remember { mutableStateOf(feedbackSettings.vibrationEnabled) }
GlassCard(modifier = Modifier.fillMaxWidth()) {
Row(verticalAlignment = Alignment.CenterVertically) {
cc.skysparkle.matewave.ui.components.ButtonIcon(R.drawable.ic_vibration, size = 24.dp)
Column(modifier = Modifier.weight(1f)) {
Text(
stringResource(R.string.perm_vibration_title),
color = ink,
style = MaterialTheme.typography.titleMedium
)
Text(
stringResource(R.string.perm_vibration_text),
color = ink.copy(alpha = 0.7f),
style = MaterialTheme.typography.bodySmall
)
}
Switch(
checked = vibration,
onCheckedChange = {
vibration = it
feedbackSettings.vibrationEnabled = it
},
colors = SwitchDefaults.colors(
checkedThumbColor = Color.White,
checkedTrackColor = Color(0xFF4F8A5B)
)
)
}
}
var background by remember { mutableStateOf(presenceSettings.backgroundEnabled) }
val requestNotifications = rememberPermissionRequester(
permissions = if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.TIRAMISU) {
@@ -214,53 +179,6 @@ fun PermissionsScreen(onBack: () -> Unit) {
}
}
}
val lastReason by NetworkLog.lastReason.collectAsState()
if (lastReason != DisconnectReason.NONE) {
Row(verticalAlignment = Alignment.CenterVertically) {
cc.skysparkle.matewave.ui.components.ButtonIcon(
R.drawable.ic_error, tint = Color(0xFFFFC46B), size = 16.dp
)
Text(
stringResource(R.string.diag_last_reason, stringResource(lastReason.textRes)),
color = Color(0xFFFFC46B),
style = MaterialTheme.typography.bodySmall,
modifier = Modifier.weight(1f)
)
}
}
val metricsTick by cc.skysparkle.matewave.network.NetworkMetrics.updated.collectAsState()
val metricsText = remember(metricsTick) {
cc.skysparkle.matewave.network.NetworkMetrics.asText(context.resources)
}
Text(
metricsText.trim(),
color = ink.copy(alpha = 0.7f),
style = MaterialTheme.typography.bodySmall
)
GlassOutlinedButton(
onClick = {
val clipboard = context.getSystemService(android.content.Context.CLIPBOARD_SERVICE)
as android.content.ClipboardManager
val report = buildString {
appendLine(context.getString(R.string.diag_report_counters))
append(cc.skysparkle.matewave.network.NetworkMetrics.asText(context.resources))
appendLine()
appendLine(context.getString(R.string.diag_report_events))
append(NetworkLog.asText().ifBlank { context.getString(R.string.diag_log_empty) })
}
clipboard.setPrimaryClip(
android.content.ClipData.newPlainText("network report", report)
)
},
modifier = Modifier.fillMaxWidth()
) {
cc.skysparkle.matewave.ui.components.ButtonIcon(R.drawable.ic_copy)
Text(stringResource(R.string.diag_copy_log), color = ink)
}
}
}
@@ -133,7 +133,8 @@ fun SettingsScreen(
)
ListDivider()
ListRow(
title = stringResource(R.string.perm_vibration_title),
title = stringResource(R.string.settings_vibration),
subtitle = stringResource(R.string.settings_vibration_subtitle),
icon = R.drawable.ic_vibration,
trailing = { SettingSwitch(vibrationOn) { vibrationOn = it; feedback.vibrationEnabled = it } }
)