fix(download): always alert for verification pauses

This commit is contained in:
zarzet
2026-07-28 14:21:42 +07:00
parent 385afe290a
commit 209eb5f10e
2 changed files with 23 additions and 31 deletions
@@ -949,7 +949,11 @@ class DownloadService : Service() {
settingsJson = settingsJson,
includeItems = true,
)
scheduleNativeVerificationNotification(generation)
// Publish immediately. If Flutter is alive it will
// replace this same notification ID while owning
// the interactive challenge; if Flutter is
// suspended, the native alert remains visible.
showNativeVerificationRequired()
updateNotification(0L, 0L)
retryCurrentRequest = true
} else {
@@ -1267,21 +1271,6 @@ class DownloadService : Service() {
}
}
private fun scheduleNativeVerificationNotification(generation: Long) {
serviceScope.launch {
// Give an active Flutter poller time to take ownership of the
// verification flow. If Flutter is suspended, the service remains
// paused and publishes the alert itself.
delay(2_000L)
if (generation == nativeWorkerGeneration &&
nativeWorkerVerificationPaused &&
!nativeWorkerCancelRequested
) {
showNativeVerificationRequired()
}
}
}
private fun showNativeVerificationRequired() {
val pendingIntent = PendingIntent.getActivity(
this,