mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-11-26 16:54:54 +00:00
Bug fixes
This commit is contained in:
@ -63,8 +63,7 @@ class HomeCubit extends Cubit<HomeState> {
|
|||||||
|
|
||||||
Future fetchUserInfo() async {
|
Future fetchUserInfo() async {
|
||||||
try {
|
try {
|
||||||
var uuid =
|
var uuid = await const FlutterSecureStorage().read(key: UserModel.userUuidKey);
|
||||||
await const FlutterSecureStorage().read(key: UserModel.userUuidKey);
|
|
||||||
user = await ProfileApi().fetchUserInfo(uuid);
|
user = await ProfileApi().fetchUserInfo(uuid);
|
||||||
emit(HomeUserInfoLoaded(user!)); // Emit state after fetching user info
|
emit(HomeUserInfoLoaded(user!)); // Emit state after fetching user info
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@ -85,12 +84,9 @@ class HomeCubit extends Cubit<HomeState> {
|
|||||||
selectedSpace = null;
|
selectedSpace = null;
|
||||||
selectedRoom = null;
|
selectedRoom = null;
|
||||||
pageIndex = 0;
|
pageIndex = 0;
|
||||||
OneSignal.User.pushSubscription
|
OneSignal.User.pushSubscription.removeObserver((stateChanges) => oneSignalSubscriptionObserver);
|
||||||
.removeObserver((stateChanges) => oneSignalSubscriptionObserver);
|
OneSignal.Notifications.removePermissionObserver((permission) => oneSignalPermissionObserver);
|
||||||
OneSignal.Notifications.removePermissionObserver(
|
OneSignal.Notifications.removeClickListener((event) => oneSignalClickListenerObserver);
|
||||||
(permission) => oneSignalPermissionObserver);
|
|
||||||
OneSignal.Notifications.removeClickListener(
|
|
||||||
(event) => oneSignalClickListenerObserver);
|
|
||||||
return super.close();
|
return super.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -132,9 +128,7 @@ class HomeCubit extends Cubit<HomeState> {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var userUuid =
|
var userUuid = await const FlutterSecureStorage().read(key: UserModel.userUuidKey) ?? '';
|
||||||
await const FlutterSecureStorage().read(key: UserModel.userUuidKey) ??
|
|
||||||
'';
|
|
||||||
if (userUuid.isNotEmpty) {
|
if (userUuid.isNotEmpty) {
|
||||||
await OneSignal.login(userUuid);
|
await OneSignal.login(userUuid);
|
||||||
}
|
}
|
||||||
@ -142,24 +136,21 @@ class HomeCubit extends Cubit<HomeState> {
|
|||||||
await OneSignal.User.pushSubscription.optIn();
|
await OneSignal.User.pushSubscription.optIn();
|
||||||
|
|
||||||
//this function will be called once a user is subscribed
|
//this function will be called once a user is subscribed
|
||||||
oneSignalSubscriptionObserver =
|
oneSignalSubscriptionObserver = OneSignal.User.pushSubscription.addObserver((state) async {
|
||||||
OneSignal.User.pushSubscription.addObserver((state) async {
|
|
||||||
if (state.current.optedIn) {
|
if (state.current.optedIn) {
|
||||||
await _sendSubscriptionId();
|
await _sendSubscriptionId();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Send the player id when a user allows notifications
|
// Send the player id when a user allows notifications
|
||||||
oneSignalPermissionObserver =
|
oneSignalPermissionObserver = OneSignal.Notifications.addPermissionObserver((state) async {
|
||||||
OneSignal.Notifications.addPermissionObserver((state) async {
|
|
||||||
await _sendSubscriptionId();
|
await _sendSubscriptionId();
|
||||||
});
|
});
|
||||||
|
|
||||||
//check if the player id is sent, if not send it again
|
//check if the player id is sent, if not send it again
|
||||||
await _sendSubscriptionId();
|
await _sendSubscriptionId();
|
||||||
|
|
||||||
oneSignalClickListenerObserver =
|
oneSignalClickListenerObserver = OneSignal.Notifications.addClickListener((event) async {
|
||||||
OneSignal.Notifications.addClickListener((event) async {
|
|
||||||
//Once the user clicks on the notification
|
//Once the user clicks on the notification
|
||||||
});
|
});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@ -246,9 +237,7 @@ class HomeCubit extends Cubit<HomeState> {
|
|||||||
|
|
||||||
Future<bool> joinAUnit(String code) async {
|
Future<bool> joinAUnit(String code) async {
|
||||||
try {
|
try {
|
||||||
var uuid =
|
var uuid = await const FlutterSecureStorage().read(key: UserModel.userUuidKey) ?? '';
|
||||||
await const FlutterSecureStorage().read(key: UserModel.userUuidKey) ??
|
|
||||||
'';
|
|
||||||
Map<String, String> body = {'userUuid': uuid, 'inviteCode': code};
|
Map<String, String> body = {'userUuid': uuid, 'inviteCode': code};
|
||||||
|
|
||||||
final success = await SpacesAPI.joinUnit(body);
|
final success = await SpacesAPI.joinUnit(body);
|
||||||
@ -360,50 +349,47 @@ class HomeCubit extends Cubit<HomeState> {
|
|||||||
// ),
|
// ),
|
||||||
// onPressed: () {},
|
// onPressed: () {},
|
||||||
// ),
|
// ),
|
||||||
IconButton(
|
// IconButton(
|
||||||
icon: const Icon(
|
// icon: const Icon(
|
||||||
Icons.add,
|
// Icons.add,
|
||||||
size: 32,
|
// size: 32,
|
||||||
),
|
// ),
|
||||||
style: ButtonStyle(
|
// style: ButtonStyle(
|
||||||
foregroundColor:
|
// foregroundColor: WidgetStateProperty.all(ColorsManager.textPrimaryColor),
|
||||||
WidgetStateProperty.all(ColorsManager.textPrimaryColor),
|
// ),
|
||||||
),
|
// onPressed: () {
|
||||||
onPressed: () {
|
// Navigator.pushNamed(
|
||||||
Navigator.pushNamed(
|
// NavigationService.navigatorKey.currentContext!,
|
||||||
NavigationService.navigatorKey.currentContext!,
|
// Routes.sceneTasksRoute,
|
||||||
Routes.sceneTasksRoute,
|
// arguments: SceneSettingsRouteArguments(
|
||||||
arguments: SceneSettingsRouteArguments(
|
// sceneType: '',
|
||||||
sceneType: '',
|
// sceneId: '',
|
||||||
sceneId: '',
|
// sceneName: '',
|
||||||
sceneName: '',
|
// ),
|
||||||
),
|
// );
|
||||||
);
|
// NavigationService.navigatorKey.currentContext!
|
||||||
NavigationService.navigatorKey.currentContext!
|
// .read<CreateSceneBloc>()
|
||||||
.read<CreateSceneBloc>()
|
// .add(const ClearTaskListEvent());
|
||||||
.add(const ClearTaskListEvent());
|
// NavigationService.navigatorKey.currentContext!
|
||||||
NavigationService.navigatorKey.currentContext!
|
// .read<CreateSceneBloc>()
|
||||||
.read<CreateSceneBloc>()
|
// .add(const SceneTypeEvent(CreateSceneEnum.none));
|
||||||
.add(const SceneTypeEvent(CreateSceneEnum.none));
|
// NavigationService.navigatorKey.currentContext!
|
||||||
NavigationService.navigatorKey.currentContext!
|
// .read<SmartSceneSelectBloc>()
|
||||||
.read<SmartSceneSelectBloc>()
|
// .add(const SmartSceneClearEvent());
|
||||||
.add(const SmartSceneClearEvent());
|
// BlocProvider.of<EffectPeriodBloc>(NavigationService.navigatorKey.currentState!.context)
|
||||||
BlocProvider.of<EffectPeriodBloc>(
|
// .add(ResetEffectivePeriod());
|
||||||
NavigationService.navigatorKey.currentState!.context)
|
// },
|
||||||
.add(ResetEffectivePeriod());
|
// ),
|
||||||
},
|
// IconButton(
|
||||||
),
|
// icon: const Icon(
|
||||||
IconButton(
|
// Icons.more_vert,
|
||||||
icon: const Icon(
|
// size: 28,
|
||||||
Icons.more_vert,
|
// ),
|
||||||
size: 28,
|
// style: ButtonStyle(
|
||||||
),
|
// foregroundColor: WidgetStateProperty.all(ColorsManager.textPrimaryColor),
|
||||||
style: ButtonStyle(
|
// ),
|
||||||
foregroundColor:
|
// onPressed: () {},
|
||||||
WidgetStateProperty.all(ColorsManager.textPrimaryColor),
|
// ),
|
||||||
),
|
|
||||||
onPressed: () {},
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
'Menu': [
|
'Menu': [
|
||||||
IconButton(
|
IconButton(
|
||||||
@ -433,8 +419,7 @@ class HomeCubit extends Cubit<HomeState> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static var bottomNavItems = [
|
static var bottomNavItems = [
|
||||||
defaultBottomNavBarItem(
|
defaultBottomNavBarItem(icon: Assets.assetsIconsDashboard, label: 'Dashboard'),
|
||||||
icon: Assets.assetsIconsDashboard, label: 'Dashboard'),
|
|
||||||
// defaultBottomNavBarItem(icon: Assets.assetsIconslayout, label: 'Layout'),
|
// defaultBottomNavBarItem(icon: Assets.assetsIconslayout, label: 'Layout'),
|
||||||
defaultBottomNavBarItem(icon: Assets.assetsIconsDevices, label: 'Devices'),
|
defaultBottomNavBarItem(icon: Assets.assetsIconsDevices, label: 'Devices'),
|
||||||
defaultBottomNavBarItem(icon: Assets.assetsIconsRoutines, label: 'Routine'),
|
defaultBottomNavBarItem(icon: Assets.assetsIconsRoutines, label: 'Routine'),
|
||||||
@ -460,8 +445,7 @@ class HomeCubit extends Cubit<HomeState> {
|
|||||||
|
|
||||||
void updateDevice(String deviceId) async {
|
void updateDevice(String deviceId) async {
|
||||||
try {
|
try {
|
||||||
final response = await DevicesAPI.firmwareDevice(
|
final response = await DevicesAPI.firmwareDevice(deviceId: deviceId, firmwareVersion: '0');
|
||||||
deviceId: deviceId, firmwareVersion: '0');
|
|
||||||
if (response['success'] ?? false) {
|
if (response['success'] ?? false) {
|
||||||
CustomSnackBar.displaySnackBar('No updates available');
|
CustomSnackBar.displaySnackBar('No updates available');
|
||||||
}
|
}
|
||||||
@ -469,8 +453,7 @@ class HomeCubit extends Cubit<HomeState> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BottomNavigationBarItem defaultBottomNavBarItem(
|
BottomNavigationBarItem defaultBottomNavBarItem({required String icon, required String label}) {
|
||||||
{required String icon, required String label}) {
|
|
||||||
return BottomNavigationBarItem(
|
return BottomNavigationBarItem(
|
||||||
icon: SvgPicture.asset(icon),
|
icon: SvgPicture.asset(icon),
|
||||||
activeIcon: SvgPicture.asset(
|
activeIcon: SvgPicture.asset(
|
||||||
|
|||||||
@ -26,12 +26,14 @@ class RoomsView extends StatelessWidget {
|
|||||||
title: 'Space Management',
|
title: 'Space Management',
|
||||||
child: state is LoadingState
|
child: state is LoadingState
|
||||||
? const Center(child: RefreshProgressIndicator())
|
? const Center(child: RefreshProgressIndicator())
|
||||||
: Container(
|
: SizedBox(
|
||||||
margin: const EdgeInsets.only(top: 32),
|
|
||||||
width: MediaQuery.sizeOf(context).width,
|
width: MediaQuery.sizeOf(context).width,
|
||||||
height: MediaQuery.sizeOf(context).height,
|
height: MediaQuery.sizeOf(context).height,
|
||||||
child: Column(
|
child: ListView(
|
||||||
children: [
|
children: [
|
||||||
|
const SizedBox(
|
||||||
|
height: 32,
|
||||||
|
),
|
||||||
if (state is FetchRoomsState)
|
if (state is FetchRoomsState)
|
||||||
Container(
|
Container(
|
||||||
decoration: const ShapeDecoration(
|
decoration: const ShapeDecoration(
|
||||||
|
|||||||
@ -55,7 +55,7 @@ class ProfileTab extends StatelessWidget {
|
|||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
),
|
),
|
||||||
BodyMedium(
|
BodyMedium(
|
||||||
text: HomeCubit.user!.lastName ?? '',
|
text: HomeCubit.user?.lastName ?? '',
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@ -53,8 +53,7 @@ class CreateSceneBloc extends Bloc<CreateSceneEvent, CreateSceneState>
|
|||||||
String conditionRule = 'or';
|
String conditionRule = 'or';
|
||||||
EffectiveTime? effectiveTime;
|
EffectiveTime? effectiveTime;
|
||||||
|
|
||||||
FutureOr<void> _onAddSceneTask(
|
FutureOr<void> _onAddSceneTask(AddTaskEvent event, Emitter<CreateSceneState> emit) {
|
||||||
AddTaskEvent event, Emitter<CreateSceneState> emit) {
|
|
||||||
emit(CreateSceneLoading());
|
emit(CreateSceneLoading());
|
||||||
if (event.isAutomation == true) {
|
if (event.isAutomation == true) {
|
||||||
final copyList = List<SceneStaticFunction>.from(automationTempTasksList);
|
final copyList = List<SceneStaticFunction>.from(automationTempTasksList);
|
||||||
@ -89,8 +88,7 @@ class CreateSceneBloc extends Bloc<CreateSceneEvent, CreateSceneState>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void addToTempTaskList(
|
void addToTempTaskList(TempHoldSceneTasksEvent event, Emitter<CreateSceneState> emit) {
|
||||||
TempHoldSceneTasksEvent event, Emitter<CreateSceneState> emit) {
|
|
||||||
emit(CreateSceneLoading());
|
emit(CreateSceneLoading());
|
||||||
bool updated = false;
|
bool updated = false;
|
||||||
|
|
||||||
@ -175,8 +173,7 @@ class CreateSceneBloc extends Bloc<CreateSceneEvent, CreateSceneState>
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
void addToTempAutomationTaskList(
|
void addToTempAutomationTaskList(TempHoldSceneTasksEvent event, Emitter<CreateSceneState> emit) {
|
||||||
TempHoldSceneTasksEvent event, Emitter<CreateSceneState> emit) {
|
|
||||||
emit(CreateSceneLoading());
|
emit(CreateSceneLoading());
|
||||||
bool updated = false;
|
bool updated = false;
|
||||||
for (var element in automationTempTasksList) {
|
for (var element in automationTempTasksList) {
|
||||||
@ -198,10 +195,8 @@ class CreateSceneBloc extends Bloc<CreateSceneEvent, CreateSceneState>
|
|||||||
],
|
],
|
||||||
comparator: automationComparatorValues[element.code],
|
comparator: automationComparatorValues[element.code],
|
||||||
);
|
);
|
||||||
automationTempTasksList[automationTempTasksList.indexOf(element)] =
|
automationTempTasksList[automationTempTasksList.indexOf(element)] = updatedElement;
|
||||||
updatedElement;
|
automationSelectedValues[updatedElement.code] = event.deviceControlModel.value;
|
||||||
automationSelectedValues[updatedElement.code] =
|
|
||||||
event.deviceControlModel.value;
|
|
||||||
updated = true;
|
updated = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -221,12 +216,10 @@ class CreateSceneBloc extends Bloc<CreateSceneEvent, CreateSceneState>
|
|||||||
icon: '',
|
icon: '',
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
comparator:
|
comparator: automationComparatorValues[event.deviceControlModel.code] ?? '==',
|
||||||
automationComparatorValues[event.deviceControlModel.code] ?? '==',
|
|
||||||
);
|
);
|
||||||
automationTempTasksList.add(newElement);
|
automationTempTasksList.add(newElement);
|
||||||
automationSelectedValues[newElement.code] =
|
automationSelectedValues[newElement.code] = event.deviceControlModel.value;
|
||||||
event.deviceControlModel.value;
|
|
||||||
}
|
}
|
||||||
emit(AddSceneTask(
|
emit(AddSceneTask(
|
||||||
tasksList: tasksList,
|
tasksList: tasksList,
|
||||||
@ -235,8 +228,7 @@ class CreateSceneBloc extends Bloc<CreateSceneEvent, CreateSceneState>
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
FutureOr<void> _selectedValue(
|
FutureOr<void> _selectedValue(SelectedValueEvent event, Emitter<CreateSceneState> emit) {
|
||||||
SelectedValueEvent event, Emitter<CreateSceneState> emit) {
|
|
||||||
if (event.isAutomation == true) {
|
if (event.isAutomation == true) {
|
||||||
automationSelectedValues[event.code] = event.value;
|
automationSelectedValues[event.code] = event.value;
|
||||||
automationComparatorValues[event.code] = event.comparator ?? '==';
|
automationComparatorValues[event.code] = event.comparator ?? '==';
|
||||||
@ -273,8 +265,7 @@ class CreateSceneBloc extends Bloc<CreateSceneEvent, CreateSceneState>
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
FutureOr<void> _removeTaskById(
|
FutureOr<void> _removeTaskById(RemoveTaskByIdEvent event, Emitter<CreateSceneState> emit) {
|
||||||
RemoveTaskByIdEvent event, Emitter<CreateSceneState> emit) {
|
|
||||||
emit(CreateSceneLoading());
|
emit(CreateSceneLoading());
|
||||||
if (event.isAutomation == true) {
|
if (event.isAutomation == true) {
|
||||||
for (var element in automationTasksList) {
|
for (var element in automationTasksList) {
|
||||||
@ -347,8 +338,7 @@ class CreateSceneBloc extends Bloc<CreateSceneEvent, CreateSceneState>
|
|||||||
: await SceneApi.createScene(event.createSceneModel!);
|
: await SceneApi.createScene(event.createSceneModel!);
|
||||||
} else if (event.createAutomationModel != null) {
|
} else if (event.createAutomationModel != null) {
|
||||||
response = event.updateScene
|
response = event.updateScene
|
||||||
? await SceneApi.updateAutomation(
|
? await SceneApi.updateAutomation(event.createAutomationModel!, event.sceneId)
|
||||||
event.createAutomationModel!, event.sceneId)
|
|
||||||
: await SceneApi.createAutomation(event.createAutomationModel!);
|
: await SceneApi.createAutomation(event.createAutomationModel!);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -360,14 +350,12 @@ class CreateSceneBloc extends Bloc<CreateSceneEvent, CreateSceneState>
|
|||||||
automationTempTasksList.clear();
|
automationTempTasksList.clear();
|
||||||
automationSelectedValues.clear();
|
automationSelectedValues.clear();
|
||||||
automationComparatorValues.clear();
|
automationComparatorValues.clear();
|
||||||
effectiveTime =
|
effectiveTime = EffectiveTime(start: '00:00', end: '23:59', loops: '1111111');
|
||||||
EffectiveTime(start: '00:00', end: '23:59', loops: '1111111');
|
|
||||||
sceneType = CreateSceneEnum.none;
|
sceneType = CreateSceneEnum.none;
|
||||||
conditionRule = 'or';
|
conditionRule = 'or';
|
||||||
emit(const CreateSceneWithTasks(success: true));
|
emit(const CreateSceneWithTasks(success: true));
|
||||||
CustomSnackBar.greenSnackBar(event.createSceneModel != null
|
CustomSnackBar.greenSnackBar(
|
||||||
? 'Scene updated successfully'
|
event.updateScene ? 'Scene updated successfully' : 'Scene created successfully');
|
||||||
: 'Scene created successfully');
|
|
||||||
} else {
|
} else {
|
||||||
emit(const CreateSceneError(message: 'Something went wrong'));
|
emit(const CreateSceneError(message: 'Something went wrong'));
|
||||||
}
|
}
|
||||||
@ -381,8 +369,7 @@ class CreateSceneBloc extends Bloc<CreateSceneEvent, CreateSceneState>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FutureOr<void> _clearTaskList(
|
FutureOr<void> _clearTaskList(ClearTaskListEvent event, Emitter<CreateSceneState> emit) {
|
||||||
ClearTaskListEvent event, Emitter<CreateSceneState> emit) {
|
|
||||||
emit(CreateSceneLoading());
|
emit(CreateSceneLoading());
|
||||||
automationTasksList.clear();
|
automationTasksList.clear();
|
||||||
tasksList.clear();
|
tasksList.clear();
|
||||||
@ -405,8 +392,7 @@ class CreateSceneBloc extends Bloc<CreateSceneEvent, CreateSceneState>
|
|||||||
automationTempTasksList.clear();
|
automationTempTasksList.clear();
|
||||||
automationSelectedValues.clear();
|
automationSelectedValues.clear();
|
||||||
automationComparatorValues.clear();
|
automationComparatorValues.clear();
|
||||||
effectiveTime =
|
effectiveTime = EffectiveTime(start: '00:00', end: '23:59', loops: '1111111');
|
||||||
EffectiveTime(start: '00:00', end: '23:59', loops: '1111111');
|
|
||||||
sceneType = CreateSceneEnum.none;
|
sceneType = CreateSceneEnum.none;
|
||||||
conditionRule = 'or';
|
conditionRule = 'or';
|
||||||
|
|
||||||
@ -415,14 +401,10 @@ class CreateSceneBloc extends Bloc<CreateSceneEvent, CreateSceneState>
|
|||||||
: await SceneApi.getSceneDetails(event.sceneId);
|
: await SceneApi.getSceneDetails(event.sceneId);
|
||||||
if (response.id.isNotEmpty) {
|
if (response.id.isNotEmpty) {
|
||||||
if (event.isAutomation) {
|
if (event.isAutomation) {
|
||||||
automationTasksList = List<SceneStaticFunction>.from(
|
automationTasksList = List<SceneStaticFunction>.from(getTaskListFunctionsFromApi(
|
||||||
getTaskListFunctionsFromApi(
|
actions: [], isAutomation: true, conditions: response.conditions));
|
||||||
actions: [],
|
|
||||||
isAutomation: true,
|
|
||||||
conditions: response.conditions));
|
|
||||||
tasksList = List<SceneStaticFunction>.from(
|
tasksList = List<SceneStaticFunction>.from(
|
||||||
getTaskListFunctionsFromApi(
|
getTaskListFunctionsFromApi(actions: response.actions, isAutomation: false));
|
||||||
actions: response.actions, isAutomation: false));
|
|
||||||
|
|
||||||
conditionRule = response.decisionExpr ?? conditionRule;
|
conditionRule = response.decisionExpr ?? conditionRule;
|
||||||
|
|
||||||
@ -435,13 +417,11 @@ 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 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
|
// Set Custom Time and reset days first
|
||||||
BlocProvider.of<EffectPeriodBloc>(
|
BlocProvider.of<EffectPeriodBloc>(NavigationService.navigatorKey.currentContext!)
|
||||||
NavigationService.navigatorKey.currentContext!)
|
|
||||||
.add(SetCustomTime(effectiveTime!.start, effectiveTime!.end));
|
.add(SetCustomTime(effectiveTime!.start, effectiveTime!.end));
|
||||||
|
|
||||||
emit(AddSceneTask(
|
emit(AddSceneTask(
|
||||||
@ -451,8 +431,7 @@ class CreateSceneBloc extends Bloc<CreateSceneEvent, CreateSceneState>
|
|||||||
));
|
));
|
||||||
} else {
|
} else {
|
||||||
tasksList = List<SceneStaticFunction>.from(
|
tasksList = List<SceneStaticFunction>.from(
|
||||||
getTaskListFunctionsFromApi(
|
getTaskListFunctionsFromApi(actions: response.actions, isAutomation: false));
|
||||||
actions: response.actions, isAutomation: false));
|
|
||||||
emit(AddSceneTask(
|
emit(AddSceneTask(
|
||||||
tasksList: tasksList,
|
tasksList: tasksList,
|
||||||
condition: conditionRule,
|
condition: conditionRule,
|
||||||
@ -471,8 +450,7 @@ class CreateSceneBloc extends Bloc<CreateSceneEvent, CreateSceneState>
|
|||||||
return days[index];
|
return days[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
FutureOr<void> _clearTempTaskList(
|
FutureOr<void> _clearTempTaskList(ClearTempTaskListEvent event, Emitter<CreateSceneState> emit) {
|
||||||
ClearTempTaskListEvent event, Emitter<CreateSceneState> emit) {
|
|
||||||
emit(CreateSceneLoading());
|
emit(CreateSceneLoading());
|
||||||
if (event.isAutomation == true) {
|
if (event.isAutomation == true) {
|
||||||
automationTempTasksList.clear();
|
automationTempTasksList.clear();
|
||||||
@ -516,17 +494,13 @@ class CreateSceneBloc extends Bloc<CreateSceneEvent, CreateSceneState>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FutureOr<void> _deleteScene(
|
FutureOr<void> _deleteScene(DeleteSceneEvent event, Emitter<CreateSceneState> emit) async {
|
||||||
DeleteSceneEvent event, Emitter<CreateSceneState> emit) async {
|
|
||||||
emit(DeleteSceneLoading());
|
emit(DeleteSceneLoading());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final response =
|
final response = sceneType.name == CreateSceneEnum.deviceStatusChanges.name
|
||||||
sceneType.name == CreateSceneEnum.deviceStatusChanges.name
|
? await SceneApi.deleteAutomation(automationId: event.sceneId, unitUuid: event.unitUuid)
|
||||||
? await SceneApi.deleteAutomation(
|
: await SceneApi.deleteScene(sceneId: event.sceneId, unitUuid: event.unitUuid);
|
||||||
automationId: event.sceneId, unitUuid: event.unitUuid)
|
|
||||||
: await SceneApi.deleteScene(
|
|
||||||
sceneId: event.sceneId, unitUuid: event.unitUuid);
|
|
||||||
if (response == true) {
|
if (response == true) {
|
||||||
emit(const DeleteSceneSuccess(true));
|
emit(const DeleteSceneSuccess(true));
|
||||||
} else {
|
} else {
|
||||||
@ -537,8 +511,7 @@ class CreateSceneBloc extends Bloc<CreateSceneEvent, CreateSceneState>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FutureOr<void> _updateTaskValue(
|
FutureOr<void> _updateTaskValue(UpdateTaskEvent event, Emitter<CreateSceneState> emit) {
|
||||||
UpdateTaskEvent event, Emitter<CreateSceneState> emit) {
|
|
||||||
emit(CreateSceneLoading());
|
emit(CreateSceneLoading());
|
||||||
if (event.isAutomation == true) {
|
if (event.isAutomation == true) {
|
||||||
for (var i = 0; i < automationTasksList.length; i++) {
|
for (var i = 0; i < automationTasksList.length; i++) {
|
||||||
@ -574,8 +547,7 @@ class CreateSceneBloc extends Bloc<CreateSceneEvent, CreateSceneState>
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
FutureOr<void> _selectConditionRule(
|
FutureOr<void> _selectConditionRule(SelectConditionEvent event, Emitter<CreateSceneState> emit) {
|
||||||
SelectConditionEvent event, Emitter<CreateSceneState> emit) {
|
|
||||||
emit(CreateSceneInitial());
|
emit(CreateSceneInitial());
|
||||||
if (event.condition.contains('any')) {
|
if (event.condition.contains('any')) {
|
||||||
conditionRule = 'or';
|
conditionRule = 'or';
|
||||||
@ -590,8 +562,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) {
|
||||||
|
|||||||
@ -16,10 +16,8 @@ class DoorLockHelperFunctions {
|
|||||||
code: 'normal_open_switch',
|
code: 'normal_open_switch',
|
||||||
operationDialogType: OperationDialogType.onOff,
|
operationDialogType: OperationDialogType.onOff,
|
||||||
operationalValues: [
|
operationalValues: [
|
||||||
SceneOperationalValue(
|
SceneOperationalValue(icon: Assets.assetsAcPower, description: "ON", value: true),
|
||||||
icon: Assets.assetsAcPower, description: "ON", value: true),
|
SceneOperationalValue(icon: Assets.assetsAcPowerOFF, description: "OFF", value: false),
|
||||||
SceneOperationalValue(
|
|
||||||
icon: Assets.assetsAcPowerOFF, description: "OFF", value: false),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
@ -98,7 +96,7 @@ class DoorLockHelperFunctions {
|
|||||||
SceneOperationalValue(
|
SceneOperationalValue(
|
||||||
icon: Assets.assetsFingerprintUnlock,
|
icon: Assets.assetsFingerprintUnlock,
|
||||||
description: "Fingerprint Mismatch",
|
description: "Fingerprint Mismatch",
|
||||||
value: 'wrong_password',
|
value: 'wrong_finger',
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@ -45,27 +45,6 @@ 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(
|
||||||
|
|||||||
@ -14,9 +14,8 @@ import 'package:syncrow_app/generated/assets.dart';
|
|||||||
import 'package:syncrow_app/utils/resource_manager/constants.dart';
|
import 'package:syncrow_app/utils/resource_manager/constants.dart';
|
||||||
|
|
||||||
mixin SceneOperationsDataHelper {
|
mixin SceneOperationsDataHelper {
|
||||||
final Map<DeviceType,
|
final Map<DeviceType, Function(List<FunctionModel>, String, String, dynamic, bool)> _functionMap =
|
||||||
Function(List<FunctionModel>, String, String, dynamic, bool)>
|
{
|
||||||
_functionMap = {
|
|
||||||
DeviceType.LightBulb: lightBulbFunctions,
|
DeviceType.LightBulb: lightBulbFunctions,
|
||||||
DeviceType.CeilingSensor: ceilingSensorFunctions,
|
DeviceType.CeilingSensor: ceilingSensorFunctions,
|
||||||
DeviceType.WallSensor: wallSensorFunctions,
|
DeviceType.WallSensor: wallSensorFunctions,
|
||||||
@ -46,22 +45,16 @@ mixin SceneOperationsDataHelper {
|
|||||||
required bool isAutomation,
|
required bool isAutomation,
|
||||||
}) {
|
}) {
|
||||||
final functionValue = null;
|
final functionValue = null;
|
||||||
return _functionMap[type]?.call(
|
return _functionMap[type]?.call(functions, deviceId, deviceName, functionValue, isAutomation) ??
|
||||||
functions, deviceId, deviceName, functionValue, isAutomation) ??
|
lightBulbFunctions(functions, deviceId, deviceName, functionValue, isAutomation);
|
||||||
lightBulbFunctions(
|
|
||||||
functions, deviceId, deviceName, functionValue, isAutomation);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String getTitle({DeviceType? type}) {
|
String getTitle({DeviceType? type}) {
|
||||||
return _titleMap[type] ?? '';
|
return _titleMap[type] ?? '';
|
||||||
}
|
}
|
||||||
|
|
||||||
static List<SceneStaticFunction> ceilingSensorFunctions(
|
static List<SceneStaticFunction> ceilingSensorFunctions(List<FunctionModel> functions,
|
||||||
List<FunctionModel> functions,
|
String deviceId, String deviceName, dynamic functionValue, bool isAutomation) {
|
||||||
String deviceId,
|
|
||||||
String deviceName,
|
|
||||||
dynamic functionValue,
|
|
||||||
bool isAutomation) {
|
|
||||||
if (isAutomation) {
|
if (isAutomation) {
|
||||||
return PresenceSensorHelperFunctions.automationPresenceSensorFunctions(
|
return PresenceSensorHelperFunctions.automationPresenceSensorFunctions(
|
||||||
deviceId, deviceName, functionValue);
|
deviceId, deviceName, functionValue);
|
||||||
@ -70,35 +63,22 @@ mixin SceneOperationsDataHelper {
|
|||||||
deviceId, deviceName, functionValue);
|
deviceId, deviceName, functionValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
static List<SceneStaticFunction> curtainFunctions(
|
static List<SceneStaticFunction> curtainFunctions(List<FunctionModel> functions, String deviceId,
|
||||||
List<FunctionModel> functions,
|
String deviceName, dynamic functionValue, bool isAutomation) {
|
||||||
String deviceId,
|
|
||||||
String deviceName,
|
|
||||||
dynamic functionValue,
|
|
||||||
bool isAutomation) {
|
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
static List<SceneStaticFunction> doorLockFunctions(
|
static List<SceneStaticFunction> doorLockFunctions(List<FunctionModel> functions, String deviceId,
|
||||||
List<FunctionModel> functions,
|
String deviceName, dynamic functionValue, bool isAutomation) {
|
||||||
String deviceId,
|
|
||||||
String deviceName,
|
|
||||||
dynamic functionValue,
|
|
||||||
bool isAutomation) {
|
|
||||||
if (isAutomation) {
|
if (isAutomation) {
|
||||||
return DoorLockHelperFunctions.doorLockAutomationFunctions(
|
return DoorLockHelperFunctions.doorLockAutomationFunctions(
|
||||||
deviceId, deviceName, functionValue);
|
deviceId, deviceName, functionValue);
|
||||||
}
|
}
|
||||||
return DoorLockHelperFunctions.doorLockTapToRunFunctions(
|
return DoorLockHelperFunctions.doorLockTapToRunFunctions(deviceId, deviceName, functionValue);
|
||||||
deviceId, deviceName, functionValue);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static List<SceneStaticFunction> wallSensorFunctions(
|
static List<SceneStaticFunction> wallSensorFunctions(List<FunctionModel> functions,
|
||||||
List<FunctionModel> functions,
|
String deviceId, String deviceName, dynamic functionValue, bool isAutomation) {
|
||||||
String deviceId,
|
|
||||||
String deviceName,
|
|
||||||
dynamic functionValue,
|
|
||||||
bool isAutomation) {
|
|
||||||
if (isAutomation) {
|
if (isAutomation) {
|
||||||
return HumanPresenceHelperFunctions.automationHumanPresenceFunctions(
|
return HumanPresenceHelperFunctions.automationHumanPresenceFunctions(
|
||||||
deviceId, deviceName, functionValue);
|
deviceId, deviceName, functionValue);
|
||||||
@ -107,51 +87,31 @@ mixin SceneOperationsDataHelper {
|
|||||||
deviceId, deviceName, functionValue);
|
deviceId, deviceName, functionValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
static List<SceneStaticFunction> lightBulbFunctions(
|
static List<SceneStaticFunction> lightBulbFunctions(List<FunctionModel> functions,
|
||||||
List<FunctionModel> functions,
|
String deviceId, String deviceName, dynamic functionValue, bool isAutomation) {
|
||||||
String deviceId,
|
|
||||||
String deviceName,
|
|
||||||
dynamic functionValue,
|
|
||||||
bool isAutomation) {
|
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
static List<SceneStaticFunction> gatewayFunctions(
|
static List<SceneStaticFunction> gatewayFunctions(List<FunctionModel> functions, String deviceId,
|
||||||
List<FunctionModel> functions,
|
String deviceName, dynamic functionValue, bool isAutomation) {
|
||||||
String deviceId,
|
return GatewayHelperFunctions.tabToRunGatewayFunctions(deviceId, deviceName, functionValue);
|
||||||
String deviceName,
|
|
||||||
dynamic functionValue,
|
|
||||||
bool isAutomation) {
|
|
||||||
return GatewayHelperFunctions.tabToRunGatewayFunctions(
|
|
||||||
deviceId, deviceName, functionValue);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static List<SceneStaticFunction> threeGangFunctions(
|
static List<SceneStaticFunction> threeGangFunctions(List<FunctionModel> functions,
|
||||||
List<FunctionModel> functions,
|
String deviceId, String deviceName, dynamic functionValue, bool isAutomation) {
|
||||||
String deviceId,
|
|
||||||
String deviceName,
|
|
||||||
dynamic functionValue,
|
|
||||||
bool isAutomation) {
|
|
||||||
if (isAutomation) {
|
if (isAutomation) {
|
||||||
return ThreeGangHelperFunctions.threeGangAutomationFunctions(
|
return ThreeGangHelperFunctions.threeGangAutomationFunctions(
|
||||||
deviceId, deviceName, functionValue);
|
deviceId, deviceName, functionValue);
|
||||||
}
|
}
|
||||||
return ThreeGangHelperFunctions.threeGangHelperFunctions(
|
return ThreeGangHelperFunctions.threeGangHelperFunctions(deviceId, deviceName, functionValue);
|
||||||
deviceId, deviceName, functionValue);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static List<SceneStaticFunction> acFunctions(
|
static List<SceneStaticFunction> acFunctions(List<FunctionModel> functions, String deviceId,
|
||||||
List<FunctionModel> functions,
|
String deviceName, dynamic functionValue, bool isAutomation) {
|
||||||
String deviceId,
|
|
||||||
String deviceName,
|
|
||||||
dynamic functionValue,
|
|
||||||
bool isAutomation) {
|
|
||||||
if (isAutomation) {
|
if (isAutomation) {
|
||||||
return ACFunctionsHelper.automationAcFunctions(
|
return ACFunctionsHelper.automationAcFunctions(deviceId, deviceName, functionValue);
|
||||||
deviceId, deviceName, functionValue);
|
|
||||||
}
|
}
|
||||||
return ACFunctionsHelper.tabToRunAcFunctions(
|
return ACFunctionsHelper.tabToRunAcFunctions(deviceId, deviceName, functionValue);
|
||||||
deviceId, deviceName, functionValue);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
List<SceneStaticFunction> getTaskListFunctionsFromApi({
|
List<SceneStaticFunction> getTaskListFunctionsFromApi({
|
||||||
@ -189,12 +149,8 @@ mixin SceneOperationsDataHelper {
|
|||||||
SceneStaticFunction(
|
SceneStaticFunction(
|
||||||
deviceId: action.entityId,
|
deviceId: action.entityId,
|
||||||
deviceName: action.name.toString(),
|
deviceName: action.name.toString(),
|
||||||
deviceIcon: action.type == 'automation'
|
deviceIcon: action.type == 'automation' ? Assets.player : Assets.handClickIcon,
|
||||||
? Assets.player
|
icon: action.type == 'automation' ? Assets.player : Assets.handClickIcon,
|
||||||
: Assets.handClickIcon,
|
|
||||||
icon: action.type == 'automation'
|
|
||||||
? Assets.player
|
|
||||||
: Assets.handClickIcon,
|
|
||||||
operationName: action.type.toString(),
|
operationName: action.type.toString(),
|
||||||
operationDialogType: OperationDialogType.onOff,
|
operationDialogType: OperationDialogType.onOff,
|
||||||
functionValue: action.actionExecutor,
|
functionValue: action.actionExecutor,
|
||||||
@ -214,8 +170,7 @@ mixin SceneOperationsDataHelper {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
functions
|
functions.add(_mapExecutorPropertyToSceneFunction(action, isAutomation));
|
||||||
.add(_mapExecutorPropertyToSceneFunction(action, isAutomation));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -251,9 +206,7 @@ mixin SceneOperationsDataHelper {
|
|||||||
}) {
|
}) {
|
||||||
final executorProperty = action.executorProperty;
|
final executorProperty = action.executorProperty;
|
||||||
|
|
||||||
final Map<String,
|
final Map<String, SceneStaticFunction Function(Action, bool, String?, String?)> functionMap = {
|
||||||
SceneStaticFunction Function(Action, bool, String?, String?)>
|
|
||||||
functionMap = {
|
|
||||||
'sensitivity': _createSensitivityFunction,
|
'sensitivity': _createSensitivityFunction,
|
||||||
'normal_open_switch': _createNormalOpenSwitchFunction,
|
'normal_open_switch': _createNormalOpenSwitchFunction,
|
||||||
'unlock_fingerprint': _createUnlockFingerprintFunction,
|
'unlock_fingerprint': _createUnlockFingerprintFunction,
|
||||||
@ -329,16 +282,14 @@ mixin SceneOperationsDataHelper {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneStaticFunction _createSensitivityFunction(Action action,
|
SceneStaticFunction _createSensitivityFunction(
|
||||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'Presence Sensor',
|
'Presence Sensor',
|
||||||
Assets.assetsIconsSensors,
|
Assets.assetsIconsSensors,
|
||||||
'Sensitivity',
|
'Sensitivity',
|
||||||
isAutomation
|
isAutomation ? OperationDialogType.integerSteps : OperationDialogType.listOfOptions,
|
||||||
? OperationDialogType.integerSteps
|
|
||||||
: OperationDialogType.listOfOptions,
|
|
||||||
isAutomation ? _createIntegerStepsOptions() : _createSensitivityOptions(),
|
isAutomation ? _createIntegerStepsOptions() : _createSensitivityOptions(),
|
||||||
isAutomation,
|
isAutomation,
|
||||||
comparator,
|
comparator,
|
||||||
@ -346,8 +297,8 @@ mixin SceneOperationsDataHelper {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneStaticFunction _createNormalOpenSwitchFunction(Action action,
|
SceneStaticFunction _createNormalOpenSwitchFunction(
|
||||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'WIFI LOCK PRO',
|
'WIFI LOCK PRO',
|
||||||
@ -400,8 +351,8 @@ mixin SceneOperationsDataHelper {
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneStaticFunction _createUnlockFingerprintFunction(Action action,
|
SceneStaticFunction _createUnlockFingerprintFunction(
|
||||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'WIFI LOCK PRO',
|
'WIFI LOCK PRO',
|
||||||
@ -415,8 +366,8 @@ mixin SceneOperationsDataHelper {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneStaticFunction _createUnlockPasswordFunction(Action action,
|
SceneStaticFunction _createUnlockPasswordFunction(
|
||||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'WIFI LOCK PRO',
|
'WIFI LOCK PRO',
|
||||||
@ -430,8 +381,8 @@ mixin SceneOperationsDataHelper {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneStaticFunction _createUnlockCardFunction(Action action,
|
SceneStaticFunction _createUnlockCardFunction(
|
||||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'WIFI LOCK PRO',
|
'WIFI LOCK PRO',
|
||||||
@ -445,8 +396,8 @@ mixin SceneOperationsDataHelper {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneStaticFunction _createAlarmLockFunction(Action action, bool isAutomation,
|
SceneStaticFunction _createAlarmLockFunction(
|
||||||
String? comparator, String? uniqueCustomId) {
|
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'WIFI LOCK PRO',
|
'WIFI LOCK PRO',
|
||||||
@ -460,8 +411,8 @@ mixin SceneOperationsDataHelper {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneStaticFunction _createUnlockRequestFunction(Action action,
|
SceneStaticFunction _createUnlockRequestFunction(
|
||||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'WIFI LOCK PRO',
|
'WIFI LOCK PRO',
|
||||||
@ -475,8 +426,8 @@ mixin SceneOperationsDataHelper {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneStaticFunction _createResidualElectricityFunction(Action action,
|
SceneStaticFunction _createResidualElectricityFunction(
|
||||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'WIFI LOCK PRO',
|
'WIFI LOCK PRO',
|
||||||
@ -490,8 +441,8 @@ mixin SceneOperationsDataHelper {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneStaticFunction _createReverseLockFunction(Action action,
|
SceneStaticFunction _createReverseLockFunction(
|
||||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'WIFI LOCK PRO',
|
'WIFI LOCK PRO',
|
||||||
@ -505,8 +456,8 @@ mixin SceneOperationsDataHelper {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneStaticFunction _createUnlockAppFunction(Action action, bool isAutomation,
|
SceneStaticFunction _createUnlockAppFunction(
|
||||||
String? comparator, String? uniqueCustomId) {
|
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'WIFI LOCK PRO',
|
'WIFI LOCK PRO',
|
||||||
@ -520,8 +471,8 @@ mixin SceneOperationsDataHelper {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneStaticFunction _createHijackFunction(Action action, bool isAutomation,
|
SceneStaticFunction _createHijackFunction(
|
||||||
String? comparator, String? uniqueCustomId) {
|
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'WIFI LOCK PRO',
|
'WIFI LOCK PRO',
|
||||||
@ -535,8 +486,8 @@ mixin SceneOperationsDataHelper {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneStaticFunction _createDoorbellFunction(Action action, bool isAutomation,
|
SceneStaticFunction _createDoorbellFunction(
|
||||||
String? comparator, String? uniqueCustomId) {
|
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'WIFI LOCK PRO',
|
'WIFI LOCK PRO',
|
||||||
@ -550,8 +501,8 @@ mixin SceneOperationsDataHelper {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneStaticFunction _createUnlockTemporaryFunction(Action action,
|
SceneStaticFunction _createUnlockTemporaryFunction(
|
||||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'WIFI LOCK PRO',
|
'WIFI LOCK PRO',
|
||||||
@ -565,8 +516,8 @@ mixin SceneOperationsDataHelper {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneStaticFunction _createFarDetectionFunction(Action action,
|
SceneStaticFunction _createFarDetectionFunction(
|
||||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'Human Presence Sensor',
|
'Human Presence Sensor',
|
||||||
@ -580,8 +531,8 @@ mixin SceneOperationsDataHelper {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneStaticFunction _createMotionSensitivityFunction(Action action,
|
SceneStaticFunction _createMotionSensitivityFunction(
|
||||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'Human Presence Sensor',
|
'Human Presence Sensor',
|
||||||
@ -595,8 +546,8 @@ mixin SceneOperationsDataHelper {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneStaticFunction _createMotionlessSensitivityFunction(Action action,
|
SceneStaticFunction _createMotionlessSensitivityFunction(
|
||||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'Human Presence Sensor',
|
'Human Presence Sensor',
|
||||||
@ -610,8 +561,8 @@ mixin SceneOperationsDataHelper {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneStaticFunction _createIndicatorFunction(Action action, bool isAutomation,
|
SceneStaticFunction _createIndicatorFunction(
|
||||||
String? comparator, String? uniqueCustomId) {
|
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'Human Presence Sensor',
|
'Human Presence Sensor',
|
||||||
@ -625,8 +576,8 @@ mixin SceneOperationsDataHelper {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneStaticFunction _createPresenceTimeFunction(Action action,
|
SceneStaticFunction _createPresenceTimeFunction(
|
||||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'Human Presence Sensor',
|
'Human Presence Sensor',
|
||||||
@ -640,8 +591,8 @@ mixin SceneOperationsDataHelper {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneStaticFunction _createPresenceStateFunction(Action action,
|
SceneStaticFunction _createPresenceStateFunction(
|
||||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'Human Presence Sensor',
|
'Human Presence Sensor',
|
||||||
@ -655,16 +606,14 @@ mixin SceneOperationsDataHelper {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneStaticFunction _createDisCurrentFunction(Action action,
|
SceneStaticFunction _createDisCurrentFunction(
|
||||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'Human Presence Sensor',
|
'Human Presence Sensor',
|
||||||
Assets.assetsIconsSensors,
|
Assets.assetsIconsSensors,
|
||||||
'Current Distance',
|
'Current Distance',
|
||||||
isAutomation
|
isAutomation ? OperationDialogType.integerSteps : OperationDialogType.countdown,
|
||||||
? OperationDialogType.integerSteps
|
|
||||||
: OperationDialogType.countdown,
|
|
||||||
_createCurrentDistanceOptions(),
|
_createCurrentDistanceOptions(),
|
||||||
isAutomation,
|
isAutomation,
|
||||||
comparator,
|
comparator,
|
||||||
@ -672,8 +621,8 @@ mixin SceneOperationsDataHelper {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneStaticFunction _createIlluminanceValueFunction(Action action,
|
SceneStaticFunction _createIlluminanceValueFunction(
|
||||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'Human Presence Sensor',
|
'Human Presence Sensor',
|
||||||
@ -687,8 +636,8 @@ mixin SceneOperationsDataHelper {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneStaticFunction _createCheckingResultFunction(Action action,
|
SceneStaticFunction _createCheckingResultFunction(
|
||||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'Human Presence Sensor',
|
'Human Presence Sensor',
|
||||||
@ -702,8 +651,8 @@ mixin SceneOperationsDataHelper {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneStaticFunction _createSwitchFunction(Action action, bool isAutomation,
|
SceneStaticFunction _createSwitchFunction(
|
||||||
String? comparator, String? uniqueCustomId) {
|
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'Smart AC Thermostat - Grey - Model A',
|
'Smart AC Thermostat - Grey - Model A',
|
||||||
@ -717,27 +666,23 @@ mixin SceneOperationsDataHelper {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneStaticFunction _createTempSetFunction(Action action, bool isAutomation,
|
SceneStaticFunction _createTempSetFunction(
|
||||||
String? comparator, String? uniqueCustomId) {
|
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'Smart AC Thermostat - Grey - Model A',
|
'Smart AC Thermostat - Grey - Model A',
|
||||||
Assets.assetsIconsAC,
|
Assets.assetsIconsAC,
|
||||||
'Set Temperature',
|
'Set Temperature',
|
||||||
isAutomation
|
isAutomation ? OperationDialogType.integerSteps : OperationDialogType.temperature,
|
||||||
? OperationDialogType.integerSteps
|
isAutomation ? _createAutomationTemperatureOptions() : _createTemperatureOptions(),
|
||||||
: OperationDialogType.temperature,
|
|
||||||
isAutomation
|
|
||||||
? _createAutomationTemperatureOptions()
|
|
||||||
: _createTemperatureOptions(),
|
|
||||||
isAutomation,
|
isAutomation,
|
||||||
comparator,
|
comparator,
|
||||||
uniqueCustomId,
|
uniqueCustomId,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneStaticFunction _createTempCurrentFunction(Action action,
|
SceneStaticFunction _createTempCurrentFunction(
|
||||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'Smart AC Thermostat - Grey - Model A',
|
'Smart AC Thermostat - Grey - Model A',
|
||||||
@ -751,8 +696,8 @@ mixin SceneOperationsDataHelper {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneStaticFunction _createModeFunction(Action action, bool isAutomation,
|
SceneStaticFunction _createModeFunction(
|
||||||
String? comparator, String? uniqueCustomId) {
|
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'Smart AC Thermostat - Grey - Model A',
|
'Smart AC Thermostat - Grey - Model A',
|
||||||
@ -766,8 +711,8 @@ mixin SceneOperationsDataHelper {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneStaticFunction _createLevelFunction(Action action, bool isAutomation,
|
SceneStaticFunction _createLevelFunction(
|
||||||
String? comparator, String? uniqueCustomId) {
|
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'Smart AC Thermostat - Grey - Model A',
|
'Smart AC Thermostat - Grey - Model A',
|
||||||
@ -781,8 +726,8 @@ mixin SceneOperationsDataHelper {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneStaticFunction _createChildLockFunction(Action action, bool isAutomation,
|
SceneStaticFunction _createChildLockFunction(
|
||||||
String? comparator, String? uniqueCustomId) {
|
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'Smart AC Thermostat - Grey - Model A',
|
'Smart AC Thermostat - Grey - Model A',
|
||||||
@ -796,8 +741,8 @@ mixin SceneOperationsDataHelper {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneStaticFunction _createSwitch1Function(Action action, bool isAutomation,
|
SceneStaticFunction _createSwitch1Function(
|
||||||
String? comparator, String? uniqueCustomId) {
|
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'3 Gang Button Switch L-L',
|
'3 Gang Button Switch L-L',
|
||||||
@ -811,8 +756,8 @@ mixin SceneOperationsDataHelper {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneStaticFunction _createSwitch2Function(Action action, bool isAutomation,
|
SceneStaticFunction _createSwitch2Function(
|
||||||
String? comparator, String? uniqueCustomId) {
|
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'3 Gang Button Switch L-L',
|
'3 Gang Button Switch L-L',
|
||||||
@ -826,8 +771,8 @@ mixin SceneOperationsDataHelper {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneStaticFunction _createSwitch3Function(Action action, bool isAutomation,
|
SceneStaticFunction _createSwitch3Function(
|
||||||
String? comparator, String? uniqueCustomId) {
|
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'3 Gang Button Switch L-L',
|
'3 Gang Button Switch L-L',
|
||||||
@ -841,65 +786,53 @@ mixin SceneOperationsDataHelper {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneStaticFunction _createCountdown1Function(Action action,
|
SceneStaticFunction _createCountdown1Function(
|
||||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'3 Gang Button Switch L-L',
|
'3 Gang Button Switch L-L',
|
||||||
Assets.assetsIcons3GangSwitch,
|
Assets.assetsIcons3GangSwitch,
|
||||||
'Light 1 CountDown',
|
'Light 1 CountDown',
|
||||||
isAutomation
|
isAutomation ? OperationDialogType.integerSteps : OperationDialogType.countdown,
|
||||||
? OperationDialogType.integerSteps
|
isAutomation ? _createAutomationCountDownOptions() : _createCountdownOptions(),
|
||||||
: OperationDialogType.countdown,
|
|
||||||
isAutomation
|
|
||||||
? _createAutomationCountDownOptions()
|
|
||||||
: _createCountdownOptions(),
|
|
||||||
isAutomation,
|
isAutomation,
|
||||||
comparator,
|
comparator,
|
||||||
uniqueCustomId,
|
uniqueCustomId,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneStaticFunction _createCountdown2Function(Action action,
|
SceneStaticFunction _createCountdown2Function(
|
||||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'3 Gang Button Switch L-L',
|
'3 Gang Button Switch L-L',
|
||||||
Assets.assetsIcons3GangSwitch,
|
Assets.assetsIcons3GangSwitch,
|
||||||
'Light 2 CountDown',
|
'Light 2 CountDown',
|
||||||
isAutomation
|
isAutomation ? OperationDialogType.integerSteps : OperationDialogType.countdown,
|
||||||
? OperationDialogType.integerSteps
|
isAutomation ? _createAutomationCountDownOptions() : _createCountdownOptions(),
|
||||||
: OperationDialogType.countdown,
|
|
||||||
isAutomation
|
|
||||||
? _createAutomationCountDownOptions()
|
|
||||||
: _createCountdownOptions(),
|
|
||||||
isAutomation,
|
isAutomation,
|
||||||
comparator,
|
comparator,
|
||||||
uniqueCustomId,
|
uniqueCustomId,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneStaticFunction _createCountdown3Function(Action action,
|
SceneStaticFunction _createCountdown3Function(
|
||||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'3 Gang Button Switch L-L',
|
'3 Gang Button Switch L-L',
|
||||||
Assets.assetsIcons3GangSwitch,
|
Assets.assetsIcons3GangSwitch,
|
||||||
'Light 3 CountDown',
|
'Light 3 CountDown',
|
||||||
isAutomation
|
isAutomation ? OperationDialogType.integerSteps : OperationDialogType.countdown,
|
||||||
? OperationDialogType.integerSteps
|
isAutomation ? _createAutomationCountDownOptions() : _createCountdownOptions(),
|
||||||
: OperationDialogType.countdown,
|
|
||||||
isAutomation
|
|
||||||
? _createAutomationCountDownOptions()
|
|
||||||
: _createCountdownOptions(),
|
|
||||||
isAutomation,
|
isAutomation,
|
||||||
comparator,
|
comparator,
|
||||||
uniqueCustomId,
|
uniqueCustomId,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneStaticFunction _createSwitchAlarmSoundFunction(Action action,
|
SceneStaticFunction _createSwitchAlarmSoundFunction(
|
||||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'Gateway',
|
'Gateway',
|
||||||
@ -913,8 +846,8 @@ mixin SceneOperationsDataHelper {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneStaticFunction _createMasterStateFunction(Action action,
|
SceneStaticFunction _createMasterStateFunction(
|
||||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'Gateway',
|
'Gateway',
|
||||||
@ -928,8 +861,8 @@ mixin SceneOperationsDataHelper {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneStaticFunction _createFactoryResetFunction(Action action,
|
SceneStaticFunction _createFactoryResetFunction(
|
||||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'Gateway',
|
'Gateway',
|
||||||
@ -987,7 +920,7 @@ mixin SceneOperationsDataHelper {
|
|||||||
SceneOperationalValue(
|
SceneOperationalValue(
|
||||||
icon: Assets.assetsFingerprintUnlock,
|
icon: Assets.assetsFingerprintUnlock,
|
||||||
description: "Fingerprint Mismatch",
|
description: "Fingerprint Mismatch",
|
||||||
value: 'wrong_password',
|
value: 'wrong_finger',
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@ -1247,12 +1180,8 @@ mixin SceneOperationsDataHelper {
|
|||||||
uniqueCustomId: taskItem.uniqueCustomId,
|
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' ? Assets.player : Assets.handClickIcon,
|
||||||
? Assets.player
|
icon: taskItem.operationName == 'automation' ? Assets.player : Assets.handClickIcon,
|
||||||
: Assets.handClickIcon,
|
|
||||||
icon: taskItem.operationName == 'automation'
|
|
||||||
? Assets.player
|
|
||||||
: Assets.handClickIcon,
|
|
||||||
operationName: taskItem.operationName,
|
operationName: taskItem.operationName,
|
||||||
operationDialogType: OperationDialogType.onOff,
|
operationDialogType: OperationDialogType.onOff,
|
||||||
functionValue: taskItem.functionValue == 'rule_enable' ? true : false,
|
functionValue: taskItem.functionValue == 'rule_enable' ? true : false,
|
||||||
|
|||||||
@ -24,14 +24,13 @@ class CreateSceneSaveButton extends StatefulWidget {
|
|||||||
State<CreateSceneSaveButton> createState() => _CreateSceneSaveButtonState();
|
State<CreateSceneSaveButton> createState() => _CreateSceneSaveButtonState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _CreateSceneSaveButtonState extends State<CreateSceneSaveButton>
|
class _CreateSceneSaveButtonState extends State<CreateSceneSaveButton> with SceneLogicHelper {
|
||||||
with SceneLogicHelper {
|
|
||||||
late TextEditingController sceneNameController;
|
late TextEditingController sceneNameController;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
sceneNameController = TextEditingController(
|
sceneNameController =
|
||||||
text: widget.sceneName.isNotEmpty ? widget.sceneName : '');
|
TextEditingController(text: widget.sceneName.isNotEmpty ? widget.sceneName : '');
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,8 +57,24 @@ class _CreateSceneSaveButtonState extends State<CreateSceneSaveButton>
|
|||||||
return DefaultButton(
|
return DefaultButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
final sceneBloc = context.read<CreateSceneBloc>();
|
final sceneBloc = context.read<CreateSceneBloc>();
|
||||||
final isAutomation =
|
if (sceneBloc.tasksList.isEmpty && sceneBloc.automationTasksList.isEmpty) {
|
||||||
sceneBloc.sceneType == CreateSceneEnum.deviceStatusChanges;
|
return;
|
||||||
|
}
|
||||||
|
final isAutomation = sceneBloc.sceneType == CreateSceneEnum.deviceStatusChanges;
|
||||||
|
|
||||||
|
if (isAutomation && sceneBloc.automationTasksList.isEmpty) {
|
||||||
|
CustomSnackBar.displaySnackBar(
|
||||||
|
'Conditions Must not be empty!',
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isAutomation && sceneBloc.tasksList.isEmpty) {
|
||||||
|
CustomSnackBar.displaySnackBar(
|
||||||
|
'Actions Must not be empty!',
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (widget.sceneName.isNotEmpty) {
|
if (widget.sceneName.isNotEmpty) {
|
||||||
handleSaveButtonPress(
|
handleSaveButtonPress(
|
||||||
@ -82,13 +97,11 @@ class _CreateSceneSaveButtonState extends State<CreateSceneSaveButton>
|
|||||||
elevation: WidgetStateProperty.all(0),
|
elevation: WidgetStateProperty.all(0),
|
||||||
textStyle: WidgetStateProperty.all(context.bodyMedium),
|
textStyle: WidgetStateProperty.all(context.bodyMedium),
|
||||||
hintStyle: WidgetStateProperty.all(
|
hintStyle: WidgetStateProperty.all(
|
||||||
context.bodyMedium.copyWith(
|
context.bodyMedium
|
||||||
fontSize: 14,
|
.copyWith(fontSize: 14, color: ColorsManager.secondaryTextColor),
|
||||||
color: ColorsManager.secondaryTextColor),
|
|
||||||
),
|
),
|
||||||
hintText: 'Enter scene name',
|
hintText: 'Enter scene name',
|
||||||
backgroundColor: WidgetStateProperty.all(
|
backgroundColor: WidgetStateProperty.all(ColorsManager.backgroundColor),
|
||||||
ColorsManager.backgroundColor),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user