From d27d003a3ce285fd35076e35db957252217cc0ea Mon Sep 17 00:00:00 2001 From: Henry-Hiles Date: Mon, 5 Oct 2026 15:07:05 -0400 Subject: [PATCH] add timeout for UP reg --- lib/controllers/unified_push.dart | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/controllers/unified_push.dart b/lib/controllers/unified_push.dart index 3edad02..dbdd0ed 100644 --- a/lib/controllers/unified_push.dart +++ b/lib/controllers/unified_push.dart @@ -55,6 +55,9 @@ class UnifiedPushController extends AsyncNotifier { state = .data(true); }, + onRegistrationFailed: (reason, instance) { + throw reason; + }, onMessage: (message, instance) async { debugPrint("UP message received for $instance"); if (message.decrypted == false) { @@ -146,6 +149,9 @@ class UnifiedPushController extends AsyncNotifier { await UnifiedPush.register( instance: deviceId, vapid: capabilities.webpush?.vapid, + ).timeout( + .new(seconds: 15), + onTimeout: () => throw "UnifiedPush registration timed out.", ); } catch (_) { state = .data(false);