From 61c5aa94c2595f8796da459c77876cfe57dd4843 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..e9ecf16 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 Exception("UnifiedPush registration timed out."), ); } catch (_) { state = .data(false);