Disable persistence

This commit is contained in:
Hillel Coren 2021-09-12 18:07:49 +03:00
parent 6a96b602de
commit 0cabae784d
3 changed files with 24 additions and 18 deletions

View File

@ -385,7 +385,7 @@ Middleware<AppState> _createUserLoggedIn(
uiRepository.saveUIState(state.uiState);
staticRepository.saveStaticState(state.staticState);
if (state.prefState.persistData || state.company.isSmall) {
if (state.prefState.persistData) {
for (var i = 0; i < state.userCompanyStates.length; i++) {
companyRepositories[i].saveCompanyState(state.userCompanyStates[i]);
}
@ -405,7 +405,7 @@ Middleware<AppState> _createPersistData(
final index = state.uiState.selectedCompanyIndex;
final companyState = state.userCompanyStates[index];
if (state.prefState.persistData || state.company.isSmall) {
if (state.prefState.persistData) {
companyRepositories[index].saveCompanyState(companyState);
}
};

View File

@ -216,17 +216,18 @@ class _DeviceSettingsState extends State<DeviceSettings>
activeColor: Theme.of(context).accentColor,
),
*/
if (state.company.isLarge || !kReleaseMode)
SwitchListTile(
//leading: Icon(Icons.save_alt),
title: Text(localization.persistData),
subtitle: Text(localization.persistDataHelp),
value: prefState.persistData,
onChanged: (value) =>
viewModel.onPersistDataChanged(context, value),
activeColor: Theme.of(context).accentColor,
secondary: Icon(Icons.save_alt),
),
SwitchListTile(
//leading: Icon(Icons.save_alt),
title: Text(localization.persistData),
subtitle: Text(prefState.persistData
? localization.disablingMayImprovePerformance
: localization.enablingMayDegradePerformance),
value: prefState.persistData,
onChanged: (value) =>
viewModel.onPersistDataChanged(context, value),
activeColor: Theme.of(context).accentColor,
secondary: Icon(Icons.save_alt),
),
Builder(builder: (BuildContext context) {
return ListTile(
leading: Icon(Icons.refresh),

View File

@ -15,6 +15,8 @@ mixin LocalizationsProvider on LocaleCodeAware {
static final Map<String, Map<String, String>> _localizedValues = {
'en': {
// STARTER: lang key - do not remove comment
'enabling_may_degrade_performance': 'Enabling may degrade performance',
'disabling_may_improve_performance': 'Disabling may improve performance',
'clone_to_expense': 'Clone to Expense',
'recurring_expense': 'Recurring Expense',
'recurring_expenses': 'Recurring Expenses',
@ -34,7 +36,6 @@ mixin LocalizationsProvider on LocaleCodeAware {
'is_invoiced': 'Is Invoiced',
'change_plan': 'Change Plan',
'persist_data': 'Persist Data',
'persist_data_help': 'Enabling may degrade performance in large accounts',
'customer_count': 'Customer Count',
'verify_customers': 'Verify Customers',
'google_analytics_tracking_id': 'Google Analytics Tracking ID',
@ -62529,10 +62530,6 @@ mixin LocalizationsProvider on LocaleCodeAware {
_localizedValues[localeCode]['persist_data'] ??
_localizedValues['en']['persist_data'];
String get persistDataHelp =>
_localizedValues[localeCode]['persist_data_help'] ??
_localizedValues['en']['persist_data_help'];
String get changePlan =>
_localizedValues[localeCode]['change_plan'] ??
_localizedValues['en']['change_plan'];
@ -62593,6 +62590,14 @@ mixin LocalizationsProvider on LocaleCodeAware {
_localizedValues[localeCode]['clone_to_expense'] ??
_localizedValues['en']['clone_to_expense'];
String get enablingMayDegradePerformance =>
_localizedValues[localeCode]['enabling_may_degrade_performance'] ??
_localizedValues['en']['enabling_may_degrade_performance'];
String get disablingMayImprovePerformance =>
_localizedValues[localeCode]['disabling_may_improve_performance'] ??
_localizedValues['en']['disabling_may_improve_performance'];
// STARTER: lang field - do not remove comment
String lookup(String key) {