fix(radar): 防止 WaveLog 重复提交 QSO
问题:键盘 onDone 连击会存两条相同的 QSO(时间戳/呼号/频率完全一致)。 修复:添加 submitting 状态变量,提交期间拒绝重复调用。 影响:误操作不再造成重复记录。
This commit is contained in:
1 parent
e69d6dee4a
commit
082e0c5bff
1 file changed
+4
@@ -253,12 +253,15 @@ private fun ExpandedLogInput(
|
||||
val scope = rememberCoroutineScope()
|
||||
var callsign by remember { mutableStateOf("") }
|
||||
var mode by remember { mutableStateOf(radio.uplinkMode ?: "FM") }
|
||||
var submitting by remember { mutableStateOf(false) }
|
||||
|
||||
val savedMsg = stringResource(id = R.string.wavelog_saved)
|
||||
|
||||
fun submit() {
|
||||
if (submitting) return
|
||||
val call = callsign.trim().uppercase()
|
||||
if (call.length < 3) return
|
||||
submitting = true
|
||||
// Freq taken directly from the transponder bar (radio Doppler-corrected each second; value at the Enter moment)
|
||||
val tx = radio.uplinkLow ?: radio.downlinkLow ?: 0L
|
||||
val rx = radio.downlinkLow ?: radio.uplinkLow ?: 0L
|
||||
@@ -278,6 +281,7 @@ private fun ExpandedLogInput(
|
||||
callsign = ""
|
||||
onSaved()
|
||||
showToast(savedMsg)
|
||||
submitting = false
|
||||
// QRZ counterpart grid async backfill (4.5.5): only queried when Cookie is set; silent on failure
|
||||
scope.launch {
|
||||
val prefs = context.getSharedPreferences("qrz_cookie", android.content.Context.MODE_PRIVATE)
|
||||
|
||||
Reference in new issue
Block a user