From dbc6223954758efde588f807c69c45ba1594dbb7 Mon Sep 17 00:00:00 2001 From: Claudio Maggioni Date: Fri, 8 May 2020 15:47:18 +0200 Subject: [PATCH] Fixed git merge sentience --- smart-hut/src/store.js | 75 ------------------------------------------ 1 file changed, 75 deletions(-) diff --git a/smart-hut/src/store.js b/smart-hut/src/store.js index 359604e..ecfa94a 100644 --- a/smart-hut/src/store.js +++ b/smart-hut/src/store.js @@ -81,81 +81,6 @@ function reducer(previousState, action) { } }; - const createOrUpdateRoom = (room) => { - if (!newState.rooms[room.id]) { - newState = update(newState, { - rooms: { [room.id]: { $set: { ...room, devices: new Set() } } }, - }); - } else { - newState = update(newState, { - rooms: { - [room.id]: { - name: { $set: room.name }, - image: { $set: room.image }, - icon: { $set: room.icon }, - }, - }, - }); - } - - if (newState.pendingJoins.rooms[room.id]) { - newState = update(newState, { - pendingJoins: { rooms: { $unset: [room.id] } }, - rooms: { - [room.id]: { - devices: { - $add: [...newState.pendingJoins.rooms[room.id]], - }, - }, - }, - }); - } - }; - - const createOrUpdateScene = (scene) => { - if (!newState.scenes[scene.id]) { - newState = update(newState, { - scenes: { - [scene.id]: { $set: { ...scene, sceneStates: new Set() } }, - }, - }); - } else { - newState = update(newState, { - scenes: { - [scene.id]: { - name: { $set: scene.name }, - icon: { $set: scene.icon }, - }, - }, - }); - } - - if (newState.pendingJoins.scenes[scene.id]) { - newState = update(newState, { - pendingJoins: { scenes: { $unset: [scene.id] } }, - scenes: { - [scene.id]: { - sceneStates: { - $add: [...newState.pendingJoins.scenes[scene.id]], - }, - }, - }, - }); - } - }; - - const updateDeviceProps = (device) => { - // In some updates the information regarding a device is incomplete - // due to a fault in the type system and JPA repository management - // in the backend. Therefore to solve this avoid to delete existing - // attributes of this device in the previous state, but just update - // the new ones. - change.devices[device.id] = {}; - for (const key in device) { - change.devices[device.id][key] = { $set: device[key] }; - } - }; - const updateSceneStateProps = (state) => { change.sceneStates[state.id] = {}; for (const key in state) {