mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
fix: notification settings initial state (#3763)
This commit is contained in:
parent
b16a102f85
commit
cd6e133c86
@ -18,6 +18,11 @@ class NotificationSettingsCubit extends Cubit<NotificationSettingsState> {
|
||||
.getNotificationSettings()
|
||||
.then((notificationSettings) {
|
||||
_notificationSettings = notificationSettings;
|
||||
emit(
|
||||
state.copyWith(
|
||||
isNotificationsEnabled: _notificationSettings.notificationsEnabled,
|
||||
),
|
||||
);
|
||||
_initCompleter.complete();
|
||||
});
|
||||
}
|
||||
@ -26,13 +31,14 @@ class NotificationSettingsCubit extends Cubit<NotificationSettingsState> {
|
||||
await _initCompleter.future;
|
||||
|
||||
_notificationSettings.notificationsEnabled = !state.isNotificationsEnabled;
|
||||
_saveNotificationSettings();
|
||||
|
||||
emit(
|
||||
state.copyWith(
|
||||
isNotificationsEnabled: _notificationSettings.notificationsEnabled,
|
||||
),
|
||||
);
|
||||
|
||||
_saveNotificationSettings();
|
||||
}
|
||||
|
||||
Future<void> _saveNotificationSettings() async {
|
||||
|
@ -241,6 +241,7 @@ impl std::default::Default for DateTimeSettingsPB {
|
||||
#[derive(ProtoBuf, Serialize, Deserialize, Debug, Clone)]
|
||||
pub struct NotificationSettingsPB {
|
||||
#[pb(index = 1)]
|
||||
#[serde(default)]
|
||||
pub notifications_enabled: bool,
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user