Settings wizard
This commit is contained in:
parent
e1361b429e
commit
772c2ce94b
|
|
@ -635,6 +635,7 @@ abstract class AppState implements Built<AppState, AppStateBuilder> {
|
|||
//return 'Selection: ${clientUIState.selectedId}';
|
||||
//return '${clientState.map[clientUIState.selectedId].gatewayTokens}';
|
||||
//return 'gatewayId: ${companyGatewayState.map[companyGatewayUIState.selectedId].gatewayId}';
|
||||
//return 'Language Id: ${company.settings.languageId}';
|
||||
return '\n\nURL: ${authState.url}\nRoute: ${uiState.currentRoute}\nPrev: ${uiState.previousRoute}\nIs Loaded: ${isLoaded ? 'Yes' : 'No'}\nis Large: ${(company?.isLarge ?? false) ? 'Yes' : 'No'}\nCompany: $companyUpdated${userCompanyState.isStale ? ' [S]' : ''}\nStatic: $staticUpdated${staticState.isStale ? ' [S]' : ''}\n';
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -86,3 +86,9 @@ class PurgeDataFailure implements StopSaving {
|
|||
|
||||
final Object error;
|
||||
}
|
||||
|
||||
class UpdateCompanyLanguage {
|
||||
UpdateCompanyLanguage({this.languageId});
|
||||
|
||||
final String languageId;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import 'package:invoiceninja_flutter/redux/task/task_reducer.dart';
|
|||
import 'package:invoiceninja_flutter/redux/project/project_reducer.dart';
|
||||
import 'package:invoiceninja_flutter/redux/payment/payment_reducer.dart';
|
||||
import 'package:invoiceninja_flutter/redux/quote/quote_reducer.dart';
|
||||
|
||||
// STARTER: import - do not remove comment
|
||||
import 'package:invoiceninja_flutter/redux/webhook/webhook_reducer.dart';
|
||||
import 'package:invoiceninja_flutter/redux/token/token_reducer.dart';
|
||||
|
|
@ -100,6 +101,10 @@ Reducer<UserCompanyEntity> userCompanyEntityReducer = combineReducers([
|
|||
(userCompany, action) => userCompany.rebuild((b) => b
|
||||
..user.userCompany.settings.replace(userCompany.settings)
|
||||
..settings.replace(action.userCompany.settings))),
|
||||
TypedReducer<UserCompanyEntity, UpdateCompanyLanguage>(
|
||||
(userCompany, action) => userCompany
|
||||
.rebuild((b) => b..company.settings.languageId = action.languageId),
|
||||
),
|
||||
]);
|
||||
|
||||
UserCompanyEntity loadCompanySuccessReducer(
|
||||
|
|
|
|||
|
|
@ -4,11 +4,11 @@ import 'package:invoiceninja_flutter/constants.dart';
|
|||
import 'package:invoiceninja_flutter/data/models/entities.dart';
|
||||
import 'package:invoiceninja_flutter/redux/app/app_actions.dart';
|
||||
import 'package:invoiceninja_flutter/redux/app/app_state.dart';
|
||||
import 'package:invoiceninja_flutter/redux/company/company_actions.dart';
|
||||
import 'package:invoiceninja_flutter/redux/static/static_selectors.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/app_builder.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/entity_dropdown.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/forms/app_form.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/forms/app_toggle_buttons.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/forms/decorated_form_field.dart';
|
||||
import 'package:invoiceninja_flutter/utils/localization.dart';
|
||||
import 'package:invoiceninja_flutter/utils/platforms.dart';
|
||||
|
|
@ -114,8 +114,12 @@ class _SettingsWizardState extends State<SettingsWizard> {
|
|||
entityList: memoizedLanguageList(state.staticState.languageMap),
|
||||
labelText: localization.language,
|
||||
entityId: _languageId,
|
||||
onSelected: (SelectableEntity language) =>
|
||||
setState(() => _languageId = language?.id),
|
||||
onSelected: (SelectableEntity language) {
|
||||
setState(() => _languageId = language?.id);
|
||||
print('## SET LANUGAGE TO ${language?.id}');
|
||||
store.dispatch(UpdateCompanyLanguage(languageId: language?.id));
|
||||
AppBuilder.of(context).rebuild();
|
||||
},
|
||||
validator: (dynamic value) =>
|
||||
value.isEmpty ? localization.pleaseEnterAValue : null,
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in New Issue