migrated custom timetable events to Marianum-Connect and refactored push notification handling
This commit is contained in:
@@ -27,6 +27,11 @@ class PushRegistrationStore {
|
||||
// (AccountData writes `nextcloud_app_password` group-scoped).
|
||||
static const _usernameKey = 'nextcloud_username';
|
||||
static const _baseUrlKey = 'nextcloud_base_url';
|
||||
// Mirror of the in-app notification toggle (`notificationSettings.enabled`),
|
||||
// written group-scoped so the FCM background isolate (no bloc access) and the
|
||||
// iOS NSE can gate rendering. The device stays *registered* when off so silent
|
||||
// sync pushes keep flowing — only the visible alert is suppressed.
|
||||
static const _notificationsEnabledKey = 'push_notifications_enabled';
|
||||
|
||||
static const _perTypeKeys = [
|
||||
_deviceIdentifierKey,
|
||||
@@ -82,6 +87,19 @@ class PushRegistrationStore {
|
||||
await _storage.write(key: _baseUrlKey, value: baseUrl);
|
||||
}
|
||||
|
||||
/// Mirrors the in-app notification toggle so the background isolate / iOS NSE
|
||||
/// can read it without bloc access.
|
||||
Future<void> setNotificationsEnabled(bool enabled) =>
|
||||
_storage.write(
|
||||
key: _notificationsEnabledKey,
|
||||
value: enabled ? '1' : '0',
|
||||
);
|
||||
|
||||
/// The mirrored notification toggle. Defaults to `true` when unset (fresh
|
||||
/// install / pre-mirror build) so a missing mirror never silences pushes.
|
||||
Future<bool> notificationsEnabled() async =>
|
||||
await _storage.read(key: _notificationsEnabledKey) != '0';
|
||||
|
||||
Future<String?> deviceIdentifier(PushRegistrationType type) =>
|
||||
_storage.read(key: keyFor(_deviceIdentifierKey, type));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user