fix(android): report completed generation sync
This commit is contained in:
parent
bad79ed926
commit
e64ea836f7
4 changed files with 16 additions and 1 deletions
|
|
@ -14,6 +14,11 @@ import kotlinx.coroutines.Dispatchers
|
|||
import kotlinx.coroutines.withContext
|
||||
|
||||
sealed interface SyncRequestResult {
|
||||
/** The full-generation coordinator completed both durable peer ACKs. */
|
||||
data class Completed(
|
||||
val runId: String,
|
||||
) : SyncRequestResult
|
||||
|
||||
data class Requested(
|
||||
val requestId: String,
|
||||
) : SyncRequestResult
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ internal suspend fun publishBundleAndRequest(
|
|||
} catch (_: Exception) { false }
|
||||
if (!enabled) return@withContext SyncRequestResult.Error("Invalid generation synchronization opt-in.")
|
||||
return@withContext when (val result = SyncGenerationForegroundCoordinator(repository).run(canonicalExchangeDirectory())) {
|
||||
is ForegroundGenerationResult.Completed -> SyncRequestResult.Requested(result.runId)
|
||||
is ForegroundGenerationResult.Completed -> SyncRequestResult.Completed(result.runId)
|
||||
is ForegroundGenerationResult.Error -> SyncRequestResult.Error(result.message)
|
||||
}
|
||||
}
|
||||
|
|
@ -336,6 +336,14 @@ fun SyncScreen(
|
|||
coroutineScope.launch {
|
||||
try {
|
||||
when (val result = publishBundleAndRequest(repository, exporter, requestOutbox)) {
|
||||
is SyncRequestResult.Completed -> {
|
||||
// The generation coordinator has already consumed the
|
||||
// desktop return and published its durable ACK. Waiting
|
||||
// for the legacy receipt here would leave a false spinner.
|
||||
success = true
|
||||
pendingRequestId = null
|
||||
status = strings.getString(R.string.sync_generation_complete)
|
||||
}
|
||||
is SyncRequestResult.Requested -> {
|
||||
success = true
|
||||
pendingRequestId = result.requestId
|
||||
|
|
|
|||
|
|
@ -75,6 +75,7 @@
|
|||
<string name="sync_flow_description">Android → PC then PC → Android, in one operation.</string>
|
||||
<string name="sync_authorize_first">File access is required. Authorize Documents/Trainlog first.</string>
|
||||
<string name="sync_request_sent">Request sent · waiting for the PC…</string>
|
||||
<string name="sync_generation_complete">Synchronization completed on Android and PC.</string>
|
||||
<string name="sync_android_unsupported">Android is not supported.</string>
|
||||
<string name="sync_folder_section">EXCHANGE FOLDER</string>
|
||||
<string name="sync_authorize_folder">Authorize access to the Trainlog folder</string>
|
||||
|
|
|
|||
|
|
@ -75,6 +75,7 @@
|
|||
<string name="sync_flow_description">Android → PC puis PC → Android, en une seule opération.</string>
|
||||
<string name="sync_authorize_first">Accès fichiers requis. Autorisez d’abord Documents/Trainlog.</string>
|
||||
<string name="sync_request_sent">Demande envoyée · attente du PC…</string>
|
||||
<string name="sync_generation_complete">Synchronisation terminée sur Android et PC.</string>
|
||||
<string name="sync_android_unsupported">Android non supporté.</string>
|
||||
<string name="sync_folder_section">DOSSIER D’ÉCHANGE</string>
|
||||
<string name="sync_authorize_folder">Autoriser l’accès au dossier Trainlog</string>
|
||||
|
|
|
|||
Loading…
Reference in a new issue