Smaller fixes from the review

- BLE: at most four messages are reassembled at once; presence advertises
  in the balanced mode, a hosted game still in low latency.
- LAN: the socket and its stream are volatile.
- The spectator port and the APK share server listen on the Wi-Fi address
  only; the share server serves four clients at a time.
- Version catalog, per-app language setting (localeConfig) and the Gradle
  distribution checksum.
- NetworkLog writes to the debug log instead of an unread in-memory list;
  Log.d/Log.v are stripped from release builds.
- Remove four unused strings in all languages.
This commit is contained in:
2026-11-12 17:03:06 +02:00
parent cac575ed26
commit 6ed42e0bf3
17 changed files with 112 additions and 62 deletions
+13 -14
View File
@@ -1,7 +1,6 @@
plugins { plugins {
id("com.android.application") alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.compose)
id("org.jetbrains.kotlin.plugin.compose")
} }
android { android {
@@ -86,20 +85,20 @@ androidComponents {
} }
dependencies { dependencies {
implementation(platform("androidx.compose:compose-bom:2026.09.00")) implementation(platform(libs.androidx.compose.bom))
implementation("androidx.compose.material3:material3") implementation(libs.androidx.compose.material3)
implementation("androidx.compose.ui:ui") implementation(libs.androidx.compose.ui)
implementation("androidx.activity:activity-compose:1.13.0") implementation(libs.androidx.activity.compose)
implementation("androidx.core:core-ktx:1.18.0") implementation(libs.androidx.core.ktx)
implementation("androidx.navigation:navigation-compose:2.9.7") implementation(libs.androidx.navigation.compose)
implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.11.0") implementation(libs.androidx.lifecycle.viewmodel.compose)
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.11.0") implementation(libs.kotlinx.coroutines.android)
implementation("com.google.zxing:core:3.5.4") implementation(libs.zxing.core)
testImplementation("junit:junit:4.13.2") testImplementation(libs.junit)
testImplementation("org.json:json:20240303") testImplementation(libs.org.json)
} }
+6
View File
@@ -2,3 +2,9 @@
# reflection. Only keep line numbers so release crash reports stay readable. # reflection. Only keep line numbers so release crash reports stay readable.
-keepattributes SourceFile,LineNumberTable -keepattributes SourceFile,LineNumberTable
-renamesourcefileattribute SourceFile -renamesourcefileattribute SourceFile
# Debug and verbose logging (NetworkLog included) is stripped from release builds.
-assumenosideeffects class android.util.Log {
public static int d(...);
public static int v(...);
}
+1
View File
@@ -36,6 +36,7 @@
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round" android:roundIcon="@mipmap/ic_launcher_round"
android:label="@string/app_title" android:label="@string/app_title"
android:localeConfig="@xml/locales_config"
android:networkSecurityConfig="@xml/network_security_config" android:networkSecurityConfig="@xml/network_security_config"
android:theme="@android:style/Theme.Material.NoActionBar" android:theme="@android:style/Theme.Material.NoActionBar"
android:supportsRtl="true"> android:supportsRtl="true">
@@ -73,6 +73,9 @@ class BleTransport(
private const val INCOMPLETE_TTL_MS = 30_000L private const val INCOMPLETE_TTL_MS = 30_000L
/** Messages being reassembled at once; each may grow to [MAX_MESSAGE_BYTES]. */
private const val MAX_PARTIAL_MESSAGES = 4
private const val CTRL_TOTAL_MARKER = 0 private const val CTRL_TOTAL_MARKER = 0
private const val CTRL_ACK = 1 private const val CTRL_ACK = 1
private const val CTRL_NACK = 2 private const val CTRL_NACK = 2
@@ -232,6 +235,8 @@ class BleTransport(
role = Role.PERIPHERAL role = Role.PERIPHERAL
hosting = true hosting = true
// Presence may already be advertising in the low-power mode; restart it for hosting.
if (advertisingActive || advertiseCallback != null) startAdvertising()
startPresence() startPresence()
_connectionState.value = ConnectionState.CONNECTING _connectionState.value = ConnectionState.CONNECTING
} }
@@ -300,10 +305,14 @@ class BleTransport(
} }
// One advertisement at a time: a second start would leak the first one. // One advertisement at a time: a second start would leak the first one.
if (advertiseCallback != null) stopAdvertising() if (advertiseCallback != null) stopAdvertising()
// A hosted game should be found at once; plain presence can save the battery.
val settings = AdvertiseSettings.Builder() val settings = AdvertiseSettings.Builder()
.setAdvertiseMode(
.setAdvertiseMode(AdvertiseSettings.ADVERTISE_MODE_LOW_LATENCY) if (hosting) AdvertiseSettings.ADVERTISE_MODE_LOW_LATENCY else AdvertiseSettings.ADVERTISE_MODE_BALANCED
.setTxPowerLevel(AdvertiseSettings.ADVERTISE_TX_POWER_HIGH) )
.setTxPowerLevel(
if (hosting) AdvertiseSettings.ADVERTISE_TX_POWER_HIGH else AdvertiseSettings.ADVERTISE_TX_POWER_MEDIUM
)
.setConnectable(true) .setConnectable(true)
.build() .build()
@@ -790,6 +799,11 @@ class BleTransport(
val now = System.currentTimeMillis() val now = System.currentTimeMillis()
incoming.entries.removeAll { now - it.value.startedAt > INCOMPLETE_TTL_MS } incoming.entries.removeAll { now - it.value.startedAt > INCOMPLETE_TTL_MS }
if (messageId !in incoming && incoming.size >= MAX_PARTIAL_MESSAGES) {
// A peer that starts many messages and never finishes them would fill the memory.
incoming.minByOrNull { it.value.startedAt }?.let { incoming.remove(it.key) }
NetworkLog.log("BLE", "Too many unfinished messages, oldest dropped")
}
val entry = incoming.getOrPut(messageId) { PartialMessage(total, now) } val entry = incoming.getOrPut(messageId) { PartialMessage(total, now) }
if (entry.total != total) { if (entry.total != total) {
incoming[messageId] = PartialMessage(total, now).also { it.parts[index] = payload } incoming[messageId] = PartialMessage(total, now).also { it.parts[index] = payload }
@@ -72,7 +72,8 @@ class LanTransport(
context.getSystemService(Context.NSD_SERVICE) as? NsdManager context.getSystemService(Context.NSD_SERVICE) as? NsdManager
private var serverSocket: ServerSocket? = null private var serverSocket: ServerSocket? = null
private var socket: Socket? = null // Written by the connect and accept paths, read by the writer coroutine.
@Volatile private var socket: Socket? = null
private val socketLock = Any() private val socketLock = Any()
@@ -82,7 +83,7 @@ class LanTransport(
socket = candidate socket = candidate
true true
} }
private var output: OutputStream? = null @Volatile private var output: OutputStream? = null
private val dispatcher = MessageDispatcher() private val dispatcher = MessageDispatcher()
@Volatile private var hosting = false @Volatile private var hosting = false
@@ -1,8 +1,8 @@
package cc.skysparkle.matewave.network package cc.skysparkle.matewave.network
import android.util.Log
import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.update
enum class DisconnectReason(val userText: String, val textRes: Int) { enum class DisconnectReason(val userText: String, val textRes: Int) {
NONE("—", cc.skysparkle.matewave.R.string.reason_unknown), NONE("—", cc.skysparkle.matewave.R.string.reason_unknown),
@@ -18,23 +18,13 @@ enum class DisconnectReason(val userText: String, val textRes: Int) {
PORT_BUSY("Could not open port", cc.skysparkle.matewave.R.string.reason_port_busy) PORT_BUSY("Could not open port", cc.skysparkle.matewave.R.string.reason_port_busy)
} }
data class NetworkEvent(
val at: Long,
val transport: String,
val text: String
)
object NetworkLog { object NetworkLog {
private const val CAPACITY = 60
private val _events = MutableStateFlow<List<NetworkEvent>>(emptyList())
private val _lastReason = MutableStateFlow(DisconnectReason.NONE) private val _lastReason = MutableStateFlow(DisconnectReason.NONE)
val lastReason: StateFlow<DisconnectReason> = _lastReason val lastReason: StateFlow<DisconnectReason> = _lastReason
/** Debug output only: release builds strip Log.d (see proguard-rules.pro). */
fun log(transport: String, text: String) { fun log(transport: String, text: String) {
val event = NetworkEvent(System.currentTimeMillis(), transport, text) Log.d("Matewave/$transport", text)
_events.update { (it + event).takeLast(CAPACITY) }
} }
fun reason(transport: String, reason: DisconnectReason, detail: String? = null) { fun reason(transport: String, reason: DisconnectReason, detail: String? = null) {
@@ -5,10 +5,12 @@ import java.io.File
import java.io.IOException import java.io.IOException
import java.io.OutputStream import java.io.OutputStream
import java.net.Inet4Address import java.net.Inet4Address
import java.net.InetSocketAddress
import java.net.NetworkInterface import java.net.NetworkInterface
import java.net.ServerSocket import java.net.ServerSocket
import java.net.Socket import java.net.Socket
import java.util.Locale import java.util.Locale
import java.util.concurrent.atomic.AtomicInteger
import kotlin.concurrent.thread import kotlin.concurrent.thread
class ApkShareServer(private val apk: File, private val appName: String) { class ApkShareServer(private val apk: File, private val appName: String) {
@@ -17,8 +19,13 @@ class ApkShareServer(private val apk: File, private val appName: String) {
@Volatile @Volatile
private var server: ServerSocket? = null private var server: ServerSocket? = null
private val activeClients = AtomicInteger()
/** Listens on the Wi-Fi address only (all interfaces if none is found), so the APK is not served elsewhere. */
fun start(): Int { fun start(): Int {
val socket = ServerSocket(0) val socket = ServerSocket()
socket.reuseAddress = true
socket.bind(InetSocketAddress(LocalNetwork.wifiInet4(), 0))
server = socket server = socket
thread(name = "apk-share-accept", isDaemon = true) { thread(name = "apk-share-accept", isDaemon = true) {
while (!socket.isClosed) { while (!socket.isClosed) {
@@ -27,7 +34,19 @@ class ApkShareServer(private val apk: File, private val appName: String) {
} catch (e: IOException) { } catch (e: IOException) {
break break
} }
thread(name = "apk-share-client", isDaemon = true) { serve(client) } // A handful of downloads at a time is plenty; more connections are refused.
if (activeClients.incrementAndGet() > MAX_CLIENTS) {
activeClients.decrementAndGet()
runCatching { client.close() }
continue
}
thread(name = "apk-share-client", isDaemon = true) {
try {
serve(client)
} finally {
activeClients.decrementAndGet()
}
}
} }
} }
return socket.localPort return socket.localPort
@@ -78,6 +97,10 @@ class ApkShareServer(private val apk: File, private val appName: String) {
} }
} }
private companion object {
const val MAX_CLIENTS = 4
}
private fun sendText(out: OutputStream, code: Int, reason: String, text: String, withBody: Boolean) { private fun sendText(out: OutputStream, code: Int, reason: String, text: String, withBody: Boolean) {
val body = text.toByteArray(Charsets.UTF_8) val body = text.toByteArray(Charsets.UTF_8)
writeHeader(out, code, reason, "text/plain; charset=utf-8", body.size.toLong()) writeHeader(out, code, reason, "text/plain; charset=utf-8", body.size.toLong())
@@ -117,12 +140,13 @@ class ApkShareServer(private val apk: File, private val appName: String) {
object LocalNetwork { object LocalNetwork {
private val WIFI_PREFIXES = listOf("wlan", "swlan", "ap", "softap", "eth") private val WIFI_PREFIXES = listOf("wlan", "swlan", "ap", "softap", "eth")
fun wifiIpv4(): String? = runCatching { fun wifiInet4(): Inet4Address? = runCatching {
NetworkInterface.getNetworkInterfaces()?.toList().orEmpty() NetworkInterface.getNetworkInterfaces()?.toList().orEmpty()
.filter { nif -> nif.isUp && !nif.isLoopback && WIFI_PREFIXES.any { nif.name.startsWith(it) } } .filter { nif -> nif.isUp && !nif.isLoopback && WIFI_PREFIXES.any { nif.name.startsWith(it) } }
.flatMap { nif -> nif.inetAddresses.toList() } .flatMap { nif -> nif.inetAddresses.toList() }
.filterIsInstance<Inet4Address>() .filterIsInstance<Inet4Address>()
.firstOrNull { it.isSiteLocalAddress } .firstOrNull { it.isSiteLocalAddress }
?.hostAddress
}.getOrNull() }.getOrNull()
fun wifiIpv4(): String? = wifiInet4()?.hostAddress
} }
-4
View File
@@ -7,13 +7,11 @@
<string name="greeting_night">Gute Nacht</string> <string name="greeting_night">Gute Nacht</string>
<string name="continue_game_title">Partie fortsetzen</string> <string name="continue_game_title">Partie fortsetzen</string>
<string name="quick_game_title">Schnelles Spiel</string> <string name="quick_game_title">Schnelles Spiel</string>
<string name="quick_game_subtitle">Wie beim letzten Mal: %1$s · %2$s</string>
<string name="mode_ai_title">Gegen die KI</string> <string name="mode_ai_title">Gegen die KI</string>
<string name="mode_ai_subtitle">Schwierigkeit wählen</string> <string name="mode_ai_subtitle">Schwierigkeit wählen</string>
<string name="mode_online_title">Mit einem Freund</string> <string name="mode_online_title">Mit einem Freund</string>
<string name="mode_online_subtitle">Per Bluetooth oder WLAN in der Nähe</string> <string name="mode_online_subtitle">Per Bluetooth oder WLAN in der Nähe</string>
<string name="puzzles_title">Schachaufgaben</string> <string name="puzzles_title">Schachaufgaben</string>
<string name="puzzles_subtitle">Aufgaben passend zu deiner Wertung</string>
<string name="stats_dialog_title">Statistik</string> <string name="stats_dialog_title">Statistik</string>
<string name="stats_dialog_summary">%1$d Siege · %2$d%% · Serie: %3$d</string> <string name="stats_dialog_summary">%1$d Siege · %2$d%% · Serie: %3$d</string>
<string name="stats_min">Min.: %1$d</string> <string name="stats_min">Min.: %1$d</string>
@@ -136,7 +134,6 @@
<string name="account_forget_keys_confirm">Du kannst einen bekannten Gegner dann nicht mehr von jemandem unterscheiden, der seinen Namen benutzt, bis ihr euch erneut trefft. Nötig, wenn der Gegner die App neu installiert hat.</string> <string name="account_forget_keys_confirm">Du kannst einen bekannten Gegner dann nicht mehr von jemandem unterscheiden, der seinen Namen benutzt, bis ihr euch erneut trefft. Nötig, wenn der Gegner die App neu installiert hat.</string>
<string name="account_confirm">Vergessen</string> <string name="account_confirm">Vergessen</string>
<string name="account_cancel">Abbrechen</string> <string name="account_cancel">Abbrechen</string>
<string name="greeting_ready">Bereit für eine neue Partie?</string>
<string name="account_trusted_keys_hint">Werden beim ersten Treffen mit einem neuen Spieler automatisch gespeichert</string> <string name="account_trusted_keys_hint">Werden beim ersten Treffen mit einem neuen Spieler automatisch gespeichert</string>
<string name="account_fingerprint_explain">Eindeutiger Fingerabdruck des Schlüssels dieses Geräts. Dein Gegner kann ihn beim ersten Treffen mit deinem vergleichen.</string> <string name="account_fingerprint_explain">Eindeutiger Fingerabdruck des Schlüssels dieses Geräts. Dein Gegner kann ihn beim ersten Treffen mit deinem vergleichen.</string>
<string name="friends_online">Online</string> <string name="friends_online">Online</string>
@@ -331,7 +328,6 @@
<string name="settings_section_system">System</string> <string name="settings_section_system">System</string>
<string name="permissions_card_ok_short">Alles bereit</string> <string name="permissions_card_ok_short">Alles bereit</string>
<string name="permissions_card_blocked_short">Aktion nötig</string> <string name="permissions_card_blocked_short">Aktion nötig</string>
<string name="account_header_summary">Wertung %1$d · Partien: %2$d</string>
<string name="account_progress">Fortschritt</string> <string name="account_progress">Fortschritt</string>
<string name="account_rating_row">Wertung</string> <string name="account_rating_row">Wertung</string>
<string name="account_device_key">Geräteschlüssel</string> <string name="account_device_key">Geräteschlüssel</string>
-4
View File
@@ -7,13 +7,11 @@
<string name="greeting_night">おやすみなさい</string> <string name="greeting_night">おやすみなさい</string>
<string name="continue_game_title">対局を続ける</string> <string name="continue_game_title">対局を続ける</string>
<string name="quick_game_title">クイックゲーム</string> <string name="quick_game_title">クイックゲーム</string>
<string name="quick_game_subtitle">前回と同じ:%1$s・%2$s</string>
<string name="mode_ai_title">AIと対戦</string> <string name="mode_ai_title">AIと対戦</string>
<string name="mode_ai_subtitle">難易度を選択</string> <string name="mode_ai_subtitle">難易度を選択</string>
<string name="mode_online_title">友達と対戦</string> <string name="mode_online_title">友達と対戦</string>
<string name="mode_online_subtitle">近くでBluetoothまたはWi-Fiで</string> <string name="mode_online_subtitle">近くでBluetoothまたはWi-Fiで</string>
<string name="puzzles_title">チェスパズル</string> <string name="puzzles_title">チェスパズル</string>
<string name="puzzles_subtitle">あなたのレーティングに合った問題</string>
<string name="stats_dialog_title">成績</string> <string name="stats_dialog_title">成績</string>
<string name="stats_dialog_summary">%1$d勝 · %2$d%% · 連勝: %3$d</string> <string name="stats_dialog_summary">%1$d勝 · %2$d%% · 連勝: %3$d</string>
<string name="stats_min">最小: %1$d</string> <string name="stats_min">最小: %1$d</string>
@@ -136,7 +134,6 @@
<string name="account_forget_keys_confirm">再び会うまで、知っている相手とその名前を名乗る人を区別できなくなります。相手がアプリを再インストールした場合に必要です。</string> <string name="account_forget_keys_confirm">再び会うまで、知っている相手とその名前を名乗る人を区別できなくなります。相手がアプリを再インストールした場合に必要です。</string>
<string name="account_confirm">忘れる</string> <string name="account_confirm">忘れる</string>
<string name="account_cancel">キャンセル</string> <string name="account_cancel">キャンセル</string>
<string name="greeting_ready">新しい対局の準備はできましたか?</string>
<string name="account_trusted_keys_hint">新しいプレイヤーと初めて会ったときに自動で保存されます</string> <string name="account_trusted_keys_hint">新しいプレイヤーと初めて会ったときに自動で保存されます</string>
<string name="account_fingerprint_explain">この端末の鍵の固有のフィンガープリントです。初めて会ったとき、相手があなたのものと照合できます。</string> <string name="account_fingerprint_explain">この端末の鍵の固有のフィンガープリントです。初めて会ったとき、相手があなたのものと照合できます。</string>
<string name="friends_online">オンライン</string> <string name="friends_online">オンライン</string>
@@ -330,7 +327,6 @@
<string name="settings_section_system">システム</string> <string name="settings_section_system">システム</string>
<string name="permissions_card_ok_short">準備完了</string> <string name="permissions_card_ok_short">準備完了</string>
<string name="permissions_card_blocked_short">要対応</string> <string name="permissions_card_blocked_short">要対応</string>
<string name="account_header_summary">レーティング %1$d · 対局: %2$d</string>
<string name="account_progress">進捗</string> <string name="account_progress">進捗</string>
<string name="account_rating_row">レーティング</string> <string name="account_rating_row">レーティング</string>
<string name="account_device_key">端末の鍵</string> <string name="account_device_key">端末の鍵</string>
-4
View File
@@ -7,13 +7,11 @@
<string name="greeting_night">Labos nakties</string> <string name="greeting_night">Labos nakties</string>
<string name="continue_game_title">Tęsti partiją</string> <string name="continue_game_title">Tęsti partiją</string>
<string name="quick_game_title">Greitas žaidimas</string> <string name="quick_game_title">Greitas žaidimas</string>
<string name="quick_game_subtitle">Kaip praėjusį kartą: %1$s · %2$s</string>
<string name="mode_ai_title">Prieš DI</string> <string name="mode_ai_title">Prieš DI</string>
<string name="mode_ai_subtitle">Pasirinkite sudėtingumą</string> <string name="mode_ai_subtitle">Pasirinkite sudėtingumą</string>
<string name="mode_online_title">Su draugu</string> <string name="mode_online_title">Su draugu</string>
<string name="mode_online_subtitle">Per „Bluetooth“ arba „Wi-Fi“ netoliese</string> <string name="mode_online_subtitle">Per „Bluetooth“ arba „Wi-Fi“ netoliese</string>
<string name="puzzles_title">Šachmatų galvosūkiai</string> <string name="puzzles_title">Šachmatų galvosūkiai</string>
<string name="puzzles_subtitle">Užduotys pagal jūsų reitingą</string>
<string name="stats_dialog_title">Statistika</string> <string name="stats_dialog_title">Statistika</string>
<string name="stats_dialog_summary">%1$d pergalių · %2$d%% · serija: %3$d</string> <string name="stats_dialog_summary">%1$d pergalių · %2$d%% · serija: %3$d</string>
<string name="stats_min">Min.: %1$d</string> <string name="stats_min">Min.: %1$d</string>
@@ -136,7 +134,6 @@
<string name="account_forget_keys_confirm">Nebegalėsite atskirti pažįstamo varžovo nuo to, kas naudoja jo vardą, kol vėl nesusitiksite. Reikia, jei varžovas iš naujo įdiegė programą.</string> <string name="account_forget_keys_confirm">Nebegalėsite atskirti pažįstamo varžovo nuo to, kas naudoja jo vardą, kol vėl nesusitiksite. Reikia, jei varžovas iš naujo įdiegė programą.</string>
<string name="account_confirm">Pamiršti</string> <string name="account_confirm">Pamiršti</string>
<string name="account_cancel">Atšaukti</string> <string name="account_cancel">Atšaukti</string>
<string name="greeting_ready">Pasiruošę naujai partijai?</string>
<string name="account_trusted_keys_hint">Išsaugomi automatiškai pirmą kartą sutikus naują žaidėją</string> <string name="account_trusted_keys_hint">Išsaugomi automatiškai pirmą kartą sutikus naują žaidėją</string>
<string name="account_fingerprint_explain">Unikalus šio įrenginio rakto kontrolinis kodas. Pirmą kartą susitikęs varžovas gali jį palyginti su jūsų.</string> <string name="account_fingerprint_explain">Unikalus šio įrenginio rakto kontrolinis kodas. Pirmą kartą susitikęs varžovas gali jį palyginti su jūsų.</string>
<string name="friends_online">Prisijungęs</string> <string name="friends_online">Prisijungęs</string>
@@ -333,7 +330,6 @@
<string name="settings_section_system">Sistema</string> <string name="settings_section_system">Sistema</string>
<string name="permissions_card_ok_short">Viskas paruošta</string> <string name="permissions_card_ok_short">Viskas paruošta</string>
<string name="permissions_card_blocked_short">Reikia veiksmo</string> <string name="permissions_card_blocked_short">Reikia veiksmo</string>
<string name="account_header_summary">Reitingas %1$d · Partijų: %2$d</string>
<string name="account_progress">Pažanga</string> <string name="account_progress">Pažanga</string>
<string name="account_rating_row">Reitingas</string> <string name="account_rating_row">Reitingas</string>
<string name="account_device_key">Įrenginio raktas</string> <string name="account_device_key">Įrenginio raktas</string>
-4
View File
@@ -9,14 +9,12 @@
<string name="continue_game_title">Продолжить партию</string> <string name="continue_game_title">Продолжить партию</string>
<string name="quick_game_title">Быстрая игра</string> <string name="quick_game_title">Быстрая игра</string>
<string name="quick_game_subtitle">Как в прошлый раз: %1$s · %2$s</string>
<string name="mode_ai_title">Против ИИ</string> <string name="mode_ai_title">Против ИИ</string>
<string name="mode_ai_subtitle">Выберите сложность</string> <string name="mode_ai_subtitle">Выберите сложность</string>
<string name="mode_online_title">С другом</string> <string name="mode_online_title">С другом</string>
<string name="mode_online_subtitle">По Bluetooth или Wi-Fi рядом</string> <string name="mode_online_subtitle">По Bluetooth или Wi-Fi рядом</string>
<string name="puzzles_title">Шахматные задачи</string> <string name="puzzles_title">Шахматные задачи</string>
<string name="puzzles_subtitle">Задачи под ваш рейтинг</string>
<string name="stats_dialog_title">Статистика</string> <string name="stats_dialog_title">Статистика</string>
<string name="stats_dialog_summary">%1$d побед · %2$d%% · серия: %3$d</string> <string name="stats_dialog_summary">%1$d побед · %2$d%% · серия: %3$d</string>
<string name="stats_min">Мин: %1$d</string> <string name="stats_min">Мин: %1$d</string>
@@ -141,7 +139,6 @@
<string name="account_forget_keys_confirm">Вы перестанете отличать знакомого соперника от того, кто назвался его именем, пока не встретитесь с ним заново. Нужно, если соперник переустановил приложение.</string> <string name="account_forget_keys_confirm">Вы перестанете отличать знакомого соперника от того, кто назвался его именем, пока не встретитесь с ним заново. Нужно, если соперник переустановил приложение.</string>
<string name="account_confirm">Забыть</string> <string name="account_confirm">Забыть</string>
<string name="account_cancel">Отмена</string> <string name="account_cancel">Отмена</string>
<string name="greeting_ready">Готовы к новой партии?</string>
<string name="account_trusted_keys_hint">Запоминаются автоматически при первой встрече с новым игроком</string> <string name="account_trusted_keys_hint">Запоминаются автоматически при первой встрече с новым игроком</string>
<string name="account_fingerprint_explain">Уникальный отпечаток ключа этого устройства. Соперник может сверить его с вашим при первой встрече.</string> <string name="account_fingerprint_explain">Уникальный отпечаток ключа этого устройства. Соперник может сверить его с вашим при первой встрече.</string>
<string name="friends_online">В сети</string> <string name="friends_online">В сети</string>
@@ -339,7 +336,6 @@
<string name="settings_section_system">Система</string> <string name="settings_section_system">Система</string>
<string name="permissions_card_ok_short">Всё готово</string> <string name="permissions_card_ok_short">Всё готово</string>
<string name="permissions_card_blocked_short">Нужно действие</string> <string name="permissions_card_blocked_short">Нужно действие</string>
<string name="account_header_summary">Рейтинг %1$d · Партий: %2$d</string>
<string name="account_progress">Прогресс</string> <string name="account_progress">Прогресс</string>
<string name="account_rating_row">Рейтинг</string> <string name="account_rating_row">Рейтинг</string>
<string name="account_device_key">Ключ устройства</string> <string name="account_device_key">Ключ устройства</string>
-4
View File
@@ -7,13 +7,11 @@
<string name="greeting_night">晚安</string> <string name="greeting_night">晚安</string>
<string name="continue_game_title">继续对局</string> <string name="continue_game_title">继续对局</string>
<string name="quick_game_title">快速对局</string> <string name="quick_game_title">快速对局</string>
<string name="quick_game_subtitle">与上次相同:%1$s · %2$s</string>
<string name="mode_ai_title">对战 AI</string> <string name="mode_ai_title">对战 AI</string>
<string name="mode_ai_subtitle">选择难度</string> <string name="mode_ai_subtitle">选择难度</string>
<string name="mode_online_title">好友对战</string> <string name="mode_online_title">好友对战</string>
<string name="mode_online_subtitle">通过蓝牙或附近的 Wi-Fi</string> <string name="mode_online_subtitle">通过蓝牙或附近的 Wi-Fi</string>
<string name="puzzles_title">国际象棋谜题</string> <string name="puzzles_title">国际象棋谜题</string>
<string name="puzzles_subtitle">按你的等级分挑选的谜题</string>
<string name="stats_dialog_title">统计</string> <string name="stats_dialog_title">统计</string>
<string name="stats_dialog_summary">%1$d 胜 · %2$d%% · 连胜:%3$d</string> <string name="stats_dialog_summary">%1$d 胜 · %2$d%% · 连胜:%3$d</string>
<string name="stats_min">最低:%1$d</string> <string name="stats_min">最低:%1$d</string>
@@ -136,7 +134,6 @@
<string name="account_forget_keys_confirm">在再次见面之前,你将无法区分熟悉的对手和冒用其名字的人。如果对手重装了应用,则需要这样做。</string> <string name="account_forget_keys_confirm">在再次见面之前,你将无法区分熟悉的对手和冒用其名字的人。如果对手重装了应用,则需要这样做。</string>
<string name="account_confirm">忘记</string> <string name="account_confirm">忘记</string>
<string name="account_cancel">取消</string> <string name="account_cancel">取消</string>
<string name="greeting_ready">准备好开始新对局了吗?</string>
<string name="account_trusted_keys_hint">首次遇到新玩家时自动保存</string> <string name="account_trusted_keys_hint">首次遇到新玩家时自动保存</string>
<string name="account_fingerprint_explain">此设备密钥的唯一指纹。首次见面时,对手可以将其与你的核对。</string> <string name="account_fingerprint_explain">此设备密钥的唯一指纹。首次见面时,对手可以将其与你的核对。</string>
<string name="friends_online">在线</string> <string name="friends_online">在线</string>
@@ -330,7 +327,6 @@
<string name="settings_section_system">系统</string> <string name="settings_section_system">系统</string>
<string name="permissions_card_ok_short">已就绪</string> <string name="permissions_card_ok_short">已就绪</string>
<string name="permissions_card_blocked_short">需要处理</string> <string name="permissions_card_blocked_short">需要处理</string>
<string name="account_header_summary">等级分 %1$d · 对局:%2$d</string>
<string name="account_progress">进度</string> <string name="account_progress">进度</string>
<string name="account_rating_row">等级分</string> <string name="account_rating_row">等级分</string>
<string name="account_device_key">设备密钥</string> <string name="account_device_key">设备密钥</string>
-4
View File
@@ -7,13 +7,11 @@
<string name="greeting_night">Good night</string> <string name="greeting_night">Good night</string>
<string name="continue_game_title">Continue game</string> <string name="continue_game_title">Continue game</string>
<string name="quick_game_title">Quick game</string> <string name="quick_game_title">Quick game</string>
<string name="quick_game_subtitle">Same as last time: %1$s · %2$s</string>
<string name="mode_ai_title">Vs AI</string> <string name="mode_ai_title">Vs AI</string>
<string name="mode_ai_subtitle">Choose difficulty</string> <string name="mode_ai_subtitle">Choose difficulty</string>
<string name="mode_online_title">Vs a friend</string> <string name="mode_online_title">Vs a friend</string>
<string name="mode_online_subtitle">Over Bluetooth or Wi-Fi nearby</string> <string name="mode_online_subtitle">Over Bluetooth or Wi-Fi nearby</string>
<string name="puzzles_title">Chess puzzles</string> <string name="puzzles_title">Chess puzzles</string>
<string name="puzzles_subtitle">Puzzles picked for your rating</string>
<string name="stats_dialog_title">Statistics</string> <string name="stats_dialog_title">Statistics</string>
<string name="stats_dialog_summary">%1$d wins · %2$d%% · streak: %3$d</string> <string name="stats_dialog_summary">%1$d wins · %2$d%% · streak: %3$d</string>
<string name="stats_min">Min: %1$d</string> <string name="stats_min">Min: %1$d</string>
@@ -136,7 +134,6 @@
<string name="account_forget_keys_confirm">You will no longer be able to tell a familiar opponent from someone using their name until you meet again. Needed if the opponent reinstalled the app.</string> <string name="account_forget_keys_confirm">You will no longer be able to tell a familiar opponent from someone using their name until you meet again. Needed if the opponent reinstalled the app.</string>
<string name="account_confirm">Forget</string> <string name="account_confirm">Forget</string>
<string name="account_cancel">Cancel</string> <string name="account_cancel">Cancel</string>
<string name="greeting_ready">Ready for a new game?</string>
<string name="account_trusted_keys_hint">Saved automatically the first time you meet a new player</string> <string name="account_trusted_keys_hint">Saved automatically the first time you meet a new player</string>
<string name="account_fingerprint_explain">The unique fingerprint of this device\'s key. Your opponent can compare it with yours when you first meet.</string> <string name="account_fingerprint_explain">The unique fingerprint of this device\'s key. Your opponent can compare it with yours when you first meet.</string>
<string name="friends_online">Online</string> <string name="friends_online">Online</string>
@@ -331,7 +328,6 @@
<string name="settings_section_system">System</string> <string name="settings_section_system">System</string>
<string name="permissions_card_ok_short">All set</string> <string name="permissions_card_ok_short">All set</string>
<string name="permissions_card_blocked_short">Action needed</string> <string name="permissions_card_blocked_short">Action needed</string>
<string name="account_header_summary">Rating %1$d · Games: %2$d</string>
<string name="account_progress">Progress</string> <string name="account_progress">Progress</string>
<string name="account_rating_row">Rating</string> <string name="account_rating_row">Rating</string>
<string name="account_device_key">Device key</string> <string name="account_device_key">Device key</string>
+9
View File
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<locale-config xmlns:android="http://schemas.android.com/apk/res/android">
<locale android:name="en" />
<locale android:name="de" />
<locale android:name="ja" />
<locale android:name="lt" />
<locale android:name="ru" />
<locale android:name="zh" />
</locale-config>
+2 -2
View File
@@ -1,4 +1,4 @@
plugins { plugins {
id("com.android.application") version "9.2.0" apply false alias(libs.plugins.android.application) apply false
id("org.jetbrains.kotlin.plugin.compose") version "2.4.20" apply false alias(libs.plugins.kotlin.compose) apply false
} }
+29
View File
@@ -0,0 +1,29 @@
[versions]
agp = "9.2.0"
kotlin = "2.4.20"
composeBom = "2026.09.00"
activityCompose = "1.13.0"
coreKtx = "1.18.0"
navigationCompose = "2.9.7"
lifecycleViewmodelCompose = "2.11.0"
kotlinxCoroutines = "1.11.0"
zxing = "3.5.4"
junit = "4.13.2"
orgJson = "20240303"
[libraries]
androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "composeBom" }
androidx-compose-material3 = { group = "androidx.compose.material3", name = "material3" }
androidx-compose-ui = { group = "androidx.compose.ui", name = "ui" }
androidx-activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref = "activityCompose" }
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
androidx-navigation-compose = { group = "androidx.navigation", name = "navigation-compose", version.ref = "navigationCompose" }
androidx-lifecycle-viewmodel-compose = { group = "androidx.lifecycle", name = "lifecycle-viewmodel-compose", version.ref = "lifecycleViewmodelCompose" }
kotlinx-coroutines-android = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-android", version.ref = "kotlinxCoroutines" }
zxing-core = { group = "com.google.zxing", name = "core", version.ref = "zxing" }
junit = { group = "junit", name = "junit", version.ref = "junit" }
org-json = { group = "org.json", name = "json", version.ref = "orgJson" }
[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }
kotlin-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
+1
View File
@@ -1,5 +1,6 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionSha256Sum=acd53f1edaf02f1a8ff99879f8a34b302661a057d9b063ae9e35b552f804d20a
distributionUrl=https\://services.gradle.org/distributions/gradle-9.7.1-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-9.7.1-bin.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists