From d4a2a6d5e1629046b5860bef7718f81dc2069cfd Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Mon, 2 Mar 2020 22:35:43 +0200 Subject: [PATCH] Starter... --- lib/data/models/company_model.dart | 1 - lib/redux/app/app_state.dart | 9 ++++++++- starter.sh | 6 +++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/lib/data/models/company_model.dart b/lib/data/models/company_model.dart index 9c39cfb07..ff56f7561 100644 --- a/lib/data/models/company_model.dart +++ b/lib/data/models/company_model.dart @@ -328,7 +328,6 @@ abstract class CompanyEntity extends Object // TODO remove this if ([ EntityType.recurringInvoice, - EntityType.credit, EntityType.project, EntityType.task, EntityType.expense, diff --git a/lib/redux/app/app_state.dart b/lib/redux/app/app_state.dart index 48647c4e4..3490d2fee 100644 --- a/lib/redux/app/app_state.dart +++ b/lib/redux/app/app_state.dart @@ -9,6 +9,7 @@ import 'package:invoiceninja_flutter/redux/client/client_selectors.dart'; import 'package:invoiceninja_flutter/redux/client/client_state.dart'; import 'package:invoiceninja_flutter/redux/company/company_state.dart'; import 'package:invoiceninja_flutter/redux/company_gateway/company_gateway_selectors.dart'; +import 'package:invoiceninja_flutter/redux/credit/credit_selectors.dart'; import 'package:invoiceninja_flutter/redux/dashboard/dashboard_state.dart'; import 'package:invoiceninja_flutter/redux/document/document_state.dart'; import 'package:invoiceninja_flutter/redux/expense/expense_selectors.dart'; @@ -37,6 +38,7 @@ import 'package:invoiceninja_flutter/redux/vendor/vendor_state.dart'; import 'package:invoiceninja_flutter/ui/app/screen_imports.dart'; import 'package:invoiceninja_flutter/ui/client/edit/client_edit_vm.dart'; import 'package:invoiceninja_flutter/ui/company_gateway/edit/company_gateway_edit_vm.dart'; +import 'package:invoiceninja_flutter/ui/credit/edit/credit_edit_vm.dart'; import 'package:invoiceninja_flutter/ui/group/edit/group_edit_vm.dart'; import 'package:invoiceninja_flutter/ui/product/edit/product_edit_vm.dart'; @@ -47,6 +49,7 @@ import 'package:invoiceninja_flutter/redux/user/user_state.dart'; import 'package:invoiceninja_flutter/redux/tax_rate/tax_rate_state.dart'; import 'package:invoiceninja_flutter/redux/company_gateway/company_gateway_state.dart'; import 'package:invoiceninja_flutter/redux/group/group_state.dart'; +import 'package:invoiceninja_flutter/ui/quote/quote_edit.dart'; import 'package:invoiceninja_flutter/ui/tax_rate/edit/tax_rate_edit_vm.dart'; part 'app_state.g.dart'; @@ -315,7 +318,9 @@ abstract class AppState implements Built { // STARTER: state getters - do not remove comment CreditState get creditState => userCompanyState.creditState; + ListUIState get creditListState => uiState.creditUIState.listUIState; + CreditUIState get creditUIState => uiState.creditUIState; UserState get userState => userCompanyState.userState; @@ -416,7 +421,9 @@ abstract class AppState implements Built { case CompanyGatewayEditScreen.route: return hasCompanyGatewayChanges( companyGatewayUIState.editing, companyGatewayState.map); - // TODO add to stater.sh + case CreditEditScreen.route: + return hasCreditChanges(creditUIState.editing, creditState.map); + // STARTER: has changes - do not remove comment } if (uiState.currentRoute.startsWith('/settings')) { diff --git a/starter.sh b/starter.sh index 4202a165f..1e845b0ec 100644 --- a/starter.sh +++ b/starter.sh @@ -185,7 +185,7 @@ else # Link in new module comment="STARTER: import - do not remove comment" - code="import 'package:${package}\/redux\/${module_snake}\/${module_snake}_state.dart';${lineBreak}" + code="import 'package:${package}\/redux\/${module_snake}\/${module_snake}_state.dart';import 'package:invoiceninja_flutter/ui/${module_snake}/edit/${module_snake}_edit_vm.dart';${lineBreak}" sed -i -e "s/$comment/$comment${lineBreak}$code/g" ./lib/redux/app/app_state.dart comment="STARTER: states switch list - do not remove comment" @@ -206,6 +206,10 @@ else code="${code}${Module}UIState get ${module_camel}UIState => uiState.${module_camel}UIState;${lineBreak}${lineBreak}" sed -i -e "s/$comment/$comment${lineBreak}$code/g" ./lib/redux/app/app_state.dart + comment="STARTER: has changes - do not remove comment" + code="case ${Module}EditScreen.route: return has${Module}Changes(${module_camel}UIState.editing, ${module_camel}State.map);${lineBreak}" + sed -i -e "s/$comment/$comment${lineBreak}$code/g" ./lib/redux/app/app_state.dart + for (( idx=${#fieldsArray[@]}-1 ; idx>=0 ; idx-- )) ; do elements="${fieldsArray[idx]}" IFS=':' read -r -a elementArray <<< "$elements"