mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 15:17:31 +00:00
PR fixes and tested
This commit is contained in:
@ -1457,27 +1457,21 @@ class RoutineBloc extends Bloc<RoutineEvent, RoutineState> {
|
|||||||
|
|
||||||
List<ScenesModel> changeItemStateOnToggelingSceen(
|
List<ScenesModel> changeItemStateOnToggelingSceen(
|
||||||
List<ScenesModel> oldSceen, String automationId) {
|
List<ScenesModel> oldSceen, String automationId) {
|
||||||
final updatedAutomations = oldSceen;
|
return oldSceen.map((scene) {
|
||||||
final temp =
|
if (scene.id == automationId) {
|
||||||
updatedAutomations.firstWhere((element) => element.id == automationId);
|
return ScenesModel(
|
||||||
final tempIndex = updatedAutomations.indexWhere(
|
id: scene.id,
|
||||||
(element) => element.id == automationId,
|
sceneTuyaId: scene.sceneTuyaId,
|
||||||
);
|
name: scene.name,
|
||||||
updatedAutomations.removeWhere(
|
status: scene.status == 'enable' ? 'disable' : 'enable',
|
||||||
(element) => element.id == automationId,
|
type: scene.type,
|
||||||
);
|
spaceName: scene.spaceName,
|
||||||
updatedAutomations.insert(
|
spaceId: scene.spaceId,
|
||||||
tempIndex,
|
communityId: scene.communityId,
|
||||||
ScenesModel(
|
icon: scene.icon,
|
||||||
id: temp.id,
|
);
|
||||||
name: temp.name,
|
}
|
||||||
status: temp.status == 'enable' ? 'disable' : 'enable',
|
return scene;
|
||||||
type: temp.type,
|
}).toList();
|
||||||
spaceName: temp.spaceName,
|
|
||||||
spaceId: temp.spaceId,
|
|
||||||
communityId: temp.communityId,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
return updatedAutomations;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user