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()
|
.getNotificationSettings()
|
||||||
.then((notificationSettings) {
|
.then((notificationSettings) {
|
||||||
_notificationSettings = notificationSettings;
|
_notificationSettings = notificationSettings;
|
||||||
|
emit(
|
||||||
|
state.copyWith(
|
||||||
|
isNotificationsEnabled: _notificationSettings.notificationsEnabled,
|
||||||
|
),
|
||||||
|
);
|
||||||
_initCompleter.complete();
|
_initCompleter.complete();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -26,13 +31,14 @@ class NotificationSettingsCubit extends Cubit<NotificationSettingsState> {
|
|||||||
await _initCompleter.future;
|
await _initCompleter.future;
|
||||||
|
|
||||||
_notificationSettings.notificationsEnabled = !state.isNotificationsEnabled;
|
_notificationSettings.notificationsEnabled = !state.isNotificationsEnabled;
|
||||||
_saveNotificationSettings();
|
|
||||||
|
|
||||||
emit(
|
emit(
|
||||||
state.copyWith(
|
state.copyWith(
|
||||||
isNotificationsEnabled: _notificationSettings.notificationsEnabled,
|
isNotificationsEnabled: _notificationSettings.notificationsEnabled,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
_saveNotificationSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _saveNotificationSettings() async {
|
Future<void> _saveNotificationSettings() async {
|
||||||
|
@ -241,6 +241,7 @@ impl std::default::Default for DateTimeSettingsPB {
|
|||||||
#[derive(ProtoBuf, Serialize, Deserialize, Debug, Clone)]
|
#[derive(ProtoBuf, Serialize, Deserialize, Debug, Clone)]
|
||||||
pub struct NotificationSettingsPB {
|
pub struct NotificationSettingsPB {
|
||||||
#[pb(index = 1)]
|
#[pb(index = 1)]
|
||||||
|
#[serde(default)]
|
||||||
pub notifications_enabled: bool,
|
pub notifications_enabled: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user