Clean up persistUi code
This commit is contained in:
parent
9016c25be0
commit
50ff6a76cc
|
|
@ -179,7 +179,6 @@ class UpdateUserPreferences implements PersistPrefs {
|
|||
this.customColors,
|
||||
this.darkCustomColors,
|
||||
this.persistData,
|
||||
this.persistUi,
|
||||
this.tapSelectedToEdit,
|
||||
this.showPdfPreview,
|
||||
this.showPdfPreviewSideBySide,
|
||||
|
|
@ -208,7 +207,6 @@ class UpdateUserPreferences implements PersistPrefs {
|
|||
final String colorTheme;
|
||||
final String darkColorTheme;
|
||||
final bool persistData;
|
||||
final bool persistUi;
|
||||
final bool tapSelectedToEdit;
|
||||
final double textScaleFactor;
|
||||
final bool showPdfPreview;
|
||||
|
|
|
|||
|
|
@ -240,8 +240,7 @@ Middleware<AppState> _createLoadState(
|
|||
})));
|
||||
|
||||
if (uiState.currentRoute != LoginScreen.route &&
|
||||
uiState.currentRoute.isNotEmpty &&
|
||||
prefState.persistUI) {
|
||||
uiState.currentRoute.isNotEmpty) {
|
||||
final NavigatorState navigator = navigatorKey.currentState;
|
||||
final routes = _getRoutes(appState);
|
||||
if (appState.prefState.appLayout == AppLayout.mobile) {
|
||||
|
|
@ -389,11 +388,9 @@ Middleware<AppState> _createPersistUI(PersistenceRepository uiRepository) {
|
|||
|
||||
next(action);
|
||||
|
||||
if (store.state.prefState.persistUI) {
|
||||
_persistUIDebouncer.run(() {
|
||||
uiRepository.saveUIState(store.state.uiState);
|
||||
});
|
||||
}
|
||||
_persistUIDebouncer.run(() {
|
||||
uiRepository.saveUIState(store.state.uiState);
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -85,7 +85,6 @@ PrefState prefReducer(
|
|||
..enableNativeBrowser =
|
||||
enableNativeBrowserReducer(state.enableNativeBrowser, action)
|
||||
..persistData = persistDataReducer(state.persistData, action)
|
||||
..persistUI = persistUIReducer(state.persistUI, action)
|
||||
..showKanban = showKanbanReducer(state.showKanban, action)
|
||||
..isFilterVisible = isFilterVisibleReducer(state.isFilterVisible, action)
|
||||
..longPressSelectionIsDefault =
|
||||
|
|
@ -384,12 +383,6 @@ Reducer<bool> persistDataReducer = combineReducers([
|
|||
}),
|
||||
]);
|
||||
|
||||
Reducer<bool> persistUIReducer = combineReducers([
|
||||
TypedReducer<bool, UpdateUserPreferences>((persistUI, action) {
|
||||
return action.persistUi ?? persistUI;
|
||||
}),
|
||||
]);
|
||||
|
||||
Reducer<bool> showKanbanReducer = combineReducers([
|
||||
TypedReducer<bool, UpdateUserPreferences>((showKanban, action) {
|
||||
return action.showKanban ?? showKanban;
|
||||
|
|
|
|||
|
|
@ -274,7 +274,6 @@ abstract class PrefState implements Built<PrefState, PrefStateBuilder> {
|
|||
..hideTwoYearReviewApp = false
|
||||
..tapSelectedToEdit = false
|
||||
..persistData = false
|
||||
..persistUI = true
|
||||
..editAfterSaving = true
|
||||
..showPdfPreview = true
|
||||
..showPdfPreviewSideBySide = false
|
||||
|
|
|
|||
|
|
@ -298,17 +298,6 @@ class _DeviceSettingsState extends State<DeviceSettings>
|
|||
secondary: Icon(MdiIcons.tooltip),
|
||||
),
|
||||
],
|
||||
/*
|
||||
SwitchListTile(
|
||||
title: Text(localization.persistUi),
|
||||
subtitle: Text(localization.persistUiHelp),
|
||||
value: prefState.persistUI,
|
||||
onChanged: (value) =>
|
||||
viewModel.onPersistUiChanged(context, value),
|
||||
activeColor: Theme.of(context).colorScheme.secondary,
|
||||
secondary: Icon(Icons.save_alt),
|
||||
),
|
||||
*/
|
||||
SwitchListTile(
|
||||
title: Text(localization.persistData),
|
||||
subtitle: Text(localization.persistDataHelp),
|
||||
|
|
|
|||
|
|
@ -52,7 +52,6 @@ class DeviceSettingsVM {
|
|||
@required this.onColorThemeChanged,
|
||||
@required this.onCustomColorsChanged,
|
||||
@required this.onPersistDataChanged,
|
||||
@required this.onPersistUiChanged,
|
||||
@required this.onShowPdfChanged,
|
||||
@required this.onEnableNativeBrowserChanged,
|
||||
@required this.onShowPdfSideBySideChanged,
|
||||
|
|
@ -198,12 +197,6 @@ class DeviceSettingsVM {
|
|||
store.dispatch(ClearPersistedData());
|
||||
}
|
||||
},
|
||||
onPersistUiChanged: (context, value) {
|
||||
store.dispatch(UpdateUserPreferences(persistUi: value));
|
||||
if (value) {
|
||||
store.dispatch(PersistUI());
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -221,7 +214,6 @@ class DeviceSettingsVM {
|
|||
final Function(BuildContext, bool) onEditAfterSavingChanged;
|
||||
final Function(BuildContext, bool) onRequireAuthenticationChanged;
|
||||
final Function(BuildContext, bool) onPersistDataChanged;
|
||||
final Function(BuildContext, bool) onPersistUiChanged;
|
||||
final Function(BuildContext, bool) onShowPdfChanged;
|
||||
final Function(BuildContext, bool) onEnableNativeBrowserChanged;
|
||||
final Function(BuildContext, bool) onShowPdfSideBySideChanged;
|
||||
|
|
|
|||
Loading…
Reference in New Issue