Skip to content

Commit 4e66dfa

Browse files
veloceCopilot
andauthored
Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent 3f1a6db commit 4e66dfa

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

lib/src/model/notifications/notification_service.dart

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,21 @@ class NotificationService {
9898
/// This method should be called once the app is ready to receive notifications,
9999
/// and after [LichessBinding.initializeNotifications] has been called.
100100
Future<void> start() async {
101+
await _authEventsSubscription?.cancel();
101102
_authEventsSubscription = authEventsStream.listen((event) {
102103
switch (event) {
103104
case AuthEvent.signIn:
104-
registerDevice();
105+
unawaited(
106+
registerDevice().catchError((Object e, StackTrace st) {
107+
_logger.severe('Could not register device after sign-in:', e, st);
108+
}),
109+
);
105110
case AuthEvent.signOut:
106-
unregister();
111+
unawaited(
112+
unregister().catchError((Object e, StackTrace st) {
113+
_logger.severe('Could not unregister device after sign-out:', e, st);
114+
}),
115+
);
107116
}
108117
});
109118

0 commit comments

Comments
 (0)