mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-11-27 02:54:55 +00:00
push fixes
This commit is contained in:
@ -250,6 +250,15 @@ class CreateSceneBloc extends Bloc<CreateSceneEvent, CreateSceneState>
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for (int i = 0; i < tasksList.length; i++) {
|
||||||
|
if (tasksList[i].code == event.code) {
|
||||||
|
tasksList[i] = tasksList[i].copyWith(
|
||||||
|
comparator: event.comparator ?? '==',
|
||||||
|
functionValue: event.value,
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
selectedValues[event.code] = event.value;
|
selectedValues[event.code] = event.value;
|
||||||
}
|
}
|
||||||
@ -330,15 +339,6 @@ class CreateSceneBloc extends Bloc<CreateSceneEvent, CreateSceneState>
|
|||||||
CreateSceneWithTasksEvent event, Emitter<CreateSceneState> emit) async {
|
CreateSceneWithTasksEvent event, Emitter<CreateSceneState> emit) async {
|
||||||
emit(CreateSceneLoading());
|
emit(CreateSceneLoading());
|
||||||
try {
|
try {
|
||||||
// Check for empty conditions or actions
|
|
||||||
if (event.createAutomationModel != null) {
|
|
||||||
if (event.createAutomationModel!.conditions.isEmpty) {
|
|
||||||
throw Exception('Conditions are required');
|
|
||||||
}
|
|
||||||
if (event.createAutomationModel!.actions.isEmpty) {
|
|
||||||
throw Exception('Actions are required');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
dynamic response;
|
dynamic response;
|
||||||
if (event.createSceneModel != null) {
|
if (event.createSceneModel != null) {
|
||||||
response = event.updateScene
|
response = event.updateScene
|
||||||
@ -367,11 +367,8 @@ class CreateSceneBloc extends Bloc<CreateSceneEvent, CreateSceneState>
|
|||||||
} else {
|
} else {
|
||||||
emit(const CreateSceneError(message: 'Something went wrong'));
|
emit(const CreateSceneError(message: 'Something went wrong'));
|
||||||
}
|
}
|
||||||
} on Exception catch (e) {
|
|
||||||
emit(CreateSceneError(message: e.toString()));
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
emit(const CreateSceneError(message: 'Something went wrong'));
|
emit(const CreateSceneError(message: 'Something went wrong'));
|
||||||
} finally {
|
|
||||||
emit(AddSceneTask(
|
emit(AddSceneTask(
|
||||||
tasksList: tasksList,
|
tasksList: tasksList,
|
||||||
automationTasksList: automationTasksList,
|
automationTasksList: automationTasksList,
|
||||||
@ -397,6 +394,18 @@ class CreateSceneBloc extends Bloc<CreateSceneEvent, CreateSceneState>
|
|||||||
emit(CreateSceneLoading());
|
emit(CreateSceneLoading());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
tasksList.clear();
|
||||||
|
tempTasksList.clear();
|
||||||
|
selectedValues.clear();
|
||||||
|
automationTasksList.clear();
|
||||||
|
automationTempTasksList.clear();
|
||||||
|
automationSelectedValues.clear();
|
||||||
|
automationComparatorValues.clear();
|
||||||
|
effectiveTime =
|
||||||
|
EffectiveTime(start: '00:00', end: '23:59', loops: '1111111');
|
||||||
|
sceneType = CreateSceneEnum.none;
|
||||||
|
conditionRule = 'or';
|
||||||
|
|
||||||
final response = event.isAutomation
|
final response = event.isAutomation
|
||||||
? await SceneApi.getAutomationDetails(event.sceneId)
|
? await SceneApi.getAutomationDetails(event.sceneId)
|
||||||
: await SceneApi.getSceneDetails(event.sceneId);
|
: await SceneApi.getSceneDetails(event.sceneId);
|
||||||
@ -421,16 +430,16 @@ class CreateSceneBloc extends Bloc<CreateSceneEvent, CreateSceneState>
|
|||||||
)
|
)
|
||||||
: EffectiveTime(start: '00:00', end: '23:59', loops: '1111111');
|
: EffectiveTime(start: '00:00', end: '23:59', loops: '1111111');
|
||||||
|
|
||||||
// Set Custom Time and reset days first
|
|
||||||
BlocProvider.of<EffectPeriodBloc>(
|
|
||||||
NavigationService.navigatorKey.currentContext!)
|
|
||||||
.add(SetCustomTime(effectiveTime!.start, effectiveTime!.end));
|
|
||||||
|
|
||||||
// Set the days directly from the API response
|
// Set the days directly from the API response
|
||||||
BlocProvider.of<EffectPeriodBloc>(
|
BlocProvider.of<EffectPeriodBloc>(
|
||||||
NavigationService.navigatorKey.currentContext!)
|
NavigationService.navigatorKey.currentContext!)
|
||||||
.add(SetDays(response.effectiveTime?.loops ?? '1111111'));
|
.add(SetDays(response.effectiveTime?.loops ?? '1111111'));
|
||||||
|
|
||||||
|
// Set Custom Time and reset days first
|
||||||
|
BlocProvider.of<EffectPeriodBloc>(
|
||||||
|
NavigationService.navigatorKey.currentContext!)
|
||||||
|
.add(SetCustomTime(effectiveTime!.start, effectiveTime!.end));
|
||||||
|
|
||||||
emit(AddSceneTask(
|
emit(AddSceneTask(
|
||||||
automationTasksList: automationTasksList,
|
automationTasksList: automationTasksList,
|
||||||
tasksList: tasksList,
|
tasksList: tasksList,
|
||||||
@ -536,6 +545,14 @@ class CreateSceneBloc extends Bloc<CreateSceneEvent, CreateSceneState>
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for (var i = 0; i < tasksList.length; i++) {
|
||||||
|
if (tasksList[i].uniqueCustomId == event.taskId) {
|
||||||
|
tasksList[i] = tasksList[i].copyWith(
|
||||||
|
functionValue: event.newValue,
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
for (var i = 0; i < tasksList.length; i++) {
|
for (var i = 0; i < tasksList.length; i++) {
|
||||||
if (tasksList[i].uniqueCustomId == event.taskId) {
|
if (tasksList[i].uniqueCustomId == event.taskId) {
|
||||||
@ -571,7 +588,7 @@ class CreateSceneBloc extends Bloc<CreateSceneEvent, CreateSceneState>
|
|||||||
|
|
||||||
FutureOr<void> _sceneTypeEvent(
|
FutureOr<void> _sceneTypeEvent(
|
||||||
SceneTypeEvent event, Emitter<CreateSceneState> emit) {
|
SceneTypeEvent event, Emitter<CreateSceneState> emit) {
|
||||||
emit(CreateSceneInitial());
|
// emit(CreateSceneInitial());
|
||||||
|
|
||||||
if (event.type == CreateSceneEnum.tabToRun) {
|
if (event.type == CreateSceneEnum.tabToRun) {
|
||||||
sceneType = CreateSceneEnum.tabToRun;
|
sceneType = CreateSceneEnum.tabToRun;
|
||||||
@ -581,7 +598,7 @@ class CreateSceneBloc extends Bloc<CreateSceneEvent, CreateSceneState>
|
|||||||
sceneType = CreateSceneEnum.none;
|
sceneType = CreateSceneEnum.none;
|
||||||
}
|
}
|
||||||
|
|
||||||
emit(SceneTypeState(event.type));
|
// emit(SceneTypeState(event.type));
|
||||||
}
|
}
|
||||||
|
|
||||||
FutureOr<void> _onEffectiveTimeEvent(
|
FutureOr<void> _onEffectiveTimeEvent(
|
||||||
|
|||||||
@ -42,6 +42,27 @@ mixin SceneLogicHelper {
|
|||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (isAutomation == true && conditions.isEmpty) {
|
||||||
|
context.showCustomSnackbar(
|
||||||
|
message: 'Conditions Must not be empty!',
|
||||||
|
icon: const Icon(
|
||||||
|
Icons.error,
|
||||||
|
color: Colors.red,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isAutomation == true && actions.isEmpty) {
|
||||||
|
context.showCustomSnackbar(
|
||||||
|
message: 'Actions Must not be empty!',
|
||||||
|
icon: const Icon(
|
||||||
|
Icons.error,
|
||||||
|
color: Colors.red,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (isAutomation) {
|
if (isAutomation) {
|
||||||
final createAutomationModel = CreateAutomationModel(
|
final createAutomationModel = CreateAutomationModel(
|
||||||
|
|||||||
@ -247,10 +247,12 @@ mixin SceneOperationsDataHelper {
|
|||||||
Action action,
|
Action action,
|
||||||
bool isAutomation, {
|
bool isAutomation, {
|
||||||
String? comparator,
|
String? comparator,
|
||||||
|
String? uniqueCustomId,
|
||||||
}) {
|
}) {
|
||||||
final executorProperty = action.executorProperty;
|
final executorProperty = action.executorProperty;
|
||||||
|
|
||||||
final Map<String, SceneStaticFunction Function(Action, bool, String?)>
|
final Map<String,
|
||||||
|
SceneStaticFunction Function(Action, bool, String?, String?)>
|
||||||
functionMap = {
|
functionMap = {
|
||||||
'sensitivity': _createSensitivityFunction,
|
'sensitivity': _createSensitivityFunction,
|
||||||
'normal_open_switch': _createNormalOpenSwitchFunction,
|
'normal_open_switch': _createNormalOpenSwitchFunction,
|
||||||
@ -294,7 +296,7 @@ mixin SceneOperationsDataHelper {
|
|||||||
final functionCode = executorProperty?.functionCode ?? '';
|
final functionCode = executorProperty?.functionCode ?? '';
|
||||||
final createFunction = functionMap[functionCode];
|
final createFunction = functionMap[functionCode];
|
||||||
if (createFunction != null) {
|
if (createFunction != null) {
|
||||||
return createFunction(action, isAutomation, comparator);
|
return createFunction(action, isAutomation, comparator, uniqueCustomId);
|
||||||
} else {
|
} else {
|
||||||
throw ArgumentError('Unsupported function code: $functionCode');
|
throw ArgumentError('Unsupported function code: $functionCode');
|
||||||
}
|
}
|
||||||
@ -309,9 +311,11 @@ mixin SceneOperationsDataHelper {
|
|||||||
List<SceneOperationalValue> operationalValues,
|
List<SceneOperationalValue> operationalValues,
|
||||||
bool isAutomation, [
|
bool isAutomation, [
|
||||||
String? comparator,
|
String? comparator,
|
||||||
|
String? uniqueCustomId,
|
||||||
]) {
|
]) {
|
||||||
final functionValue = action.executorProperty?.functionValue;
|
final functionValue = action.executorProperty?.functionValue;
|
||||||
return SceneStaticFunction(
|
return SceneStaticFunction(
|
||||||
|
uniqueCustomId: uniqueCustomId,
|
||||||
deviceId: action.entityId,
|
deviceId: action.entityId,
|
||||||
deviceName: deviceName,
|
deviceName: deviceName,
|
||||||
deviceIcon: icon,
|
deviceIcon: icon,
|
||||||
@ -325,8 +329,8 @@ mixin SceneOperationsDataHelper {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneStaticFunction _createSensitivityFunction(
|
SceneStaticFunction _createSensitivityFunction(Action action,
|
||||||
Action action, bool isAutomation, String? comparator) {
|
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'Presence Sensor',
|
'Presence Sensor',
|
||||||
@ -338,11 +342,12 @@ mixin SceneOperationsDataHelper {
|
|||||||
isAutomation ? _createIntegerStepsOptions() : _createSensitivityOptions(),
|
isAutomation ? _createIntegerStepsOptions() : _createSensitivityOptions(),
|
||||||
isAutomation,
|
isAutomation,
|
||||||
comparator,
|
comparator,
|
||||||
|
uniqueCustomId,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneStaticFunction _createNormalOpenSwitchFunction(
|
SceneStaticFunction _createNormalOpenSwitchFunction(Action action,
|
||||||
Action action, bool isAutomation, String? comparator) {
|
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'WIFI LOCK PRO',
|
'WIFI LOCK PRO',
|
||||||
@ -352,6 +357,7 @@ mixin SceneOperationsDataHelper {
|
|||||||
_createOnOffOptions(),
|
_createOnOffOptions(),
|
||||||
isAutomation,
|
isAutomation,
|
||||||
comparator,
|
comparator,
|
||||||
|
uniqueCustomId,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -394,8 +400,8 @@ mixin SceneOperationsDataHelper {
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneStaticFunction _createUnlockFingerprintFunction(
|
SceneStaticFunction _createUnlockFingerprintFunction(Action action,
|
||||||
Action action, bool isAutomation, String? comparator) {
|
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'WIFI LOCK PRO',
|
'WIFI LOCK PRO',
|
||||||
@ -405,11 +411,12 @@ mixin SceneOperationsDataHelper {
|
|||||||
_createFingerprintUnlockOptions(),
|
_createFingerprintUnlockOptions(),
|
||||||
isAutomation,
|
isAutomation,
|
||||||
comparator,
|
comparator,
|
||||||
|
uniqueCustomId,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneStaticFunction _createUnlockPasswordFunction(
|
SceneStaticFunction _createUnlockPasswordFunction(Action action,
|
||||||
Action action, bool isAutomation, String? comparator) {
|
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'WIFI LOCK PRO',
|
'WIFI LOCK PRO',
|
||||||
@ -419,11 +426,12 @@ mixin SceneOperationsDataHelper {
|
|||||||
_createPasswordUnlockOptions(),
|
_createPasswordUnlockOptions(),
|
||||||
isAutomation,
|
isAutomation,
|
||||||
comparator,
|
comparator,
|
||||||
|
uniqueCustomId,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneStaticFunction _createUnlockCardFunction(
|
SceneStaticFunction _createUnlockCardFunction(Action action,
|
||||||
Action action, bool isAutomation, String? comparator) {
|
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'WIFI LOCK PRO',
|
'WIFI LOCK PRO',
|
||||||
@ -433,11 +441,12 @@ mixin SceneOperationsDataHelper {
|
|||||||
_createCardUnlockOptions(),
|
_createCardUnlockOptions(),
|
||||||
isAutomation,
|
isAutomation,
|
||||||
comparator,
|
comparator,
|
||||||
|
uniqueCustomId,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneStaticFunction _createAlarmLockFunction(
|
SceneStaticFunction _createAlarmLockFunction(Action action, bool isAutomation,
|
||||||
Action action, bool isAutomation, String? comparator) {
|
String? comparator, String? uniqueCustomId) {
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'WIFI LOCK PRO',
|
'WIFI LOCK PRO',
|
||||||
@ -447,11 +456,12 @@ mixin SceneOperationsDataHelper {
|
|||||||
_createLockAlarmOptions(),
|
_createLockAlarmOptions(),
|
||||||
isAutomation,
|
isAutomation,
|
||||||
comparator,
|
comparator,
|
||||||
|
uniqueCustomId,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneStaticFunction _createUnlockRequestFunction(
|
SceneStaticFunction _createUnlockRequestFunction(Action action,
|
||||||
Action action, bool isAutomation, String? comparator) {
|
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'WIFI LOCK PRO',
|
'WIFI LOCK PRO',
|
||||||
@ -461,11 +471,12 @@ mixin SceneOperationsDataHelper {
|
|||||||
_createUnlockRequestOptions(),
|
_createUnlockRequestOptions(),
|
||||||
isAutomation,
|
isAutomation,
|
||||||
comparator,
|
comparator,
|
||||||
|
uniqueCustomId,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneStaticFunction _createResidualElectricityFunction(
|
SceneStaticFunction _createResidualElectricityFunction(Action action,
|
||||||
Action action, bool isAutomation, String? comparator) {
|
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'WIFI LOCK PRO',
|
'WIFI LOCK PRO',
|
||||||
@ -475,11 +486,12 @@ mixin SceneOperationsDataHelper {
|
|||||||
_createResidualElectricityOptions(),
|
_createResidualElectricityOptions(),
|
||||||
isAutomation,
|
isAutomation,
|
||||||
comparator,
|
comparator,
|
||||||
|
uniqueCustomId,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneStaticFunction _createReverseLockFunction(
|
SceneStaticFunction _createReverseLockFunction(Action action,
|
||||||
Action action, bool isAutomation, String? comparator) {
|
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'WIFI LOCK PRO',
|
'WIFI LOCK PRO',
|
||||||
@ -489,11 +501,12 @@ mixin SceneOperationsDataHelper {
|
|||||||
_createOnOffOptions(),
|
_createOnOffOptions(),
|
||||||
isAutomation,
|
isAutomation,
|
||||||
comparator,
|
comparator,
|
||||||
|
uniqueCustomId,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneStaticFunction _createUnlockAppFunction(
|
SceneStaticFunction _createUnlockAppFunction(Action action, bool isAutomation,
|
||||||
Action action, bool isAutomation, String? comparator) {
|
String? comparator, String? uniqueCustomId) {
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'WIFI LOCK PRO',
|
'WIFI LOCK PRO',
|
||||||
@ -503,11 +516,12 @@ mixin SceneOperationsDataHelper {
|
|||||||
_createUnlockAppOptions(),
|
_createUnlockAppOptions(),
|
||||||
isAutomation,
|
isAutomation,
|
||||||
comparator,
|
comparator,
|
||||||
|
uniqueCustomId,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneStaticFunction _createHijackFunction(
|
SceneStaticFunction _createHijackFunction(Action action, bool isAutomation,
|
||||||
Action action, bool isAutomation, String? comparator) {
|
String? comparator, String? uniqueCustomId) {
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'WIFI LOCK PRO',
|
'WIFI LOCK PRO',
|
||||||
@ -517,11 +531,12 @@ mixin SceneOperationsDataHelper {
|
|||||||
_createOnOffOptions(),
|
_createOnOffOptions(),
|
||||||
isAutomation,
|
isAutomation,
|
||||||
comparator,
|
comparator,
|
||||||
|
uniqueCustomId,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneStaticFunction _createDoorbellFunction(
|
SceneStaticFunction _createDoorbellFunction(Action action, bool isAutomation,
|
||||||
Action action, bool isAutomation, String? comparator) {
|
String? comparator, String? uniqueCustomId) {
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'WIFI LOCK PRO',
|
'WIFI LOCK PRO',
|
||||||
@ -531,11 +546,12 @@ mixin SceneOperationsDataHelper {
|
|||||||
_createOnOffOptions(),
|
_createOnOffOptions(),
|
||||||
isAutomation,
|
isAutomation,
|
||||||
comparator,
|
comparator,
|
||||||
|
uniqueCustomId,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneStaticFunction _createUnlockTemporaryFunction(
|
SceneStaticFunction _createUnlockTemporaryFunction(Action action,
|
||||||
Action action, bool isAutomation, String? comparator) {
|
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'WIFI LOCK PRO',
|
'WIFI LOCK PRO',
|
||||||
@ -545,11 +561,12 @@ mixin SceneOperationsDataHelper {
|
|||||||
_createTemporaryPasswordUnlockOptions(),
|
_createTemporaryPasswordUnlockOptions(),
|
||||||
isAutomation,
|
isAutomation,
|
||||||
comparator,
|
comparator,
|
||||||
|
uniqueCustomId,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneStaticFunction _createFarDetectionFunction(
|
SceneStaticFunction _createFarDetectionFunction(Action action,
|
||||||
Action action, bool isAutomation, String? comparator) {
|
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'Human Presence Sensor',
|
'Human Presence Sensor',
|
||||||
@ -559,11 +576,12 @@ mixin SceneOperationsDataHelper {
|
|||||||
_createFarDetectionOptions(),
|
_createFarDetectionOptions(),
|
||||||
isAutomation,
|
isAutomation,
|
||||||
comparator,
|
comparator,
|
||||||
|
uniqueCustomId,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneStaticFunction _createMotionSensitivityFunction(
|
SceneStaticFunction _createMotionSensitivityFunction(Action action,
|
||||||
Action action, bool isAutomation, String? comparator) {
|
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'Human Presence Sensor',
|
'Human Presence Sensor',
|
||||||
@ -573,11 +591,12 @@ mixin SceneOperationsDataHelper {
|
|||||||
_createSensitivityOptions(),
|
_createSensitivityOptions(),
|
||||||
isAutomation,
|
isAutomation,
|
||||||
comparator,
|
comparator,
|
||||||
|
uniqueCustomId,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneStaticFunction _createMotionlessSensitivityFunction(
|
SceneStaticFunction _createMotionlessSensitivityFunction(Action action,
|
||||||
Action action, bool isAutomation, String? comparator) {
|
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'Human Presence Sensor',
|
'Human Presence Sensor',
|
||||||
@ -587,11 +606,12 @@ mixin SceneOperationsDataHelper {
|
|||||||
_createSensitivityOptions(),
|
_createSensitivityOptions(),
|
||||||
isAutomation,
|
isAutomation,
|
||||||
comparator,
|
comparator,
|
||||||
|
uniqueCustomId,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneStaticFunction _createIndicatorFunction(
|
SceneStaticFunction _createIndicatorFunction(Action action, bool isAutomation,
|
||||||
Action action, bool isAutomation, String? comparator) {
|
String? comparator, String? uniqueCustomId) {
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'Human Presence Sensor',
|
'Human Presence Sensor',
|
||||||
@ -601,11 +621,12 @@ mixin SceneOperationsDataHelper {
|
|||||||
_createOnOffOptions(),
|
_createOnOffOptions(),
|
||||||
isAutomation,
|
isAutomation,
|
||||||
comparator,
|
comparator,
|
||||||
|
uniqueCustomId,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneStaticFunction _createPresenceTimeFunction(
|
SceneStaticFunction _createPresenceTimeFunction(Action action,
|
||||||
Action action, bool isAutomation, String? comparator) {
|
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'Human Presence Sensor',
|
'Human Presence Sensor',
|
||||||
@ -615,11 +636,12 @@ mixin SceneOperationsDataHelper {
|
|||||||
_createCountdownOptions(),
|
_createCountdownOptions(),
|
||||||
isAutomation,
|
isAutomation,
|
||||||
comparator,
|
comparator,
|
||||||
|
uniqueCustomId,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneStaticFunction _createPresenceStateFunction(
|
SceneStaticFunction _createPresenceStateFunction(Action action,
|
||||||
Action action, bool isAutomation, String? comparator) {
|
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'Human Presence Sensor',
|
'Human Presence Sensor',
|
||||||
@ -629,11 +651,12 @@ mixin SceneOperationsDataHelper {
|
|||||||
_createPresenceStateOptions(),
|
_createPresenceStateOptions(),
|
||||||
isAutomation,
|
isAutomation,
|
||||||
comparator,
|
comparator,
|
||||||
|
uniqueCustomId,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneStaticFunction _createDisCurrentFunction(
|
SceneStaticFunction _createDisCurrentFunction(Action action,
|
||||||
Action action, bool isAutomation, String? comparator) {
|
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'Human Presence Sensor',
|
'Human Presence Sensor',
|
||||||
@ -645,11 +668,12 @@ mixin SceneOperationsDataHelper {
|
|||||||
_createCurrentDistanceOptions(),
|
_createCurrentDistanceOptions(),
|
||||||
isAutomation,
|
isAutomation,
|
||||||
comparator,
|
comparator,
|
||||||
|
uniqueCustomId,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneStaticFunction _createIlluminanceValueFunction(
|
SceneStaticFunction _createIlluminanceValueFunction(Action action,
|
||||||
Action action, bool isAutomation, String? comparator) {
|
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'Human Presence Sensor',
|
'Human Presence Sensor',
|
||||||
@ -659,11 +683,12 @@ mixin SceneOperationsDataHelper {
|
|||||||
_createIlluminanceValueOptions(),
|
_createIlluminanceValueOptions(),
|
||||||
isAutomation,
|
isAutomation,
|
||||||
comparator,
|
comparator,
|
||||||
|
uniqueCustomId,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneStaticFunction _createCheckingResultFunction(
|
SceneStaticFunction _createCheckingResultFunction(Action action,
|
||||||
Action action, bool isAutomation, String? comparator) {
|
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'Human Presence Sensor',
|
'Human Presence Sensor',
|
||||||
@ -673,11 +698,12 @@ mixin SceneOperationsDataHelper {
|
|||||||
_createSelfTestResultOptions(),
|
_createSelfTestResultOptions(),
|
||||||
isAutomation,
|
isAutomation,
|
||||||
comparator,
|
comparator,
|
||||||
|
uniqueCustomId,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneStaticFunction _createSwitchFunction(
|
SceneStaticFunction _createSwitchFunction(Action action, bool isAutomation,
|
||||||
Action action, bool isAutomation, String? comparator) {
|
String? comparator, String? uniqueCustomId) {
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'Smart AC Thermostat - Grey - Model A',
|
'Smart AC Thermostat - Grey - Model A',
|
||||||
@ -687,11 +713,12 @@ mixin SceneOperationsDataHelper {
|
|||||||
_createOnOffOptions(),
|
_createOnOffOptions(),
|
||||||
isAutomation,
|
isAutomation,
|
||||||
comparator,
|
comparator,
|
||||||
|
uniqueCustomId,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneStaticFunction _createTempSetFunction(
|
SceneStaticFunction _createTempSetFunction(Action action, bool isAutomation,
|
||||||
Action action, bool isAutomation, String? comparator) {
|
String? comparator, String? uniqueCustomId) {
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'Smart AC Thermostat - Grey - Model A',
|
'Smart AC Thermostat - Grey - Model A',
|
||||||
@ -705,11 +732,12 @@ mixin SceneOperationsDataHelper {
|
|||||||
: _createTemperatureOptions(),
|
: _createTemperatureOptions(),
|
||||||
isAutomation,
|
isAutomation,
|
||||||
comparator,
|
comparator,
|
||||||
|
uniqueCustomId,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneStaticFunction _createTempCurrentFunction(
|
SceneStaticFunction _createTempCurrentFunction(Action action,
|
||||||
Action action, bool isAutomation, String? comparator) {
|
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'Smart AC Thermostat - Grey - Model A',
|
'Smart AC Thermostat - Grey - Model A',
|
||||||
@ -719,11 +747,12 @@ mixin SceneOperationsDataHelper {
|
|||||||
_createCurrentTemperatureOptions(),
|
_createCurrentTemperatureOptions(),
|
||||||
isAutomation,
|
isAutomation,
|
||||||
comparator,
|
comparator,
|
||||||
|
uniqueCustomId,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneStaticFunction _createModeFunction(
|
SceneStaticFunction _createModeFunction(Action action, bool isAutomation,
|
||||||
Action action, bool isAutomation, String? comparator) {
|
String? comparator, String? uniqueCustomId) {
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'Smart AC Thermostat - Grey - Model A',
|
'Smart AC Thermostat - Grey - Model A',
|
||||||
@ -733,11 +762,12 @@ mixin SceneOperationsDataHelper {
|
|||||||
_createAcModeOptions(),
|
_createAcModeOptions(),
|
||||||
isAutomation,
|
isAutomation,
|
||||||
comparator,
|
comparator,
|
||||||
|
uniqueCustomId,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneStaticFunction _createLevelFunction(
|
SceneStaticFunction _createLevelFunction(Action action, bool isAutomation,
|
||||||
Action action, bool isAutomation, String? comparator) {
|
String? comparator, String? uniqueCustomId) {
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'Smart AC Thermostat - Grey - Model A',
|
'Smart AC Thermostat - Grey - Model A',
|
||||||
@ -747,11 +777,12 @@ mixin SceneOperationsDataHelper {
|
|||||||
_createFanSpeedOptions(),
|
_createFanSpeedOptions(),
|
||||||
isAutomation,
|
isAutomation,
|
||||||
comparator,
|
comparator,
|
||||||
|
uniqueCustomId,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneStaticFunction _createChildLockFunction(
|
SceneStaticFunction _createChildLockFunction(Action action, bool isAutomation,
|
||||||
Action action, bool isAutomation, String? comparator) {
|
String? comparator, String? uniqueCustomId) {
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'Smart AC Thermostat - Grey - Model A',
|
'Smart AC Thermostat - Grey - Model A',
|
||||||
@ -761,11 +792,12 @@ mixin SceneOperationsDataHelper {
|
|||||||
_createOnOffOptions(),
|
_createOnOffOptions(),
|
||||||
isAutomation,
|
isAutomation,
|
||||||
comparator,
|
comparator,
|
||||||
|
uniqueCustomId,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneStaticFunction _createSwitch1Function(
|
SceneStaticFunction _createSwitch1Function(Action action, bool isAutomation,
|
||||||
Action action, bool isAutomation, String? comparator) {
|
String? comparator, String? uniqueCustomId) {
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'3 Gang Button Switch L-L',
|
'3 Gang Button Switch L-L',
|
||||||
@ -775,11 +807,12 @@ mixin SceneOperationsDataHelper {
|
|||||||
_createOnOffOptions(),
|
_createOnOffOptions(),
|
||||||
isAutomation,
|
isAutomation,
|
||||||
comparator,
|
comparator,
|
||||||
|
uniqueCustomId,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneStaticFunction _createSwitch2Function(
|
SceneStaticFunction _createSwitch2Function(Action action, bool isAutomation,
|
||||||
Action action, bool isAutomation, String? comparator) {
|
String? comparator, String? uniqueCustomId) {
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'3 Gang Button Switch L-L',
|
'3 Gang Button Switch L-L',
|
||||||
@ -789,11 +822,12 @@ mixin SceneOperationsDataHelper {
|
|||||||
_createOnOffOptions(),
|
_createOnOffOptions(),
|
||||||
isAutomation,
|
isAutomation,
|
||||||
comparator,
|
comparator,
|
||||||
|
uniqueCustomId,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneStaticFunction _createSwitch3Function(
|
SceneStaticFunction _createSwitch3Function(Action action, bool isAutomation,
|
||||||
Action action, bool isAutomation, String? comparator) {
|
String? comparator, String? uniqueCustomId) {
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'3 Gang Button Switch L-L',
|
'3 Gang Button Switch L-L',
|
||||||
@ -803,11 +837,12 @@ mixin SceneOperationsDataHelper {
|
|||||||
_createOnOffOptions(),
|
_createOnOffOptions(),
|
||||||
isAutomation,
|
isAutomation,
|
||||||
comparator,
|
comparator,
|
||||||
|
uniqueCustomId,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneStaticFunction _createCountdown1Function(
|
SceneStaticFunction _createCountdown1Function(Action action,
|
||||||
Action action, bool isAutomation, String? comparator) {
|
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'3 Gang Button Switch L-L',
|
'3 Gang Button Switch L-L',
|
||||||
@ -821,11 +856,12 @@ mixin SceneOperationsDataHelper {
|
|||||||
: _createCountdownOptions(),
|
: _createCountdownOptions(),
|
||||||
isAutomation,
|
isAutomation,
|
||||||
comparator,
|
comparator,
|
||||||
|
uniqueCustomId,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneStaticFunction _createCountdown2Function(
|
SceneStaticFunction _createCountdown2Function(Action action,
|
||||||
Action action, bool isAutomation, String? comparator) {
|
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'3 Gang Button Switch L-L',
|
'3 Gang Button Switch L-L',
|
||||||
@ -839,11 +875,12 @@ mixin SceneOperationsDataHelper {
|
|||||||
: _createCountdownOptions(),
|
: _createCountdownOptions(),
|
||||||
isAutomation,
|
isAutomation,
|
||||||
comparator,
|
comparator,
|
||||||
|
uniqueCustomId,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneStaticFunction _createCountdown3Function(
|
SceneStaticFunction _createCountdown3Function(Action action,
|
||||||
Action action, bool isAutomation, String? comparator) {
|
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'3 Gang Button Switch L-L',
|
'3 Gang Button Switch L-L',
|
||||||
@ -857,11 +894,12 @@ mixin SceneOperationsDataHelper {
|
|||||||
: _createCountdownOptions(),
|
: _createCountdownOptions(),
|
||||||
isAutomation,
|
isAutomation,
|
||||||
comparator,
|
comparator,
|
||||||
|
uniqueCustomId,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneStaticFunction _createSwitchAlarmSoundFunction(
|
SceneStaticFunction _createSwitchAlarmSoundFunction(Action action,
|
||||||
Action action, bool isAutomation, String? comparator) {
|
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'Gateway',
|
'Gateway',
|
||||||
@ -871,11 +909,12 @@ mixin SceneOperationsDataHelper {
|
|||||||
_createOnOffOptions(),
|
_createOnOffOptions(),
|
||||||
isAutomation,
|
isAutomation,
|
||||||
comparator,
|
comparator,
|
||||||
|
uniqueCustomId,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneStaticFunction _createMasterStateFunction(
|
SceneStaticFunction _createMasterStateFunction(Action action,
|
||||||
Action action, bool isAutomation, String? comparator) {
|
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'Gateway',
|
'Gateway',
|
||||||
@ -885,11 +924,12 @@ mixin SceneOperationsDataHelper {
|
|||||||
_createMasterStateOptions(),
|
_createMasterStateOptions(),
|
||||||
isAutomation,
|
isAutomation,
|
||||||
comparator,
|
comparator,
|
||||||
|
uniqueCustomId,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneStaticFunction _createFactoryResetFunction(
|
SceneStaticFunction _createFactoryResetFunction(Action action,
|
||||||
Action action, bool isAutomation, String? comparator) {
|
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'Gateway',
|
'Gateway',
|
||||||
@ -899,6 +939,7 @@ mixin SceneOperationsDataHelper {
|
|||||||
_createOnOffOptions(),
|
_createOnOffOptions(),
|
||||||
isAutomation,
|
isAutomation,
|
||||||
comparator,
|
comparator,
|
||||||
|
uniqueCustomId,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1181,6 +1222,7 @@ mixin SceneOperationsDataHelper {
|
|||||||
if (deviceId.contains('delay')) {
|
if (deviceId.contains('delay')) {
|
||||||
return [
|
return [
|
||||||
SceneStaticFunction(
|
SceneStaticFunction(
|
||||||
|
uniqueCustomId: taskItem.uniqueCustomId,
|
||||||
deviceId: taskItem.deviceId,
|
deviceId: taskItem.deviceId,
|
||||||
deviceName: 'delay',
|
deviceName: 'delay',
|
||||||
deviceIcon: Assets.delay,
|
deviceIcon: Assets.delay,
|
||||||
@ -1202,6 +1244,7 @@ mixin SceneOperationsDataHelper {
|
|||||||
if (taskItem.code == CreateSceneEnum.smartSceneSelect.name) {
|
if (taskItem.code == CreateSceneEnum.smartSceneSelect.name) {
|
||||||
return [
|
return [
|
||||||
SceneStaticFunction(
|
SceneStaticFunction(
|
||||||
|
uniqueCustomId: taskItem.uniqueCustomId,
|
||||||
deviceId: taskItem.deviceId,
|
deviceId: taskItem.deviceId,
|
||||||
deviceName: taskItem.deviceName.toString(),
|
deviceName: taskItem.deviceName.toString(),
|
||||||
deviceIcon: taskItem.operationName == 'automation'
|
deviceIcon: taskItem.operationName == 'automation'
|
||||||
@ -1241,6 +1284,7 @@ mixin SceneOperationsDataHelper {
|
|||||||
),
|
),
|
||||||
isAutomation,
|
isAutomation,
|
||||||
comparator: taskItem.comparator,
|
comparator: taskItem.comparator,
|
||||||
|
uniqueCustomId: taskItem.uniqueCustomId,
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,7 +11,7 @@ class SceneStaticFunction {
|
|||||||
final List<SceneOperationalValue> operationalValues;
|
final List<SceneOperationalValue> operationalValues;
|
||||||
final String deviceId;
|
final String deviceId;
|
||||||
final String operationName;
|
final String operationName;
|
||||||
final String uniqueCustomId;
|
final String? uniqueCustomId;
|
||||||
final dynamic functionValue;
|
final dynamic functionValue;
|
||||||
final String? deviceIcon;
|
final String? deviceIcon;
|
||||||
final OperationDialogType operationDialogType;
|
final OperationDialogType operationDialogType;
|
||||||
@ -28,7 +28,8 @@ class SceneStaticFunction {
|
|||||||
this.deviceIcon,
|
this.deviceIcon,
|
||||||
required this.operationDialogType,
|
required this.operationDialogType,
|
||||||
this.comparator,
|
this.comparator,
|
||||||
}) : uniqueCustomId = const Uuid().v4();
|
String? uniqueCustomId,
|
||||||
|
}) : uniqueCustomId = uniqueCustomId ?? const Uuid().v4();
|
||||||
|
|
||||||
SceneStaticFunction copyWith({
|
SceneStaticFunction copyWith({
|
||||||
String? icon,
|
String? icon,
|
||||||
@ -42,6 +43,7 @@ class SceneStaticFunction {
|
|||||||
String? deviceName,
|
String? deviceName,
|
||||||
OperationDialogType? operationDialogType,
|
OperationDialogType? operationDialogType,
|
||||||
String? comparator,
|
String? comparator,
|
||||||
|
String? uniqueCustomId,
|
||||||
}) {
|
}) {
|
||||||
return SceneStaticFunction(
|
return SceneStaticFunction(
|
||||||
icon: icon ?? this.icon,
|
icon: icon ?? this.icon,
|
||||||
@ -54,6 +56,7 @@ class SceneStaticFunction {
|
|||||||
deviceIcon: deviceIcon ?? this.deviceIcon,
|
deviceIcon: deviceIcon ?? this.deviceIcon,
|
||||||
operationDialogType: operationDialogType ?? this.operationDialogType,
|
operationDialogType: operationDialogType ?? this.operationDialogType,
|
||||||
comparator: comparator ?? this.comparator,
|
comparator: comparator ?? this.comparator,
|
||||||
|
uniqueCustomId: uniqueCustomId ?? const Uuid().v4(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,7 +71,8 @@ class SceneStaticFunction {
|
|||||||
'functionValue': functionValue,
|
'functionValue': functionValue,
|
||||||
'deviceIcon': deviceIcon,
|
'deviceIcon': deviceIcon,
|
||||||
'operationDialogType': operationDialogType.name,
|
'operationDialogType': operationDialogType.name,
|
||||||
'comparator': comparator
|
'comparator': comparator,
|
||||||
|
'uniqueCustomId': uniqueCustomId,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,6 +92,7 @@ class SceneStaticFunction {
|
|||||||
? OperationDialogType.values.byName(map['operationDialogType'])
|
? OperationDialogType.values.byName(map['operationDialogType'])
|
||||||
: OperationDialogType.none,
|
: OperationDialogType.none,
|
||||||
comparator: map['comparator'],
|
comparator: map['comparator'],
|
||||||
|
uniqueCustomId: map['uniqueCustomId'] ?? const Uuid().v4(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,7 +103,7 @@ class SceneStaticFunction {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'SceneStaticFunction(icon: $icon, name: $deviceName, code: $code, operationalValues: $operationalValues, deviceId: $deviceId, operationName: $operationName, functionValue: $functionValue, deviceIcon: $deviceIcon, operationDialogType: $operationDialogType, comparator: $comparator)';
|
return 'SceneStaticFunction(icon: $icon, name: $deviceName, code: $code, operationalValues: $operationalValues, deviceId: $deviceId, operationName: $operationName, functionValue: $functionValue, deviceIcon: $deviceIcon, operationDialogType: $operationDialogType, comparator: $comparator, uniqueCustomId: $uniqueCustomId)';
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -113,6 +118,7 @@ class SceneStaticFunction {
|
|||||||
other.functionValue == functionValue &&
|
other.functionValue == functionValue &&
|
||||||
other.deviceIcon == deviceIcon &&
|
other.deviceIcon == deviceIcon &&
|
||||||
other.comparator == comparator &&
|
other.comparator == comparator &&
|
||||||
|
other.uniqueCustomId == uniqueCustomId &&
|
||||||
other.operationDialogType == operationDialogType &&
|
other.operationDialogType == operationDialogType &&
|
||||||
listEquals(other.operationalValues, operationalValues) &&
|
listEquals(other.operationalValues, operationalValues) &&
|
||||||
other.deviceId == deviceId;
|
other.deviceId == deviceId;
|
||||||
@ -128,6 +134,7 @@ class SceneStaticFunction {
|
|||||||
functionValue.hashCode ^
|
functionValue.hashCode ^
|
||||||
deviceIcon.hashCode ^
|
deviceIcon.hashCode ^
|
||||||
comparator.hashCode ^
|
comparator.hashCode ^
|
||||||
|
uniqueCustomId.hashCode ^
|
||||||
operationDialogType.hashCode ^
|
operationDialogType.hashCode ^
|
||||||
operationalValues.hashCode;
|
operationalValues.hashCode;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -202,7 +202,7 @@ class DeviceFunctionsView extends StatelessWidget
|
|||||||
operation: function.operationName,
|
operation: function.operationName,
|
||||||
icon: device.icon ?? '',
|
icon: device.icon ?? '',
|
||||||
deviceName: device.name ?? '',
|
deviceName: device.name ?? '',
|
||||||
uniqueId: function.uniqueCustomId,
|
uniqueId: function.uniqueCustomId!,
|
||||||
operationType: function.operationDialogType,
|
operationType: function.operationDialogType,
|
||||||
));
|
));
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
@ -253,7 +253,7 @@ class DeviceFunctionsView extends StatelessWidget
|
|||||||
operation: function.operationName,
|
operation: function.operationName,
|
||||||
icon: device.icon ?? '',
|
icon: device.icon ?? '',
|
||||||
deviceName: device.name ?? '',
|
deviceName: device.name ?? '',
|
||||||
uniqueId: function.uniqueCustomId,
|
uniqueId: function.uniqueCustomId!,
|
||||||
operationType: function.operationDialogType,
|
operationType: function.operationDialogType,
|
||||||
isAutomation: true,
|
isAutomation: true,
|
||||||
));
|
));
|
||||||
|
|||||||
@ -29,6 +29,9 @@ class SceneTasksView extends StatelessWidget {
|
|||||||
|
|
||||||
final isAutomation =
|
final isAutomation =
|
||||||
sceneSettings.sceneType == CreateSceneEnum.deviceStatusChanges.name;
|
sceneSettings.sceneType == CreateSceneEnum.deviceStatusChanges.name;
|
||||||
|
// context.read<CreateSceneBloc>().add(SceneTypeEvent(isAutomation
|
||||||
|
// ? CreateSceneEnum.deviceStatusChanges
|
||||||
|
// : CreateSceneEnum.tabToRun));
|
||||||
|
|
||||||
return DefaultScaffold(
|
return DefaultScaffold(
|
||||||
title: sceneSettings.sceneName.isNotEmpty
|
title: sceneSettings.sceneName.isNotEmpty
|
||||||
|
|||||||
@ -31,6 +31,10 @@ class _AlertDialogSliderStepsState extends State<AlertDialogSliderSteps> {
|
|||||||
super.didChangeDependencies();
|
super.didChangeDependencies();
|
||||||
final createSceneBloc = context.read<CreateSceneBloc>();
|
final createSceneBloc = context.read<CreateSceneBloc>();
|
||||||
|
|
||||||
|
if (widget.taskItem.comparator != null) {
|
||||||
|
selectedToggleIndex = _comparatorToIndex(widget.taskItem.comparator);
|
||||||
|
}
|
||||||
|
|
||||||
if (widget.isAutomation) {
|
if (widget.isAutomation) {
|
||||||
final automationTempTaskList = createSceneBloc.automationTempTasksList;
|
final automationTempTaskList = createSceneBloc.automationTempTasksList;
|
||||||
final automationComparatorValues =
|
final automationComparatorValues =
|
||||||
@ -52,10 +56,6 @@ class _AlertDialogSliderStepsState extends State<AlertDialogSliderSteps> {
|
|||||||
_normalizeValue(widget.taskItem.operationalValues[0].minValue);
|
_normalizeValue(widget.taskItem.operationalValues[0].minValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (widget.taskItem.comparator != null) {
|
|
||||||
selectedToggleIndex = _comparatorToIndex(widget.taskItem.comparator);
|
|
||||||
}
|
|
||||||
|
|
||||||
setState(() {});
|
setState(() {});
|
||||||
|
|
||||||
context.read<CreateSceneBloc>().add(
|
context.read<CreateSceneBloc>().add(
|
||||||
@ -69,7 +69,7 @@ class _AlertDialogSliderStepsState extends State<AlertDialogSliderSteps> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
double _normalizeValue(dynamic value) {
|
double _normalizeValue(dynamic value) {
|
||||||
if (((widget.taskItem.code == "temp_set" && value > 200) ||
|
if (((widget.taskItem.code == "temp_set" && value > 199) ||
|
||||||
widget.taskItem.code == "temp_current")) {
|
widget.taskItem.code == "temp_current")) {
|
||||||
return (value) / 10;
|
return (value) / 10;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -49,13 +49,18 @@ class _AlertDialogTemperatureBodyState
|
|||||||
temperature = _normalizeTemperature(widget.functionValue);
|
temperature = _normalizeTemperature(widget.functionValue);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// context.read<CreateSceneBloc>().add(SelectedValueEvent(
|
||||||
|
// value: temperature * 10,
|
||||||
|
// code: widget.taskItem.code,
|
||||||
|
// ));
|
||||||
}
|
}
|
||||||
|
|
||||||
int _normalizeTemperature(dynamic value) {
|
int _normalizeTemperature(dynamic value) {
|
||||||
if (value is int && value >= 100) {
|
if (value >= 100) {
|
||||||
return value ~/ 10;
|
return value ~/ 10;
|
||||||
}
|
}
|
||||||
return value as int? ?? 24;
|
return value ?? 24;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@ -129,7 +129,7 @@ class CustomBottomSheetWidget extends StatelessWidget {
|
|||||||
operation: functions[0].operationName,
|
operation: functions[0].operationName,
|
||||||
icon: Assets.delay,
|
icon: Assets.delay,
|
||||||
deviceName: 'Delay The Action',
|
deviceName: 'Delay The Action',
|
||||||
uniqueId: functions[0].uniqueCustomId,
|
uniqueId: functions[0].uniqueCustomId!,
|
||||||
operationType: functions[0].operationDialogType,
|
operationType: functions[0].operationDialogType,
|
||||||
));
|
));
|
||||||
context.read<CreateSceneBloc>().add(const AddTaskEvent());
|
context.read<CreateSceneBloc>().add(const AddTaskEvent());
|
||||||
|
|||||||
@ -48,14 +48,10 @@ class _CreateSceneSaveButtonState extends State<CreateSceneSaveButton>
|
|||||||
if (state is CreateSceneWithTasks) {
|
if (state is CreateSceneWithTasks) {
|
||||||
if (state.success == true) {
|
if (state.success == true) {
|
||||||
navigateToRoute(context, Routes.homeRoute);
|
navigateToRoute(context, Routes.homeRoute);
|
||||||
context.showCustomSnackbar(
|
|
||||||
message: 'Scene created successfully',
|
|
||||||
icon: const Icon(
|
|
||||||
Icons.check,
|
|
||||||
color: Colors.green,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
sceneNameController.text = '';
|
sceneNameController.text = '';
|
||||||
|
CustomSnackBar.greenSnackBar('Scene created successfully');
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
} else if (state is CreateSceneError) {
|
} else if (state is CreateSceneError) {
|
||||||
CustomSnackBar.displaySnackBar(state.message);
|
CustomSnackBar.displaySnackBar(state.message);
|
||||||
|
|||||||
@ -19,6 +19,8 @@ import 'package:syncrow_app/utils/context_extension.dart';
|
|||||||
import 'package:syncrow_app/utils/helpers/snack_bar.dart';
|
import 'package:syncrow_app/utils/helpers/snack_bar.dart';
|
||||||
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
|
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
|
||||||
|
|
||||||
|
import '../../../../navigation/navigation_service.dart';
|
||||||
|
|
||||||
class ThenAddedTasksContainer extends StatelessWidget
|
class ThenAddedTasksContainer extends StatelessWidget
|
||||||
with SceneOperationsDataHelper, SceneLogicHelper {
|
with SceneOperationsDataHelper, SceneLogicHelper {
|
||||||
ThenAddedTasksContainer({
|
ThenAddedTasksContainer({
|
||||||
@ -121,7 +123,7 @@ class ThenAddedTasksContainer extends StatelessWidget
|
|||||||
createSceneBloc.add(
|
createSceneBloc.add(
|
||||||
UpdateTaskEvent(
|
UpdateTaskEvent(
|
||||||
newValue: automationSelectedValue,
|
newValue: automationSelectedValue,
|
||||||
taskId: taskItem.uniqueCustomId,
|
taskId: taskItem.uniqueCustomId!,
|
||||||
isAutomation: true,
|
isAutomation: true,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@ -136,7 +138,7 @@ class ThenAddedTasksContainer extends StatelessWidget
|
|||||||
createSceneBloc.add(
|
createSceneBloc.add(
|
||||||
UpdateTaskEvent(
|
UpdateTaskEvent(
|
||||||
newValue: selectedValue,
|
newValue: selectedValue,
|
||||||
taskId: taskItem.uniqueCustomId,
|
taskId: taskItem.uniqueCustomId!,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@ -144,7 +146,10 @@ class ThenAddedTasksContainer extends StatelessWidget
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Navigator.pop(context);
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
|
Navigator.pop(
|
||||||
|
NavigationService.navigatorKey.currentContext!);
|
||||||
|
});
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -172,7 +177,7 @@ class ThenAddedTasksContainer extends StatelessWidget
|
|||||||
),
|
),
|
||||||
direction: DismissDirection.endToStart,
|
direction: DismissDirection.endToStart,
|
||||||
onDismissed: (direction) {
|
onDismissed: (direction) {
|
||||||
String removeFunctionById = taskItem.uniqueCustomId;
|
String removeFunctionById = taskItem.uniqueCustomId!;
|
||||||
|
|
||||||
if (isAutomation == true) {
|
if (isAutomation == true) {
|
||||||
context.read<CreateSceneBloc>().add(RemoveTaskByIdEvent(
|
context.read<CreateSceneBloc>().add(RemoveTaskByIdEvent(
|
||||||
|
|||||||
@ -47,7 +47,7 @@ class ThenDefaultContainer extends StatelessWidget {
|
|||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: isClickable
|
onTap: isClickable
|
||||||
? () => context.customBottomSheet(
|
? () => context.customBottomSheet(
|
||||||
child: CustomBottomSheetWidget(sceneId:sceneId),
|
child: CustomBottomSheetWidget(sceneId: sceneId),
|
||||||
)
|
)
|
||||||
: null,
|
: null,
|
||||||
child: SvgPicture.asset(
|
child: SvgPicture.asset(
|
||||||
@ -99,7 +99,9 @@ class ThenDefaultContainer extends StatelessWidget {
|
|||||||
builder: (context) => const CreateSceneView()));
|
builder: (context) => const CreateSceneView()));
|
||||||
} else {
|
} else {
|
||||||
context.customBottomSheet(
|
context.customBottomSheet(
|
||||||
child: CustomBottomSheetWidget(sceneId: sceneId,),
|
child: CustomBottomSheetWidget(
|
||||||
|
sceneId: sceneId,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -35,6 +35,19 @@ class SceneItem extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return DefaultContainer(
|
return DefaultContainer(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
|
context.read<SmartSceneSelectBloc>().add(const SmartSceneClearEvent());
|
||||||
|
if (disablePlayButton == false) {
|
||||||
|
BlocProvider.of<CreateSceneBloc>(context).add(
|
||||||
|
FetchSceneTasksEvent(sceneId: scene.id, isAutomation: false));
|
||||||
|
BlocProvider.of<CreateSceneBloc>(context)
|
||||||
|
.add(const SceneTypeEvent(CreateSceneEnum.tabToRun));
|
||||||
|
} else {
|
||||||
|
BlocProvider.of<CreateSceneBloc>(context)
|
||||||
|
.add(FetchSceneTasksEvent(sceneId: scene.id, isAutomation: true));
|
||||||
|
BlocProvider.of<CreateSceneBloc>(context)
|
||||||
|
.add(const SceneTypeEvent(CreateSceneEnum.deviceStatusChanges));
|
||||||
|
}
|
||||||
|
|
||||||
Navigator.pushNamed(
|
Navigator.pushNamed(
|
||||||
context,
|
context,
|
||||||
Routes.sceneTasksRoute,
|
Routes.sceneTasksRoute,
|
||||||
@ -46,18 +59,6 @@ class SceneItem extends StatelessWidget {
|
|||||||
sceneName: scene.name,
|
sceneName: scene.name,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
context.read<SmartSceneSelectBloc>().add(const SmartSceneClearEvent());
|
|
||||||
if (disablePlayButton == false) {
|
|
||||||
BlocProvider.of<CreateSceneBloc>(context)
|
|
||||||
.add(const SceneTypeEvent(CreateSceneEnum.tabToRun));
|
|
||||||
BlocProvider.of<CreateSceneBloc>(context).add(
|
|
||||||
FetchSceneTasksEvent(sceneId: scene.id, isAutomation: false));
|
|
||||||
} else {
|
|
||||||
BlocProvider.of<CreateSceneBloc>(context)
|
|
||||||
.add(const SceneTypeEvent(CreateSceneEnum.deviceStatusChanges));
|
|
||||||
BlocProvider.of<CreateSceneBloc>(context)
|
|
||||||
.add(FetchSceneTasksEvent(sceneId: scene.id, isAutomation: true));
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
|||||||
@ -30,7 +30,7 @@ class CustomSnackBar {
|
|||||||
Text(
|
Text(
|
||||||
message,
|
message,
|
||||||
style: Theme.of(currentContext).textTheme.bodySmall!.copyWith(
|
style: Theme.of(currentContext).textTheme.bodySmall!.copyWith(
|
||||||
fontSize: 14, fontWeight: FontWeight.w500, color: Colors.green),
|
fontSize: 14, fontWeight: FontWeight.w500, color: Colors.white),
|
||||||
)
|
)
|
||||||
]),
|
]),
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user