From 2ac8128eff1db504b7f29e9fc3a43ac77d6f6c20 Mon Sep 17 00:00:00 2001 From: mohammad Date: Mon, 2 Dec 2024 14:27:47 +0300 Subject: [PATCH] actionType automation --- lib/features/scene/helper/scene_logic_helper.dart | 12 +++++++++--- lib/features/scene/model/create_scene_model.dart | 5 +++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/lib/features/scene/helper/scene_logic_helper.dart b/lib/features/scene/helper/scene_logic_helper.dart index 4f3c172..2042c30 100644 --- a/lib/features/scene/helper/scene_logic_helper.dart +++ b/lib/features/scene/helper/scene_logic_helper.dart @@ -99,6 +99,9 @@ mixin SceneLogicHelper { } if (task.code == CreateSceneEnum.smartSceneSelect.name) { return CreateSceneAction( + actionType: task.operationName.toLowerCase() == 'automation' + ? 'automation' + : 'scene', entityId: actions[index].deviceId, actionExecutor: actions[index].functionValue, executorProperty: null); @@ -173,21 +176,24 @@ mixin SceneLogicHelper { } } - Widget getTheCorrectDialogBody(SceneStaticFunction taskItem, dynamic functionValue, + Widget getTheCorrectDialogBody( + SceneStaticFunction taskItem, dynamic functionValue, {required bool isAutomation}) { if (taskItem.operationDialogType == OperationDialogType.temperature) { return AlertDialogTemperatureBody( taskItem: taskItem, functionValue: functionValue ?? taskItem.functionValue, ); - } else if ((taskItem.operationDialogType == OperationDialogType.countdown) || + } else if ((taskItem.operationDialogType == + OperationDialogType.countdown) || (taskItem.operationDialogType == OperationDialogType.delay)) { return AlertDialogCountdown( durationValue: taskItem.functionValue ?? 0, functionValue: functionValue ?? taskItem.functionValue, function: taskItem, ); - } else if (taskItem.operationDialogType == OperationDialogType.integerSteps) { + } else if (taskItem.operationDialogType == + OperationDialogType.integerSteps) { return AlertDialogSliderSteps( taskItem: taskItem, functionValue: functionValue ?? taskItem.functionValue, diff --git a/lib/features/scene/model/create_scene_model.dart b/lib/features/scene/model/create_scene_model.dart index c669aa9..088e9e6 100644 --- a/lib/features/scene/model/create_scene_model.dart +++ b/lib/features/scene/model/create_scene_model.dart @@ -95,21 +95,25 @@ class CreateSceneModel { class CreateSceneAction { String entityId; + String? actionType; String actionExecutor; CreateSceneExecutorProperty? executorProperty; CreateSceneAction({ + this.actionType, required this.entityId, required this.actionExecutor, required this.executorProperty, }); CreateSceneAction copyWith({ + String? actionType, String? entityId, String? actionExecutor, CreateSceneExecutorProperty? executorProperty, }) { return CreateSceneAction( + actionType: actionType, entityId: entityId ?? this.entityId, actionExecutor: actionExecutor ?? this.actionExecutor, executorProperty: executorProperty ?? this.executorProperty, @@ -125,6 +129,7 @@ class CreateSceneAction { }; } else { return { + "actionType": actionType, 'entityId': entityId, 'actionExecutor': actionExecutor, };