Starter...

This commit is contained in:
Hillel Coren 2020-03-02 22:35:43 +02:00
parent 06d9f7b4da
commit d4a2a6d5e1
3 changed files with 13 additions and 3 deletions

View File

@ -328,7 +328,6 @@ abstract class CompanyEntity extends Object
// TODO remove this
if ([
EntityType.recurringInvoice,
EntityType.credit,
EntityType.project,
EntityType.task,
EntityType.expense,

View File

@ -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<AppState, AppStateBuilder> {
// 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<AppState, AppStateBuilder> {
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')) {

View File

@ -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"