diff --git a/core/presentation/src/main/res/values-id/strings.xml b/core/presentation/src/main/res/values-id/strings.xml index a0754bdb..ebaf0a91 100644 --- a/core/presentation/src/main/res/values-id/strings.xml +++ b/core/presentation/src/main/res/values-id/strings.xml @@ -35,7 +35,7 @@ Terhubung ke APRS-IS Kesalahan koneksi Berhenti - Hitung kode sandi + Minta kode sandi APRS: laporan terkirim APRS: laporan gagal - %1$s APRS-IS tidak memverifikasi passcode Anda. Laporan Anda tidak diteruskan - periksa tanda panggil dan passcode di Pengaturan. diff --git a/core/presentation/src/main/res/values-in/strings.xml b/core/presentation/src/main/res/values-in/strings.xml index 59135a42..add9bf6b 100644 --- a/core/presentation/src/main/res/values-in/strings.xml +++ b/core/presentation/src/main/res/values-in/strings.xml @@ -35,7 +35,7 @@ Terhubung ke APRS-IS Kesalahan koneksi Berhenti - Hitung kode sandi + Minta kode sandi APRS: laporan terkirim APRS: laporan gagal - %1$s APRS-IS tidak memverifikasi passcode Anda. Laporan Anda tidak diteruskan - periksa tanda panggil dan passcode di Pengaturan. diff --git a/core/presentation/src/main/res/values-tr/strings.xml b/core/presentation/src/main/res/values-tr/strings.xml index 8fcb7c10..b294c23d 100644 --- a/core/presentation/src/main/res/values-tr/strings.xml +++ b/core/presentation/src/main/res/values-tr/strings.xml @@ -36,7 +36,7 @@ APRS-IS bağlı Bağlantı hatası Durdur - Parolayı hesapla + Passcode isteyin APRS: rapor gönderildi APRS: rapor başarısız - %1$s APRS-IS passcode bilginizi doğrulamadı. Raporlarınız iletilmiyor - Ayarlar bölümünde çağrı işareti ve passcode bilgisini kontrol edin. diff --git a/core/presentation/src/main/res/values-zh/strings.xml b/core/presentation/src/main/res/values-zh/strings.xml index 40603af6..856c9870 100644 --- a/core/presentation/src/main/res/values-zh/strings.xml +++ b/core/presentation/src/main/res/values-zh/strings.xml @@ -37,7 +37,7 @@ 已连接 APRS-IS 连接错误 停止 - 计算验证码 + 申请验证码 APRS: 上报成功 APRS: 上报失败 - %1$s APRS-IS 未验证你的 passcode, 上报不会被转发 - 请在设置里检查呼号与 passcode。 diff --git a/core/presentation/src/main/res/values/strings.xml b/core/presentation/src/main/res/values/strings.xml index bbe29515..4d20b877 100644 --- a/core/presentation/src/main/res/values/strings.xml +++ b/core/presentation/src/main/res/values/strings.xml @@ -38,7 +38,7 @@ Connected to APRS-IS Connection error Stop - Compute passcode + Request a passcode APRS: report sent OK APRS: report failed - %1$s APRS-IS did not verify your passcode. Your reports are not being passed on - check the callsign and passcode in Settings. diff --git a/feature/settings/src/main/java/com/rtbishop/look4sat/feature/settings/AprsCard.kt b/feature/settings/src/main/java/com/rtbishop/look4sat/feature/settings/AprsCard.kt index 97865408..841c666d 100644 --- a/feature/settings/src/main/java/com/rtbishop/look4sat/feature/settings/AprsCard.kt +++ b/feature/settings/src/main/java/com/rtbishop/look4sat/feature/settings/AprsCard.kt @@ -2,6 +2,7 @@ package com.rtbishop.look4sat.feature.settings import android.content.Intent import android.content.pm.PackageManager +import android.net.Uri import android.os.Build import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column @@ -33,12 +34,19 @@ import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import com.rtbishop.look4sat.core.data.aprs.AprsConfig -import com.rtbishop.look4sat.core.domain.aprs.AprsPacket import com.rtbishop.look4sat.core.data.aprs.AprsStore import com.rtbishop.look4sat.core.presentation.CardButton import com.rtbishop.look4sat.core.presentation.R /** APRS card: sits between the satellite-data and data-output containers; settings live in a gear dialog to save space */ +/** + * Where an operator obtains an APRS-IS passcode. + * + * The app links here rather than deriving one: the passcode is a licence check, and APRS-IS + * states that supplying it is the software author's responsibility. + */ +private const val PASSCODE_REQUEST_URL = "https://apps.magicbug.co.uk/passcode/" + @Composable fun AprsCard() { val context = LocalContext.current @@ -187,6 +195,7 @@ private fun AprsSettingsDialog( var symbolTable by remember { mutableStateOf(config.symbolTable) } var symbolCode by remember { mutableStateOf(config.symbolCode) } val textStyle = LocalTextStyle.current.copy(fontSize = 14.sp) + val context = LocalContext.current AlertDialog( onDismissRequest = onDismiss, @@ -215,16 +224,19 @@ private fun AprsSettingsDialog( singleLine = true, textStyle = textStyle ) - // Passcode compute button (user request: let the user see the computed result) + // Links out instead of computing it. APRS-IS treats the passcode as a licence + // check and says supplying it to a user is the software author's job; APRSdroid + // carries the same algorithm and deliberately does not use it here for that + // reason. Filling the field in claims a check that nobody performed. TextButton( onClick = { - val call = callsign.trim().uppercase() - if (call.isNotBlank()) { - passcode = AprsPacket.passcode(call).toString() + runCatching { + context.startActivity( + Intent(Intent.ACTION_VIEW, Uri.parse(PASSCODE_REQUEST_URL)) + ) } - }, - enabled = callsign.trim().isNotBlank() - ) { Text(stringResource(id = R.string.prefs_aprs_calc_passcode)) } + } + ) { Text(stringResource(id = R.string.prefs_aprs_request_passcode)) } Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) { OutlinedTextField( value = ssid,