separating states into multiple states
parent
fed81a78c2
commit
37892eff3e
13
App.js
13
App.js
|
@ -52,12 +52,17 @@ export function MyApp() {
|
||||||
"appColorScheme",
|
"appColorScheme",
|
||||||
"userExpertMode",
|
"userExpertMode",
|
||||||
"userDeveloperMode",
|
"userDeveloperMode",
|
||||||
|
"userColorSwatchesFavorites",
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const appLanguage = GetDataFromList(data, "appLanguage");
|
const appLanguage = GetDataFromList(data, "appLanguage");
|
||||||
const appColorScheme = GetDataFromList(data, "appColorScheme");
|
const appColorScheme = GetDataFromList(data, "appColorScheme");
|
||||||
const userExpertMode = GetDataFromList(data, "userExpertMode");
|
const userExpertMode = GetDataFromList(data, "userExpertMode");
|
||||||
const userDeveloperMode = GetDataFromList(data, "userDeveloperMode");
|
const userDeveloperMode = GetDataFromList(data, "userDeveloperMode");
|
||||||
|
const userColorSwatchesFavorites = GetDataFromList(
|
||||||
|
data,
|
||||||
|
"userColorSwatchesFavorites"
|
||||||
|
);
|
||||||
|
|
||||||
appContext.setAppLanguage(
|
appContext.setAppLanguage(
|
||||||
appLanguage === null ? Constants.defaultLanguage : appLanguage
|
appLanguage === null ? Constants.defaultLanguage : appLanguage
|
||||||
|
@ -73,6 +78,10 @@ export function MyApp() {
|
||||||
appContext.setUserIsDeveloperModeEnabled(
|
appContext.setUserIsDeveloperModeEnabled(
|
||||||
userDeveloperMode == null ? false : userDeveloperMode
|
userDeveloperMode == null ? false : userDeveloperMode
|
||||||
);
|
);
|
||||||
|
|
||||||
|
appContext.setUserColorSwatchesFavorites(
|
||||||
|
userColorSwatchesFavorites === null ? [] : userColorSwatchesFavorites
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
loadData();
|
loadData();
|
||||||
|
@ -255,7 +264,7 @@ function MyDrawer() {
|
||||||
key={device.id}
|
key={device.id}
|
||||||
name={device.displayName}
|
name={device.displayName}
|
||||||
component={DeviceScreenStack}
|
component={DeviceScreenStack}
|
||||||
initialParams={{ device: device }}
|
initialParams={{ deviceDisplayName: device.displayName }}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
|
|
||||||
|
@ -272,7 +281,7 @@ const DeviceScreenStack = (props) => {
|
||||||
return (
|
return (
|
||||||
<MyScreenStack
|
<MyScreenStack
|
||||||
name="device"
|
name="device"
|
||||||
pageTitle={props.route.params.device.displayName}
|
pageTitle={props.route.params.deviceDisplayName}
|
||||||
component={DeviceScreen}
|
component={DeviceScreen}
|
||||||
navigation={props.navigation}
|
navigation={props.navigation}
|
||||||
params={props.route.params}
|
params={props.route.params}
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
"modalSettingsChangeDeviceDisplayName": {
|
"modalSettingsChangeDeviceDisplayName": {
|
||||||
"pageTitle": "Gerätename anpassen",
|
"pageTitle": "Gerätename anpassen",
|
||||||
"textTitle": "Gerätename",
|
"textTitle": "Gerätename",
|
||||||
"textDescription": "Der Name des Geräts wird lokal auf dem Gerät gespeichert und dient Ihnen dazu, die verbundenen Geräte in der App voneinander zu unterscheiden."
|
"textDescription": "Der Name wird lokal auf dem Gerät gespeichert und dient dazu, die verbundenen Geräte in der App voneinander zu unterscheiden."
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"scenes": {
|
"scenes": {
|
||||||
|
|
|
@ -250,9 +250,8 @@ export default function MyColorPicker({ colorLayer }) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function MyColorPickerV2({ isUserExpertModeEnabled, appThemeText }) {
|
export function MyColorPickerV2({ isUserExpertModeEnabled, appThemeText }) {
|
||||||
|
const appContext = useContext(AppContext);
|
||||||
const selectedColorPickerColor = useSharedValue("#fff");
|
const selectedColorPickerColor = useSharedValue("#fff");
|
||||||
const [colorSwatchesFavorites, setColorSwatchesFavorites] = useState([]);
|
|
||||||
|
|
||||||
const pickerRef = useRef(ColorPickerRef);
|
const pickerRef = useRef(ColorPickerRef);
|
||||||
|
|
||||||
const onColorSelect = (color) => {
|
const onColorSelect = (color) => {
|
||||||
|
@ -283,15 +282,18 @@ export function MyColorPickerV2({ isUserExpertModeEnabled, appThemeText }) {
|
||||||
marginTop: 10,
|
marginTop: 10,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{colorSwatchesFavorites.map((color, i) => (
|
{appContext.userColorSwatchesFavorites.map((color, i) => (
|
||||||
<TouchableHighlight
|
<TouchableHighlight
|
||||||
key={i}
|
key={i}
|
||||||
style={{ borderRadius: 16 }}
|
style={{ borderRadius: 16 }}
|
||||||
onPress={() => pickerRef.current.setColor(color)}
|
onPress={() => pickerRef.current.setColor(color)}
|
||||||
onLongPress={() => {
|
onLongPress={() => {
|
||||||
setColorSwatchesFavorites((colors) =>
|
let filteredColors =
|
||||||
colors.filter((c) => c !== color)
|
appContext.userColorSwatchesFavorites.filter(
|
||||||
);
|
(c) => c !== color
|
||||||
|
);
|
||||||
|
|
||||||
|
appContext.setUserColorSwatchesFavorites(filteredColors);
|
||||||
|
|
||||||
VibrateShort();
|
VibrateShort();
|
||||||
}}
|
}}
|
||||||
|
@ -313,10 +315,12 @@ export function MyColorPickerV2({ isUserExpertModeEnabled, appThemeText }) {
|
||||||
<TouchableHighlight
|
<TouchableHighlight
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
if (
|
if (
|
||||||
!colorSwatchesFavorites.includes(selectedColorPickerColor.value)
|
!appContext.userColorSwatchesFavorites.includes(
|
||||||
|
selectedColorPickerColor.value
|
||||||
|
)
|
||||||
) {
|
) {
|
||||||
setColorSwatchesFavorites([
|
appContext.setUserColorSwatchesFavorites([
|
||||||
...colorSwatchesFavorites,
|
...appContext.userColorSwatchesFavorites,
|
||||||
selectedColorPickerColor.value,
|
selectedColorPickerColor.value,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ export default function Sidebar(props) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
const MyDrawerItem = ({
|
const MyDrawerItem = ({
|
||||||
|
_deviceId,
|
||||||
label,
|
label,
|
||||||
onPress,
|
onPress,
|
||||||
iconName,
|
iconName,
|
||||||
|
@ -27,7 +28,12 @@ export default function Sidebar(props) {
|
||||||
? appContext.appTheme.drawer.item.activeTintColor
|
? appContext.appTheme.drawer.item.activeTintColor
|
||||||
: appContext.appTheme.drawer.item.inactiveTintColor;
|
: appContext.appTheme.drawer.item.inactiveTintColor;
|
||||||
|
|
||||||
if (isFocused && isDevice) AppSelectedUserDevice.current = routeName;
|
if (isFocused && isDevice) {
|
||||||
|
AppSelectedUserDevice.current = {
|
||||||
|
id: _deviceId,
|
||||||
|
routeName: routeName,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DrawerItem
|
<DrawerItem
|
||||||
|
@ -127,6 +133,7 @@ export default function Sidebar(props) {
|
||||||
{appContext.devices.map((device, i) => (
|
{appContext.devices.map((device, i) => (
|
||||||
<MyDrawerItem
|
<MyDrawerItem
|
||||||
key={device.id}
|
key={device.id}
|
||||||
|
_deviceId={device.id}
|
||||||
isDevice
|
isDevice
|
||||||
deviceName={device.displayName}
|
deviceName={device.displayName}
|
||||||
deviceModel={device.deviceModel}
|
deviceModel={device.deviceModel}
|
||||||
|
|
|
@ -17,18 +17,16 @@ import {
|
||||||
topThird,
|
topThird,
|
||||||
} from "./deviceTabButton";
|
} from "./deviceTabButton";
|
||||||
|
|
||||||
export default function DeviceScreen({ route, navigation }) {
|
export default function DeviceScreen({ navigation }) {
|
||||||
const device = route.params.device;
|
|
||||||
|
|
||||||
const appContext = useContext(AppContext);
|
const appContext = useContext(AppContext);
|
||||||
const [selectedView, setSelectedView] = useState(2);
|
const [selectedView, setSelectedView] = useState(2);
|
||||||
|
|
||||||
const SelectedView = () => {
|
const SelectedView = () => {
|
||||||
switch (selectedView) {
|
switch (selectedView) {
|
||||||
case 0:
|
case 0:
|
||||||
return <SettingsView navigation={navigation} device={device} />;
|
return <SettingsView navigation={navigation} />;
|
||||||
case 2:
|
case 2:
|
||||||
return <SceneView navigation={navigation} device={device} />;
|
return <SceneView navigation={navigation} />;
|
||||||
default:
|
default:
|
||||||
<Text>Not found</Text>;
|
<Text>Not found</Text>;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,16 @@
|
||||||
import { useState } from "react";
|
import { useContext, useState } from "react";
|
||||||
import { Text, TouchableHighlight, View } from "react-native";
|
import { Text, TouchableHighlight, View } from "react-native";
|
||||||
import MyButton from "../../../../../Components/Button";
|
import MyButton from "../../../../../Components/Button";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { AppSelectedUserDevice, ModalContainer } from "../../../../../utils";
|
import {
|
||||||
|
AppContext,
|
||||||
|
AppSelectedUserDevice,
|
||||||
|
Constants,
|
||||||
|
GetDevice,
|
||||||
|
ModalContainer,
|
||||||
|
NewAction,
|
||||||
|
NewInitialDeviceSceneAction,
|
||||||
|
} from "../../../../../utils";
|
||||||
|
|
||||||
function Layer({ number, selected, onPress }) {
|
function Layer({ number, selected, onPress }) {
|
||||||
return (
|
return (
|
||||||
|
@ -38,6 +46,7 @@ function Layer({ number, selected, onPress }) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function LayerSelectionModalContent({ navigation, route }) {
|
export default function LayerSelectionModalContent({ navigation, route }) {
|
||||||
|
const appContext = useContext(AppContext);
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [selectedLayer, setSelectedLayer] = useState([]);
|
const [selectedLayer, setSelectedLayer] = useState([]);
|
||||||
|
|
||||||
|
@ -77,7 +86,36 @@ export default function LayerSelectionModalContent({ navigation, route }) {
|
||||||
style={{ marginTop: 20, width: 180 }}
|
style={{ marginTop: 20, width: 180 }}
|
||||||
disabled={selectedLayer.length === 0}
|
disabled={selectedLayer.length === 0}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
navigation.navigate(AppSelectedUserDevice.current);
|
const newAction = NewAction(Constants.actionType.layers);
|
||||||
|
|
||||||
|
appContext.setDeviceSceneActions((arr) => {
|
||||||
|
let newArr = [...arr];
|
||||||
|
|
||||||
|
const deviceSelectedScene = GetDevice(
|
||||||
|
appContext.devices
|
||||||
|
).selectedScene;
|
||||||
|
|
||||||
|
const foundDeviceSceneActionIndex = newArr.findIndex(
|
||||||
|
(a) => a.sceneId === deviceSelectedScene
|
||||||
|
);
|
||||||
|
|
||||||
|
if (foundDeviceSceneActionIndex === -1) {
|
||||||
|
const initialDeviceActionScene =
|
||||||
|
NewInitialDeviceSceneAction(deviceSelectedScene);
|
||||||
|
|
||||||
|
initialDeviceActionScene.actions.push(newAction);
|
||||||
|
|
||||||
|
newArr.push(initialDeviceActionScene);
|
||||||
|
} else {
|
||||||
|
newArr[foundDeviceSceneActionIndex].actions.push(newAction);
|
||||||
|
}
|
||||||
|
|
||||||
|
return newArr;
|
||||||
|
});
|
||||||
|
|
||||||
|
route.params["actionId"] = newAction.id;
|
||||||
|
|
||||||
|
navigation.navigate(AppSelectedUserDevice.current.routeName);
|
||||||
navigation.navigate("modalLayersEditAction", route.params);
|
navigation.navigate("modalLayersEditAction", route.params);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -1,14 +1,16 @@
|
||||||
import { useContext } from "react";
|
import { useContext } from "react";
|
||||||
import {
|
import {
|
||||||
AppContext,
|
AppContext,
|
||||||
|
AppSelectedUserDevice,
|
||||||
ModalContainer,
|
ModalContainer,
|
||||||
NewEmptyDeviceScene,
|
NewEmptyDeviceScene,
|
||||||
|
NewInitialDeviceScene,
|
||||||
} from "../../../../../utils";
|
} from "../../../../../utils";
|
||||||
import { FlatList } from "react-native";
|
import { FlatList } from "react-native";
|
||||||
import { MyPickerModalListItem } from "../../../../../Components/Modal";
|
import { MyPickerModalListItem } from "../../../../../Components/Modal";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
|
||||||
export default function CreateSceneModalContent({ navigation, route }) {
|
export default function CreateSceneModalContent({ navigation }) {
|
||||||
const appContext = useContext(AppContext);
|
const appContext = useContext(AppContext);
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
|
@ -38,12 +40,28 @@ export default function CreateSceneModalContent({ navigation, route }) {
|
||||||
<MyPickerModalListItem
|
<MyPickerModalListItem
|
||||||
itemName={item.name}
|
itemName={item.name}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
appContext.setDevices((arr) => {
|
appContext.setDeviceScenes((arr) => {
|
||||||
const newArr = [...arr];
|
let newArr = [...arr];
|
||||||
|
|
||||||
newArr[
|
const deviceId = AppSelectedUserDevice.current.id;
|
||||||
arr.findIndex((d) => d.id === route.params.id)
|
|
||||||
].scenes.push(NewEmptyDeviceScene());
|
const foundDeviceSceneIndex = newArr.findIndex(
|
||||||
|
(s) => s.deviceId === deviceId
|
||||||
|
);
|
||||||
|
|
||||||
|
const newEmptyDeviceScene = NewEmptyDeviceScene("Leere Szene");
|
||||||
|
|
||||||
|
if (foundDeviceSceneIndex === -1) {
|
||||||
|
const initalDeviceScene = NewInitialDeviceScene(deviceId);
|
||||||
|
|
||||||
|
initalDeviceScene.scenes.push(newEmptyDeviceScene);
|
||||||
|
|
||||||
|
newArr.push(initalDeviceScene);
|
||||||
|
} else {
|
||||||
|
newArr[foundDeviceSceneIndex].scenes.push(
|
||||||
|
newEmptyDeviceScene
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return newArr;
|
return newArr;
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
import { useContext } from "react";
|
import { useContext } from "react";
|
||||||
import { FlatList } from "react-native";
|
import { FlatList } from "react-native";
|
||||||
import { AppContext, ModalContainer } from "../../../../utils";
|
import {
|
||||||
|
AppContext,
|
||||||
|
AppSelectedUserDevice,
|
||||||
|
ModalContainer,
|
||||||
|
} from "../../../../utils";
|
||||||
import { MyPickerModalListItem } from "../../../../Components/Modal";
|
import { MyPickerModalListItem } from "../../../../Components/Modal";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { MyTextButton } from "../../../../Components/Button";
|
import { MyTextButton } from "../../../../Components/Button";
|
||||||
|
@ -10,35 +14,47 @@ export default function ChooseSceneModalContent({ navigation, route }) {
|
||||||
const appContext = useContext(AppContext);
|
const appContext = useContext(AppContext);
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
const device = route.params;
|
const { device } = route.params;
|
||||||
|
|
||||||
|
let scenes = [];
|
||||||
|
|
||||||
|
const deviceScenes = appContext.deviceScenes.find(
|
||||||
|
(s) => s.deviceId === AppSelectedUserDevice.current.id
|
||||||
|
);
|
||||||
|
|
||||||
|
if (deviceScenes !== undefined) {
|
||||||
|
scenes = deviceScenes.scenes;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ModalContainer>
|
<ModalContainer>
|
||||||
{device.scenes.length === 0 ? (
|
{scenes.length === 0 ? (
|
||||||
<MyResult
|
<MyResult
|
||||||
text={"Keine Szenen vorhanden"}
|
text={"Keine Szenen vorhanden"}
|
||||||
iconName={"selection-search"}
|
iconName={"selection-search"}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<FlatList
|
<FlatList
|
||||||
data={device.scenes}
|
data={scenes}
|
||||||
keyExtractor={(item) => item.id}
|
keyExtractor={(item) => item.id}
|
||||||
renderItem={({ item }) => (
|
renderItem={({ item }) => (
|
||||||
<MyPickerModalListItem
|
<MyPickerModalListItem
|
||||||
itemName={item.name}
|
itemName={item.name}
|
||||||
itemSelected={device.selectedScene === item.id}
|
itemSelected={device.selectedScene === item.id}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
|
navigation.goBack();
|
||||||
|
|
||||||
appContext.setDevices((arr) => {
|
appContext.setDevices((arr) => {
|
||||||
const newArr = [...arr];
|
const newArr = [...arr];
|
||||||
|
|
||||||
newArr[
|
newArr[
|
||||||
arr.findIndex((d) => d.id === device.id)
|
arr.findIndex(
|
||||||
|
(d) => d.id === AppSelectedUserDevice.current.id
|
||||||
|
)
|
||||||
].selectedScene = item.id;
|
].selectedScene = item.id;
|
||||||
|
|
||||||
return newArr;
|
return newArr;
|
||||||
});
|
});
|
||||||
|
|
||||||
navigation.goBack();
|
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
@ -47,10 +63,8 @@ export default function ChooseSceneModalContent({ navigation, route }) {
|
||||||
|
|
||||||
<MyTextButton
|
<MyTextButton
|
||||||
style={{ marginTop: 10 }}
|
style={{ marginTop: 10 }}
|
||||||
actionColor={!device.scenes.length}
|
actionColor={!scenes.length}
|
||||||
onPress={() =>
|
onPress={() => navigation.navigate("modalCreateScene")}
|
||||||
navigation.navigate("modalCreateScene", { id: device.id })
|
|
||||||
}
|
|
||||||
title={t("screens.device.scenes.modalChooseScene.textButtonAddScene")}
|
title={t("screens.device.scenes.modalChooseScene.textButtonAddScene")}
|
||||||
/>
|
/>
|
||||||
</ModalContainer>
|
</ModalContainer>
|
||||||
|
|
|
@ -7,18 +7,20 @@ import {
|
||||||
import Card from "../../../../../Components/Card";
|
import Card from "../../../../../Components/Card";
|
||||||
import MyDropdown from "../../../../../Components/Dropdown";
|
import MyDropdown from "../../../../../Components/Dropdown";
|
||||||
import { useContext, useState } from "react";
|
import { useContext, useState } from "react";
|
||||||
import { AppContext, ModalContainer } from "../../../../../utils";
|
import {
|
||||||
import MyModal, {
|
AppContext,
|
||||||
MyDefaultModalHeader,
|
GetDevice,
|
||||||
MyPickerModalListItem,
|
GetDeviceSceneAction,
|
||||||
} from "../../../../../Components/Modal";
|
ModalContainer,
|
||||||
|
} from "../../../../../utils";
|
||||||
|
import { MyPickerModalListItem } from "../../../../../Components/Modal";
|
||||||
import { MyColorPickerV2 } from "../../../../../Components/ColorPicker";
|
import { MyColorPickerV2 } from "../../../../../Components/ColorPicker";
|
||||||
|
|
||||||
export function LightsEditActionModalContent({ navigation, route }) {
|
export function LightsEditActionModalContent({ navigation, route }) {
|
||||||
const appContext = useContext(AppContext);
|
const appContext = useContext(AppContext);
|
||||||
const [modalColorModeSelectionIsOpen, setModalColorSelectionModeIsOpen] =
|
//const [selectedLightModeId, setSelectedLightMode] = useState(null);
|
||||||
useState(false);
|
|
||||||
const [selectedLightMode, setSelectedLightMode] = useState(null);
|
const { actionId } = route.params;
|
||||||
|
|
||||||
const supportedLightModes = appContext.deviceFirmwareModes.lightModes.filter(
|
const supportedLightModes = appContext.deviceFirmwareModes.lightModes.filter(
|
||||||
(lightMode) =>
|
(lightMode) =>
|
||||||
|
@ -27,6 +29,12 @@ export function LightsEditActionModalContent({ navigation, route }) {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const selectedLightModeId = GetDeviceSceneAction(
|
||||||
|
appContext.deviceSceneActions,
|
||||||
|
GetDevice(appContext.devices).selectedScene,
|
||||||
|
actionId
|
||||||
|
).modeId;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={{ backgroundColor: appContext.appTheme.backgroundColor }}>
|
<View style={{ backgroundColor: appContext.appTheme.backgroundColor }}>
|
||||||
{appContext.isUserDeveloperModeEnabled ? (
|
{appContext.isUserDeveloperModeEnabled ? (
|
||||||
|
@ -47,10 +55,10 @@ export function LightsEditActionModalContent({ navigation, route }) {
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<MyDeviceTabButton iconName="play-network-outline" top={topFirst + 20} />
|
<MyDeviceTabButton iconName="play-network-outline" top={topFirst + 10} />
|
||||||
<MyDeviceTabButton
|
<MyDeviceTabButton
|
||||||
iconName="play-box-multiple-outline"
|
iconName="play-box-multiple-outline"
|
||||||
top={topSecond + 30}
|
top={topSecond + 15}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<ScrollView>
|
<ScrollView>
|
||||||
|
@ -58,16 +66,16 @@ export function LightsEditActionModalContent({ navigation, route }) {
|
||||||
<MyDropdown
|
<MyDropdown
|
||||||
label="Wähle einen Farbmodus"
|
label="Wähle einen Farbmodus"
|
||||||
selectedItemLabel={
|
selectedItemLabel={
|
||||||
selectedLightMode === null
|
selectedLightModeId === ""
|
||||||
? "Kein Farbmodus ausgewählt"
|
? "Kein Farbmodus ausgewählt"
|
||||||
: supportedLightModes[selectedLightMode].name[
|
: supportedLightModes.find((s) => s.id === selectedLightModeId)
|
||||||
appContext.appLanguage
|
.name[appContext.appLanguage]
|
||||||
]
|
|
||||||
}
|
}
|
||||||
onPress={() =>
|
onPress={() =>
|
||||||
navigation.navigate("modalLayersEditActionColorModeSelection", {
|
navigation.navigate("modalLayersEditActionColorModeSelection", {
|
||||||
supportedLightModes: supportedLightModes,
|
supportedLightModes: supportedLightModes,
|
||||||
selectedLightMode: selectedLightMode,
|
selectedLightModeId: selectedLightModeId,
|
||||||
|
actionId: route.params.actionId,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
@ -99,9 +107,31 @@ export function LayersEditActionColorModeSelectionModalContent({
|
||||||
renderItem={({ item, index }) => (
|
renderItem={({ item, index }) => (
|
||||||
<MyPickerModalListItem
|
<MyPickerModalListItem
|
||||||
itemName={item.name[appContext.appLanguage]}
|
itemName={item.name[appContext.appLanguage]}
|
||||||
itemSelected={route.params.selectedLightMode === index}
|
itemSelected={route.params.selectedLightModeId === item.id}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
// TODO: set selected light mode directly in appContext actions
|
const deviceScene = GetDevice(appContext.devices).selectedScene;
|
||||||
|
|
||||||
|
appContext.setDeviceSceneActions((arr) => {
|
||||||
|
const newArr = [...arr];
|
||||||
|
|
||||||
|
const deviceActionIndex = newArr.findIndex(
|
||||||
|
(a) => a.sceneId === deviceScene
|
||||||
|
);
|
||||||
|
|
||||||
|
if (deviceActionIndex !== -1) {
|
||||||
|
const actionIndex = newArr[
|
||||||
|
deviceActionIndex
|
||||||
|
].actions.findIndex((a) => a.id === route.params.actionId);
|
||||||
|
|
||||||
|
if (actionIndex !== -1) {
|
||||||
|
newArr[deviceActionIndex].actions[actionIndex].modeId =
|
||||||
|
item.id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return newArr;
|
||||||
|
});
|
||||||
|
|
||||||
navigation.goBack();
|
navigation.goBack();
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -1,19 +1,59 @@
|
||||||
import { FlatList, Text, TouchableOpacity, View } from "react-native";
|
import { FlatList, Text, TouchableOpacity, View } from "react-native";
|
||||||
import Card from "../../Components/Card";
|
import Card from "../../Components/Card";
|
||||||
import { AppContext } from "../../utils";
|
import {
|
||||||
import { useContext } from "react";
|
AppContext,
|
||||||
|
AppSelectedUserDevice,
|
||||||
|
Constants,
|
||||||
|
GetDevice,
|
||||||
|
} from "../../utils";
|
||||||
|
import { useCallback, useContext, useEffect, useState } from "react";
|
||||||
import MyDropdown from "../../Components/Dropdown";
|
import MyDropdown from "../../Components/Dropdown";
|
||||||
import MyIcon from "../../Components/Icon";
|
import MyIcon from "../../Components/Icon";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import MyResult from "../../Components/Result";
|
import MyResult from "../../Components/Result";
|
||||||
import { MyTextButton } from "../../Components/Button";
|
import { MyTextButton } from "../../Components/Button";
|
||||||
|
import { useFocusEffect } from "@react-navigation/native";
|
||||||
|
|
||||||
export default function SceneView({ navigation, device }) {
|
export default function SceneView({ navigation }) {
|
||||||
const appContext = useContext(AppContext);
|
const appContext = useContext(AppContext);
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
const deviceScene = device.scenes.find(
|
const [device, setDevice] = useState();
|
||||||
(scene) => scene.id === device.selectedScene
|
|
||||||
|
useFocusEffect(
|
||||||
|
useCallback(() => {
|
||||||
|
setDevice(GetDevice(appContext.devices));
|
||||||
|
console.log("callback");
|
||||||
|
}, [device])
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log("device", device !== undefined);
|
||||||
|
|
||||||
|
if (device === undefined) return <></>;
|
||||||
|
|
||||||
|
const getActionTypeIcon = (actionType) => {
|
||||||
|
let iconName = "";
|
||||||
|
|
||||||
|
switch (actionType) {
|
||||||
|
case Constants.actionType.layers:
|
||||||
|
iconName = "lightbulb-on-outline";
|
||||||
|
break;
|
||||||
|
case Constants.actionType.ambilight:
|
||||||
|
iconName = "television-ambient-light";
|
||||||
|
break;
|
||||||
|
case Constants.actionType.motor:
|
||||||
|
iconName = "axis-z-rotate-counterclockwise";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
iconName = "help";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return <MyIcon name={iconName} size={24} />;
|
||||||
|
};
|
||||||
|
|
||||||
|
const deviceSceneActions = appContext.deviceSceneActions.find(
|
||||||
|
(a) => a.sceneId === device.selectedScene
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -23,9 +63,7 @@ export default function SceneView({ navigation, device }) {
|
||||||
label={t("screens.device.scenes.dropdownSceneSelection.label")}
|
label={t("screens.device.scenes.dropdownSceneSelection.label")}
|
||||||
onPress={() =>
|
onPress={() =>
|
||||||
navigation.navigate("modalChooseScene", {
|
navigation.navigate("modalChooseScene", {
|
||||||
id: device.id,
|
device: { selectedScene: device.selectedScene },
|
||||||
selectedScene: device.selectedScene,
|
|
||||||
scenes: device.scenes,
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
selectedItemLabel={
|
selectedItemLabel={
|
||||||
|
@ -33,7 +71,9 @@ export default function SceneView({ navigation, device }) {
|
||||||
? t(
|
? t(
|
||||||
"screens.device.scenes.dropdownSceneSelection.noSceneSelected"
|
"screens.device.scenes.dropdownSceneSelection.noSceneSelected"
|
||||||
)
|
)
|
||||||
: deviceScene.name
|
: appContext.deviceScenes
|
||||||
|
.find((s) => s.deviceId === AppSelectedUserDevice.current.id)
|
||||||
|
.scenes.find((s) => s.id === device.selectedScene).name
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
</Card>
|
</Card>
|
||||||
|
@ -45,7 +85,8 @@ export default function SceneView({ navigation, device }) {
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<View>
|
<View>
|
||||||
{deviceScene.actions.length === 0 ? (
|
{deviceSceneActions === undefined ||
|
||||||
|
deviceSceneActions.actions.length === 0 ? (
|
||||||
<MyResult
|
<MyResult
|
||||||
text={t("screens.device.scenes.infoNoActionsAvailableInScene")}
|
text={t("screens.device.scenes.infoNoActionsAvailableInScene")}
|
||||||
iconName={"selection-search"}
|
iconName={"selection-search"}
|
||||||
|
@ -53,36 +94,49 @@ export default function SceneView({ navigation, device }) {
|
||||||
) : (
|
) : (
|
||||||
<FlatList
|
<FlatList
|
||||||
scrollEnabled={false}
|
scrollEnabled={false}
|
||||||
data={deviceScene.actions}
|
data={deviceSceneActions.actions}
|
||||||
keyExtractor={(item) => item.id}
|
keyExtractor={(item) => item.id}
|
||||||
renderItem={({ item }) => (
|
renderItem={({ item }) => {
|
||||||
<Card cardBackgroundColor={appContext.appTheme.colors.primary}>
|
console.log("item", item);
|
||||||
<View
|
|
||||||
style={{
|
return (
|
||||||
flexDirection: "row",
|
<Card cardBackgroundColor={"#e67e22"}>
|
||||||
justifyContent: "space-between",
|
<View
|
||||||
}}
|
style={{
|
||||||
>
|
flexDirection: "row",
|
||||||
<Text>{item.name}</Text>
|
justifyContent: "space-between",
|
||||||
<TouchableOpacity
|
}}
|
||||||
onPress={() =>
|
|
||||||
navigation.navigate("modalLayersEditAction", {
|
|
||||||
deviceFirmwareVersion: device.firmware.version,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
>
|
>
|
||||||
<MyIcon name="pencil" size={24} />
|
{getActionTypeIcon(item.type)}
|
||||||
</TouchableOpacity>
|
<View>
|
||||||
</View>
|
<Text>Layer 1 wird auf rot setzen</Text>
|
||||||
</Card>
|
<Text>Animation In: Fade in</Text>
|
||||||
)}
|
<Text>Animation out: Fade out</Text>
|
||||||
|
</View>
|
||||||
|
<TouchableOpacity
|
||||||
|
onPress={() =>
|
||||||
|
navigation.navigate("modalLayersEditAction", {
|
||||||
|
actionId: item.id,
|
||||||
|
deviceFirmwareVersion: device.firmware.version,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<MyIcon name="pencil" size={24} />
|
||||||
|
</TouchableOpacity>
|
||||||
|
</View>
|
||||||
|
</Card>
|
||||||
|
);
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<MyTextButton
|
<MyTextButton
|
||||||
title={t("screens.device.scenes.buttonAddAction")}
|
title={t("screens.device.scenes.buttonAddAction")}
|
||||||
style={{ marginTop: 10 }}
|
style={{ marginTop: 10 }}
|
||||||
actionColor={deviceScene.actions.length === 0}
|
actionColor={
|
||||||
|
deviceSceneActions === undefined ||
|
||||||
|
deviceSceneActions.actions.length === 0
|
||||||
|
}
|
||||||
onPress={() =>
|
onPress={() =>
|
||||||
navigation.navigate("modalAddSceneAction", {
|
navigation.navigate("modalAddSceneAction", {
|
||||||
deviceFirmwareVersion: device.firmware.version,
|
deviceFirmwareVersion: device.firmware.version,
|
||||||
|
|
|
@ -1,18 +1,27 @@
|
||||||
import { Text, View } from "react-native";
|
import { Text, View } from "react-native";
|
||||||
import Card from "../../Components/Card";
|
import Card from "../../Components/Card";
|
||||||
import { useContext, useEffect, useState } from "react";
|
import { useContext, useEffect, useState } from "react";
|
||||||
import { AppContext, AppStyles, ModalContainer } from "../../utils";
|
import {
|
||||||
|
AppContext,
|
||||||
|
AppSelectedUserDevice,
|
||||||
|
AppStyles,
|
||||||
|
ModalContainer,
|
||||||
|
} from "../../utils";
|
||||||
import { Divider } from "../../Components/Divider";
|
import { Divider } from "../../Components/Divider";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import MySwitch from "../../Components/Switch";
|
import MySwitch from "../../Components/Switch";
|
||||||
import MyTextInput from "../../Components/TextInput";
|
import MyTextInput from "../../Components/TextInput";
|
||||||
import { MyIconButton } from "../../Components/Button";
|
import { MyIconButton } from "../../Components/Button";
|
||||||
|
|
||||||
export default function SettingsView({ navigation, device }) {
|
export default function SettingsView({ navigation }) {
|
||||||
const appContext = useContext(AppContext);
|
const appContext = useContext(AppContext);
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [switchState, setSwitchState] = useState(false);
|
const [switchState, setSwitchState] = useState(false);
|
||||||
|
|
||||||
|
const device = appContext.devices.find(
|
||||||
|
(d) => d.id === AppSelectedUserDevice.current.id
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Card>
|
<Card>
|
||||||
|
|
151
src/utils.js
151
src/utils.js
|
@ -1,5 +1,5 @@
|
||||||
import AsyncStorage from "@react-native-async-storage/async-storage";
|
import AsyncStorage from "@react-native-async-storage/async-storage";
|
||||||
import { createContext, createRef, useState } from "react";
|
import { createContext, createRef, useEffect, useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import {
|
import {
|
||||||
Appearance,
|
Appearance,
|
||||||
|
@ -22,6 +22,11 @@ export const Constants = {
|
||||||
label: "English",
|
label: "English",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
actionType: {
|
||||||
|
layers: 0,
|
||||||
|
ambilight: 1,
|
||||||
|
motor: 2,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export const AppStyles = StyleSheet.create({
|
export const AppStyles = StyleSheet.create({
|
||||||
|
@ -178,20 +183,11 @@ export function GetUuid() {
|
||||||
return uuid.v4();
|
return uuid.v4();
|
||||||
}
|
}
|
||||||
|
|
||||||
const appContextPreview = {
|
|
||||||
appColorScheme: "",
|
|
||||||
appLanguage: "",
|
|
||||||
isUserExpertModeEnabled: "",
|
|
||||||
isUserDeveloperModeEnabled: "",
|
|
||||||
appTheme: DarkAppTheme,
|
|
||||||
devices: [],
|
|
||||||
deviceFirmwareModes: [],
|
|
||||||
};
|
|
||||||
|
|
||||||
// data set in the app by default or provided by our servers on firmware update
|
// data set in the app by default or provided by our servers on firmware update
|
||||||
const devDevicesFirmwareModes = {
|
const devDevicesFirmwareModes = {
|
||||||
lightModes: [
|
lightModes: [
|
||||||
{
|
{
|
||||||
|
id: "6138e651-54c5-4fd4-8f40-3364f4e9dfe2",
|
||||||
type: "solidColor",
|
type: "solidColor",
|
||||||
supportedFirmwareVersions: ["1.0.1"],
|
supportedFirmwareVersions: ["1.0.1"],
|
||||||
name: {
|
name: {
|
||||||
|
@ -202,8 +198,9 @@ const devDevicesFirmwareModes = {
|
||||||
adjustments: [],
|
adjustments: [],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
id: "c7097a60-faa9-4928-a531-0a8ecbc115d9",
|
||||||
type: "multipleColors",
|
type: "multipleColors",
|
||||||
supportedFirmwareVersions: ["1.0.0"],
|
supportedFirmwareVersions: ["1.0.1"],
|
||||||
name: {
|
name: {
|
||||||
de: "Zufällig",
|
de: "Zufällig",
|
||||||
en: "Random",
|
en: "Random",
|
||||||
|
@ -225,6 +222,7 @@ const devDevicesFirmwareModes = {
|
||||||
adjustments: [],
|
adjustments: [],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
id: "b42c665a-c2ab-4029-9162-2280caae3274",
|
||||||
type: "multipleColors",
|
type: "multipleColors",
|
||||||
supportedFirmwareVersions: ["1.0.1"],
|
supportedFirmwareVersions: ["1.0.1"],
|
||||||
name: {
|
name: {
|
||||||
|
@ -245,6 +243,7 @@ const devDevicesFirmwareModes = {
|
||||||
],
|
],
|
||||||
motorModes: [
|
motorModes: [
|
||||||
{
|
{
|
||||||
|
type: "motor",
|
||||||
name: {
|
name: {
|
||||||
de: "Hin und her",
|
de: "Hin und her",
|
||||||
en: "Back and forth",
|
en: "Back and forth",
|
||||||
|
@ -312,36 +311,18 @@ const devDevices = [
|
||||||
lastUpdated: "11.07.2023 um 20:33 Uhr",
|
lastUpdated: "11.07.2023 um 20:33 Uhr",
|
||||||
},
|
},
|
||||||
selectedScene: null,
|
selectedScene: null,
|
||||||
scenes: [
|
/*scenes: [
|
||||||
{
|
{
|
||||||
id: "2f21a12a-0bec-4336-99bb-df3f9fc9f537",
|
id: "2f21a12a-0bec-4336-99bb-df3f9fc9f537",
|
||||||
name: "Szene 1",
|
name: "Szene 1",
|
||||||
actions: [
|
actions: [],
|
||||||
{
|
|
||||||
id: 0,
|
|
||||||
name: "Test",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
name: "Test1",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "3f21a12a-0bec-4336-99bb-df3f9fc9f537",
|
id: "3f21a12a-0bec-4336-99bb-df3f9fc9f537",
|
||||||
name: "Szene 2",
|
name: "Szene 2",
|
||||||
actions: [
|
actions: [],
|
||||||
{
|
|
||||||
id: 0,
|
|
||||||
name: "Haha",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
name: "Haha 1",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
],
|
],*/
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "5b331a12a-0bec-4336-99bb-df3f9fc9f537", // deviceId
|
id: "5b331a12a-0bec-4336-99bb-df3f9fc9f537", // deviceId
|
||||||
|
@ -352,30 +333,88 @@ const devDevices = [
|
||||||
lastUpdated: "11.07.2023 um 20:33 Uhr",
|
lastUpdated: "11.07.2023 um 20:33 Uhr",
|
||||||
},
|
},
|
||||||
selectedScene: null,
|
selectedScene: null,
|
||||||
|
//scenes: [],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const devDeviceScenes = [
|
||||||
|
{
|
||||||
|
deviceId: "",
|
||||||
scenes: [
|
scenes: [
|
||||||
{
|
{
|
||||||
id: "3f21a12a-0bec-4336-99bb-df3f9fc9f537",
|
id: "",
|
||||||
name: "Yolo",
|
name: "",
|
||||||
actions: [
|
|
||||||
{
|
|
||||||
id: 0,
|
|
||||||
name: "Haha",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
export function NewEmptyDeviceScene() {
|
const devDeviceSceneActions = [
|
||||||
|
{
|
||||||
|
sceneId: "",
|
||||||
|
actions: [
|
||||||
|
{
|
||||||
|
id: "",
|
||||||
|
modeId: "",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
export function NewInitialDeviceScene(deviceId) {
|
||||||
return {
|
return {
|
||||||
id: GetUuid(),
|
deviceId: deviceId,
|
||||||
name: "Leere Szene",
|
scenes: [],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export function NewInitialDeviceSceneAction(sceneId) {
|
||||||
|
return {
|
||||||
|
sceneId: sceneId,
|
||||||
actions: [],
|
actions: [],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export const AppSelectedUserDevice = createRef(null);
|
export function NewEmptyDeviceScene(name) {
|
||||||
|
return {
|
||||||
|
id: GetUuid(),
|
||||||
|
name: name,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export function NewAction(actionType) {
|
||||||
|
return {
|
||||||
|
id: GetUuid(),
|
||||||
|
type: actionType, // layers, ambilight, motor
|
||||||
|
modeId: "",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export function GetDevice(devices) {
|
||||||
|
return devices.find((d) => d.id === AppSelectedUserDevice.current.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function GetDeviceSceneAction(sceneActions, sceneId, actionId) {
|
||||||
|
return sceneActions
|
||||||
|
.find((s) => s.sceneId === sceneId)
|
||||||
|
.actions.find((a) => a.id === actionId);
|
||||||
|
}
|
||||||
|
|
||||||
|
const appContextPreview = {
|
||||||
|
appColorScheme: "",
|
||||||
|
appLanguage: "",
|
||||||
|
isUserExpertModeEnabled: "",
|
||||||
|
isUserDeveloperModeEnabled: "",
|
||||||
|
appTheme: DarkAppTheme,
|
||||||
|
devices: [],
|
||||||
|
deviceScenes: [],
|
||||||
|
deviceSceneActions: [],
|
||||||
|
deviceFirmwareModes: [],
|
||||||
|
userColorSwatchesFavorites: [],
|
||||||
|
};
|
||||||
|
|
||||||
|
export const AppSelectedUserDevice = createRef();
|
||||||
|
AppSelectedUserDevice.current = { id: "", routeName: "" };
|
||||||
|
|
||||||
export const AppContext = createContext(appContextPreview);
|
export const AppContext = createContext(appContextPreview);
|
||||||
|
|
||||||
|
@ -385,9 +424,14 @@ export function AppProvider({ children }) {
|
||||||
const [appTheme, setAppTheme] = useState(DarkAppTheme);
|
const [appTheme, setAppTheme] = useState(DarkAppTheme);
|
||||||
const [isUserExpertModeEnabled, setIsUserExpertModeEnabled] = useState(false);
|
const [isUserExpertModeEnabled, setIsUserExpertModeEnabled] = useState(false);
|
||||||
const [devices, setDevices] = useState(devDevices);
|
const [devices, setDevices] = useState(devDevices);
|
||||||
|
const [deviceScenes, setDeviceScenes] = useState([]);
|
||||||
|
const [deviceSceneActions, setDeviceSceneActions] = useState([]);
|
||||||
const [deviceFirmwareModes, setDeviceFirmwareModes] = useState(
|
const [deviceFirmwareModes, setDeviceFirmwareModes] = useState(
|
||||||
devDevicesFirmwareModes
|
devDevicesFirmwareModes
|
||||||
);
|
);
|
||||||
|
const [userColorSwatchesFavorites, setUserColorSwatchesFavorites] = useState(
|
||||||
|
[]
|
||||||
|
);
|
||||||
const { i18n } = useTranslation();
|
const { i18n } = useTranslation();
|
||||||
|
|
||||||
// TODO: only while development
|
// TODO: only while development
|
||||||
|
@ -422,6 +466,11 @@ export function AppProvider({ children }) {
|
||||||
setIsUserDeveloperModeEnabled(value);
|
setIsUserDeveloperModeEnabled(value);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const saveUserColorSwatchesFavorites = async (value) => {
|
||||||
|
StoreData("userColorSwatchesFavorites", value);
|
||||||
|
setUserColorSwatchesFavorites(value);
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AppContext.Provider
|
<AppContext.Provider
|
||||||
value={{
|
value={{
|
||||||
|
@ -432,12 +481,18 @@ export function AppProvider({ children }) {
|
||||||
appTheme: appTheme,
|
appTheme: appTheme,
|
||||||
isUserExpertModeEnabled: isUserExpertModeEnabled,
|
isUserExpertModeEnabled: isUserExpertModeEnabled,
|
||||||
setIsUserExpertModeEnabled: saveUserExpertMode,
|
setIsUserExpertModeEnabled: saveUserExpertMode,
|
||||||
isUserDeveloperModeEnabled: isUserDeveloperModeEnabled,
|
|
||||||
setUserIsDeveloperModeEnabled: saveUserDeveloperMode,
|
|
||||||
devices: devices,
|
devices: devices,
|
||||||
setDevices: setDevices,
|
setDevices: setDevices,
|
||||||
|
deviceScenes: deviceScenes,
|
||||||
|
setDeviceScenes: setDeviceScenes,
|
||||||
|
deviceSceneActions: deviceSceneActions,
|
||||||
|
setDeviceSceneActions: setDeviceSceneActions,
|
||||||
deviceFirmwareModes: deviceFirmwareModes,
|
deviceFirmwareModes: deviceFirmwareModes,
|
||||||
setDeviceFirmwareModes: setDeviceFirmwareModes,
|
setDeviceFirmwareModes: setDeviceFirmwareModes,
|
||||||
|
userColorSwatchesFavorites: userColorSwatchesFavorites,
|
||||||
|
setUserColorSwatchesFavorites: saveUserColorSwatchesFavorites,
|
||||||
|
isUserDeveloperModeEnabled: isUserDeveloperModeEnabled,
|
||||||
|
setUserIsDeveloperModeEnabled: saveUserDeveloperMode,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
|
|
Loading…
Reference in New Issue