add timeout for UP reg
This commit is contained in:
parent
02ba9180db
commit
61c5aa94c2
1 changed files with 6 additions and 0 deletions
|
|
@ -55,6 +55,9 @@ class UnifiedPushController extends AsyncNotifier<bool> {
|
|||
|
||||
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<bool> {
|
|||
await UnifiedPush.register(
|
||||
instance: deviceId,
|
||||
vapid: capabilities.webpush?.vapid,
|
||||
).timeout(
|
||||
.new(seconds: 15),
|
||||
onTimeout: () => throw Exception("UnifiedPush registration timed out."),
|
||||
);
|
||||
} catch (_) {
|
||||
state = .data(false);
|
||||
|
|
|
|||
Loading…
Reference in a new issue