diff --git a/src/Screens/Device/modals/AddSceneAction/LayerSelection/index.js b/src/Screens/Device/modals/AddSceneAction/LayerSelection/index.js
index 38d4b27..667ba5d 100644
--- a/src/Screens/Device/modals/AddSceneAction/LayerSelection/index.js
+++ b/src/Screens/Device/modals/AddSceneAction/LayerSelection/index.js
@@ -6,6 +6,7 @@ import {
AppContext,
AppSelectedUserDevice,
Constants,
+ GetDevice,
ModalContainer,
NewAction,
} from "../../../../../utils";
@@ -84,12 +85,8 @@ export default function LayerSelectionModalContent({ navigation, route }) {
style={{ marginTop: 20, width: 180 }}
disabled={selectedLayer.length === 0}
onPress={() => {
- const device = appContext.devices.find(
- (d) => d.id === AppSelectedUserDevice.current.id
- );
-
const newAction = NewAction(
- device.selectedScene,
+ GetDevice(appContext.devices).selectedScene,
Constants.actionType.layers
);
diff --git a/src/Screens/Device/modals/EditActions/Lights/index.js b/src/Screens/Device/modals/EditActions/Lights/index.js
index bf5ff62..ec2b391 100644
--- a/src/Screens/Device/modals/EditActions/Lights/index.js
+++ b/src/Screens/Device/modals/EditActions/Lights/index.js
@@ -85,12 +85,12 @@ export function LightsEditActionModalContent({ navigation, route }) {
lightMode.supportedFirmwareVersions.includes(deviceFirmwareVersion)
);
- const selectedSceneActionModeId = appContext.deviceSceneActions.find(
+ const selectedSceneAction = appContext.deviceSceneActions.find(
(a) => a.actionId === actionId
- ).modeId;
+ );
const selectedLightMode = supportedDeviceLightModes.find(
- (s) => s.id === selectedSceneActionModeId
+ (s) => s.id === selectedSceneAction.modeId
);
useEffect(() => {
@@ -105,7 +105,7 @@ export function LightsEditActionModalContent({ navigation, route }) {
setLightModeDefaultColors(selectedLightMode.defaults);
setSelectedDefaultLightModeColor(0);
}
- }, [selectedSceneActionModeId]);
+ }, [selectedSceneAction.modeId]);
return (
navigation.navigate("modalLayersEditActionColorModeSelection", {
supportedDeviceLightModes: supportedDeviceLightModes,
- selectedSceneActionModeId: selectedSceneActionModeId,
- actionId: route.params.actionId,
+ action: selectedSceneAction,
})
}
/>
- {selectedSceneActionModeId !== "" && (
+ {selectedSceneAction.modeId !== "" && (
<>
{lightModeDefaultColors.length > 0 && (
<>
@@ -270,10 +269,10 @@ export function LightsEditActionModalContent({ navigation, route }) {
@@ -286,6 +285,8 @@ export function LayersEditActionColorModeSelectionModalContent({
}) {
const appContext = useContext(AppContext);
+ const { action } = route.params;
+
return (
(
{
appContext.setDeviceSceneActions((arr) => {
const newArr = [...arr];
const actionIndex = newArr.findIndex(
- (a) => a.actionId === route.params.actionId
+ (a) => a.actionId === action.actionId
);
if (actionIndex !== -1) {
diff --git a/src/Screens/Device/modals/EditActions/index.js b/src/Screens/Device/modals/EditActions/index.js
index b35d1d6..e6dfe1d 100644
--- a/src/Screens/Device/modals/EditActions/index.js
+++ b/src/Screens/Device/modals/EditActions/index.js
@@ -18,23 +18,21 @@ export default function EditActionAnimationsCardContent({
disabled,
navigation,
deviceFirmwareVersion,
- actionId,
+ action,
}) {
const appContext = useContext(AppContext);
const { t } = useTranslation();
- const deviceSceneAction = appContext.deviceSceneActions.find(
- (action) => action.actionId === actionId
- );
+ console.log("act", action);
const selectedLightAnimationIn =
appContext.deviceFirmwareModes.lightAnimationsIn.find(
- (animation) => animation.id === deviceSceneAction.animationInId
+ (animation) => animation.id === action.animationInId
);
const selectedLightAnimationOut =
appContext.deviceFirmwareModes.lightAnimationsOut.find(
- (animation) => animation.id === deviceSceneAction.animationOutId
+ (animation) => animation.id === action.animationOutId
);
return (
@@ -64,7 +62,7 @@ export default function EditActionAnimationsCardContent({
navigation.navigate("modalEditActionAnimationInSelection", {
animationType: "animationIn",
deviceFirmwareVersion: deviceFirmwareVersion,
- actionId: actionId,
+ action: action,
})
}
/>
@@ -107,7 +105,7 @@ export default function EditActionAnimationsCardContent({
navigation.navigate("modalEditActionAnimationOutSelection", {
animationType: "animationOut",
deviceFirmwareVersion: deviceFirmwareVersion,
- actionId: actionId,
+ action: action,
})
}
/>
@@ -132,7 +130,7 @@ export function EditActionAnimationSelectionModalContent({
}) {
const appContext = useContext(AppContext);
- let { animationType, deviceFirmwareVersion, actionId } = route.params;
+ let { animationType, deviceFirmwareVersion, action } = route.params;
const supportedLightAnimations =
animationType === "animationIn"
@@ -149,10 +147,6 @@ export function EditActionAnimationSelectionModalContent({
) || animation.supportedFirmwareVersions.includes("*")
);
- const deviceSceneAction = appContext.deviceSceneActions.find(
- (action) => action.actionId === actionId
- );
-
animationType =
animationType === "animationIn" ? "animationInId" : "animationOutId";
@@ -178,7 +172,7 @@ export function EditActionAnimationSelectionModalContent({
renderItem={({ item }) => (
{
navigation.goBack();
@@ -186,7 +180,7 @@ export function EditActionAnimationSelectionModalContent({
const newArr = [...arr];
const foundActionIndex = newArr.findIndex(
- (action) => action.actionId === actionId
+ (a) => a.actionId === action.actionId
);
newArr[foundActionIndex][animationType] = item.id;
diff --git a/src/utils.js b/src/utils.js
index 13e9203..7904d23 100644
--- a/src/utils.js
+++ b/src/utils.js
@@ -402,6 +402,7 @@ const devDeviceSceneActions = [
modeId: "",
animationInId: "",
animationOutId: "",
+ adjustments: [], // affected layers, animation speed...
},
];
@@ -411,8 +412,9 @@ export function NewAction(sceneId, actionType) {
sceneId: sceneId,
type: actionType, // layers, ambilight, motor
modeId: "",
- animationInId: "00000000-0000-0000-0000-000000000000",
- animationOutId: "00000000-0000-0000-0000-000000000000",
+ animationInId: "00000000-0000-0000-0000-000000000000", // default animation id for -> No animation selected
+ animationOutId: "00000000-0000-0000-0000-000000000000", // default animation id for -> No animation selected
+ adjustments: [],
};
}