migrated custom timetable events to Marianum-Connect and refactored push notification handling
This commit is contained in:
+13
-12
@@ -178,22 +178,23 @@ class _AppState extends State<App> with WidgetsBindingObserver {
|
||||
if (mounted) setState(() {});
|
||||
});
|
||||
|
||||
TelemetryHeartbeat.report();
|
||||
TelemetryHeartbeat.report(
|
||||
notificationsEnabled:
|
||||
context.read<SettingsCubit>().val().notificationSettings.enabled,
|
||||
);
|
||||
|
||||
// A refreshed FCM token invalidates the existing push subscription — the
|
||||
// NC device identifier stays stable, so we simply re-register (NC first,
|
||||
// then the proxy). Debounced so a burst of refreshes triggers one call.
|
||||
if (context.read<SettingsCubit>().val().notificationSettings.enabled) {
|
||||
_fcmTokenRefreshSub = FirebaseMessaging.instance.onTokenRefresh.listen((
|
||||
_,
|
||||
) {
|
||||
Debouncer.debounce(
|
||||
'pushTokenRefresh',
|
||||
const Duration(seconds: 3),
|
||||
() => unawaited(PushRegistration().onTokenRefresh()),
|
||||
);
|
||||
});
|
||||
}
|
||||
// Not gated on the notification toggle: registration is kept alive even
|
||||
// when notifications are off so silent sync pushes keep flowing.
|
||||
_fcmTokenRefreshSub = FirebaseMessaging.instance.onTokenRefresh.listen((_) {
|
||||
Debouncer.debounce(
|
||||
'pushTokenRefresh',
|
||||
const Duration(seconds: 3),
|
||||
() => unawaited(PushRegistration().onTokenRefresh()),
|
||||
);
|
||||
});
|
||||
|
||||
// Android renders pushes locally, so a tap arrives via the local
|
||||
// notifications callback (PushTapRouter) rather than onMessageOpenedApp.
|
||||
|
||||
Reference in New Issue
Block a user