From 675d0bd3f052daf8864bb281af293ee2f9777289 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Mon, 2 Mar 2020 12:58:02 +0200 Subject: [PATCH] Working on starter.sh --- lib/redux/app/app_actions.dart | 14 +++++++------ starter.sh | 37 ++++++++++++++++++++++++++++++++-- 2 files changed, 43 insertions(+), 8 deletions(-) diff --git a/lib/redux/app/app_actions.dart b/lib/redux/app/app_actions.dart index 120734f0e..add3e1528 100644 --- a/lib/redux/app/app_actions.dart +++ b/lib/redux/app/app_actions.dart @@ -25,6 +25,7 @@ import 'package:invoiceninja_flutter/redux/vendor/vendor_actions.dart'; import 'package:invoiceninja_flutter/utils/completers.dart'; import 'package:invoiceninja_flutter/utils/dialogs.dart'; import 'package:invoiceninja_flutter/utils/localization.dart'; +// STARTER: import - do not remove comment class PersistUI {} @@ -228,7 +229,7 @@ void filterEntitiesByType({ entityType: filterEntity.entityType, )); break; - // TODO Add to starter + // STARTER: filter - do not remove comment } } @@ -297,7 +298,7 @@ void viewEntitiesByType({ case EntityType.group: store.dispatch(ViewGroupList(navigator: navigator)); break; - // TODO Add to starter + // STARTER: view list - do not remove comment } } @@ -421,7 +422,7 @@ void viewEntityById({ force: force, )); break; - // TODO Add to starter + // STARTER: view - do not remove comment } } @@ -535,7 +536,7 @@ void createEntityByType( group: GroupEntity(state: state), )); break; - // TODO Add to starter + // STARTER: create type - do not remove comment } } @@ -666,7 +667,7 @@ void createEntity({ completer: completer, )); break; - // TODO Add to starter + // STARTER: create - do not remove comment } } @@ -848,7 +849,7 @@ void editEntityById( : localization.updatedGroup), )); break; - // TODO Add to starter + // STARTER: edit - do not remove comment } } @@ -917,5 +918,6 @@ void handleEntitiesActions( break; case EntityType.document: handleDocumentAction(context, entities, action); + // STARTER: actions - do not remove comment } } diff --git a/starter.sh b/starter.sh index 302b58e43..6761644d3 100644 --- a/starter.sh +++ b/starter.sh @@ -374,7 +374,7 @@ else sed -i -e "s/$comment/$comment${lineBreak}$code/g" ./lib/redux/ui/ui_reducer.dart comment="STARTER: import - do not remove comment" - code="import 'package:invoiceninja_flutter/redux/product/${module_snake}_actions.dart';${lineBreak}" + code="import 'package:invoiceninja_flutter/redux/${module_snake}/${module_snake}_actions.dart';${lineBreak}" sed -i -e "s/$comment/$comment${lineBreak}$code/g" ./lib/redux/app/app_reducer.dart comment="STARTER: errors - do not remove comment" @@ -386,9 +386,42 @@ else sed -i -e "s/$comment/$comment${lineBreak}$code/g" ./lib/redux/ui/pref_reducer.dart comment="STARTER: import - do not remove comment" - code="import 'package:invoiceninja_flutter/redux/product/${module_snake}_actions.dart';${lineBreak}" + code="import 'package:invoiceninja_flutter/redux/${module_snake}/${module_snake}_actions.dart';${lineBreak}" sed -i -e "s/$comment/$comment${lineBreak}$code/g" ./lib/redux/ui/pref_reducer.dart + + comment="STARTER: import - do not remove comment" + code="import 'package:invoiceninja_flutter/redux/${module_snake}/${module_snake}_actions.dart';${lineBreak}" + sed -i -e "s/$comment/$comment${lineBreak}$code/g" ./lib/redux/app/app_actions.dart + + comment="STARTER: filter - do not remove comment" + code="case EntityType.${module_camel}: store.dispatch(Filter${Module}sByEntity(entityId: filterEntity.id, entityType: filterEntity.entityType,)); break;${lineBreak}" + sed -i -e "s/$comment/$comment${lineBreak}$code/g" ./lib/redux/app/app_actions.dart + + comment="STARTER: view list - do not remove comment" + code="case EntityType.${module_camel}: store.dispatch(View${Module}List(navigator: navigator)); break;${lineBreak}" + sed -i -e "s/$comment/$comment${lineBreak}$code/g" ./lib/redux/app/app_actions.dart + + comment="STARTER: view - do not remove comment" + code="case EntityType.${module_camel}: store.dispatch(View${Module}(${module_camel}Id: entityId, navigator: navigator, force: force,)); break;${lineBreak}" + sed -i -e "s/$comment/$comment${lineBreak}$code/g" ./lib/redux/app/app_actions.dart + + comment="STARTER: create type - do not remove comment" + code="case EntityType.${module_camel}: store.dispatch(Edit${Module}(navigator: navigator, force: force, group: ${Module}Entity(state: state), )); break;${lineBreak}" + sed -i -e "s/$comment/$comment${lineBreak}$code/g" ./lib/redux/app/app_actions.dart + + comment="STARTER: create - do not remove comment" + code="case EntityType.${module_camel}: store.dispatch(Edit${Module}(navigator: navigator, ${module_camel}: entity, force: force, completer: completer, )); break;${lineBreak}" + sed -i -e "s/$comment/$comment${lineBreak}$code/g" ./lib/redux/app/app_actions.dart + + comment="STARTER: edit - do not remove comment" + code="case EntityType.${module_camel}: store.dispatch(Edit${Module}(${module_camel}: map[entityId], navigator: navigator, completer: completer ?? snackBarCompleter<${Module}Entity>(context, entity.isNew ? localization.created${Module} : localization.updated${Module}),));break;${lineBreak}" + sed -i -e "s/$comment/$comment${lineBreak}$code/g" ./lib/redux/app/app_actions.dart + + comment="STARTER: actions - do not remove comment" + code="case EntityType.${module_camel}: handle${Module}Action(context, entities, action);${lineBreak}" + sed -i -e "s/$comment/$comment${lineBreak}$code/g" ./lib/redux/app/app_actions.dart + echo "Generating built files.." flutter packages pub run build_runner clean flutter packages pub run build_runner build --delete-conflicting-outputs