From 3e03993d5bf8964cdfa959dbe2261a377b0421d1 Mon Sep 17 00:00:00 2001 From: Christopher Date: Sun, 13 Dec 2020 21:59:10 +0100 Subject: [PATCH 1/9] feat(settings): using local storage to save settings Need to ensure that when a new setting is set, we re-render the phone. --- phone/src/Phone.tsx | 12 +++++-- .../apps/settings/components/SettingsApp.tsx | 34 ++++++++++++------- phone/src/apps/settings/hooks/useSettings.ts | 17 ++++++---- phone/src/config/hooks/useConfig.ts | 14 ++++---- phone/src/os/phone/hooks/useLocalStorage.ts | 22 +++++++++--- 5 files changed, 65 insertions(+), 34 deletions(-) diff --git a/phone/src/Phone.tsx b/phone/src/Phone.tsx index 5ae11c6..09a5bb6 100644 --- a/phone/src/Phone.tsx +++ b/phone/src/Phone.tsx @@ -25,6 +25,7 @@ import { useNotesService } from './apps/notes/hooks/useNotesService'; import { usePhotoService } from './apps/camera/hooks/usePhotoService'; import Nui from './os/nui-events/utils/Nui'; import { usePhone } from './os/phone/hooks/usePhone'; +import useLocalStorage from './os/phone/hooks/useLocalStorage'; // Inject mock data when in development env. if (process.env.NODE_ENV === 'development') { @@ -245,6 +246,7 @@ function Phone() { useNuiService(); usePhoneService(); const { visibility } = usePhone(); + const [, , getStorageItem] = useLocalStorage(); const { settings, currentTheme } = useSettings(); const { allApps } = useApps(); useSimcardService(); @@ -272,19 +274,23 @@ function Phone() { return (
-
+
<> diff --git a/phone/src/apps/settings/components/SettingsApp.tsx b/phone/src/apps/settings/components/SettingsApp.tsx index f8071ca..ac7eaeb 100644 --- a/phone/src/apps/settings/components/SettingsApp.tsx +++ b/phone/src/apps/settings/components/SettingsApp.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { useState } from 'react'; import { AppWrapper } from '../../../ui/components'; import { AppTitle } from '../../../ui/components/AppTitle'; import { AppContent } from '../../../ui/components/AppContent'; @@ -24,6 +24,7 @@ import { } from '@material-ui/icons'; import { ListSubheader } from '@material-ui/core'; +import useLocalStorage from '../../../os/phone/hooks/useLocalStorage'; const SubHeaderComp = (props: { text: string }) => ( @@ -35,26 +36,33 @@ export const SettingsApp = () => { const settingsApp = useApp('SETTINGS'); const [config] = useConfig(); const { setSettings, settings } = useSettings(); + const [, setVal, getStorageItem] = useLocalStorage(); const simcard = useSimcard(); const wallpapers = config.wallpapers.map( - MapStringOptions(settings.wallpaper, (val: string) => - setSettings('wallpaper', val) + MapStringOptions(getStorageItem('wallpaper'), (val: string) => + setVal('wallpaper', val) ) ); const frames = config.frames.map( - MapStringOptions(settings.frame, (val: string) => setSettings('frame', val)) + MapStringOptions(getStorageItem('frame'), (val: string) => + setVal('frame', val) + ) ); const themes = Object.keys(config.themes).map( - MapStringOptions(settings.theme, (val: string) => setSettings('theme', val)) + MapStringOptions(getStorageItem('theme'), (val: string) => + setVal('theme', val) + ) ); const zoomOptions = config.zoomOptions.map( - MapStringOptions(settings.zoom, (val: string) => setSettings('zoom', val)) + MapStringOptions(getStorageItem('zoom'), (val: string) => + setVal('zoom', val) + ) ); // Doesn't actually do anything for the time being const ringtones = config.ringtones.map( - MapStringOptions(settings.ringtone, (val: string) => - setSettings('ringtone', val) + MapStringOptions(getStorageItem('ringtone'), (val: string) => + setVal('ringtone', val) ) ); // * Probably gonna make this a slider component in the future @@ -77,7 +85,7 @@ export const SettingsApp = () => { /> } @@ -97,28 +105,28 @@ export const SettingsApp = () => { }> } /> } /> } /> } diff --git a/phone/src/apps/settings/hooks/useSettings.ts b/phone/src/apps/settings/hooks/useSettings.ts index 61def22..8ef1312 100644 --- a/phone/src/apps/settings/hooks/useSettings.ts +++ b/phone/src/apps/settings/hooks/useSettings.ts @@ -1,16 +1,19 @@ -import Default from "../default.json"; -import { useConfig } from "../../../config/hooks/useConfig"; -import { atom } from "recoil"; -import { createMuiTheme } from "@material-ui/core"; +import Default from '../default.json'; +import { useConfig } from '../../../config/hooks/useConfig'; +import { atom } from 'recoil'; +import { createMuiTheme } from '@material-ui/core'; +import useLocalStorage from '../../../os/phone/hooks/useLocalStorage'; const settingsState = atom({ - key: "settings", + key: 'settings', default: Default, }); export const useSettings = (): any => { - const [settings, setSettings] = useConfig(settingsState); + const [, , getStorageItem] = useLocalStorage('theme', 'taso-dark'); + const [settings, setSettings] = useLocalStorage(); const [config] = useConfig(); - const currentTheme = () => createMuiTheme(config.themes[settings.theme]); + const currentTheme = () => + createMuiTheme(config.themes[getStorageItem('theme')]); return { settings, setSettings, currentTheme }; }; diff --git a/phone/src/config/hooks/useConfig.ts b/phone/src/config/hooks/useConfig.ts index 87e2fcf..617940e 100644 --- a/phone/src/config/hooks/useConfig.ts +++ b/phone/src/config/hooks/useConfig.ts @@ -1,19 +1,19 @@ -import Default from "../default.json"; -import { atom, useRecoilState } from "recoil"; +import Default from '../default.json'; +import { atom, useRecoilState } from 'recoil'; +import useLocalStorage from '../../os/phone/hooks/useLocalStorage'; const configState = atom({ - key: "config", + key: 'config', default: Default, }); export const useConfig = (state: any = configState): any => { + const [, setVal] = useLocalStorage(); const [config, _setConfig] = useRecoilState(state); const setConfig = (key, value) => { - _setConfig((oldConfig) => ({ - ...oldConfig, - [key]: value, - })); + console.log(`setConfig: ${key} ${value}`); + setVal(key, value); }; return [config, setConfig]; diff --git a/phone/src/os/phone/hooks/useLocalStorage.ts b/phone/src/os/phone/hooks/useLocalStorage.ts index ab5a4b0..9c8bd80 100644 --- a/phone/src/os/phone/hooks/useLocalStorage.ts +++ b/phone/src/os/phone/hooks/useLocalStorage.ts @@ -9,7 +9,7 @@ import { useState } from 'react'; * if there is no savedState */ -function useLocalStorage(key: string, initialValue: T) { +function useLocalStorage(key?: string, initialValue?: T) { // Serves as a nice identifying prefix for the key const UNIQ_PREFIX = 'npwd_phone_'; const [localVal, setLocalVal] = useState(() => { @@ -25,8 +25,22 @@ function useLocalStorage(key: string, initialValue: T) { } }); + const getStorageItem = (localKey: string) => { + try { + const data = window.localStorage.getItem(UNIQ_PREFIX + localKey); + // return stored or initValue if none stored + return data ? JSON.parse(data) : initialValue; + } catch (e) { + // TODO: Integrate debug error state here + console.log(e); + // We still return initVal if error is thrown + return initialValue; + } + }; + // Trying to rep useState setter pretty close just with localStorage - const setVal = (value: T | ((val: T) => T)) => { + const setVal = (localKey, value: T | ((val: T) => T)) => { + console.log(localKey, value); try { // Same API as useState meaning we can accept a function for value const valForStore = value instanceof Function ? value(localVal) : value; @@ -34,7 +48,7 @@ function useLocalStorage(key: string, initialValue: T) { setLocalVal(valForStore); // Set that localStorage yo window.localStorage.setItem( - UNIQ_PREFIX + key, + UNIQ_PREFIX + localKey, JSON.stringify(valForStore) ); } catch (e) { @@ -43,7 +57,7 @@ function useLocalStorage(key: string, initialValue: T) { } }; - return [localVal, setVal]; + return [localVal, setVal, getStorageItem] as const; } export default useLocalStorage; From 14223c9800cf7efbc4e0432d50e89ca987f0a2f2 Mon Sep 17 00:00:00 2001 From: Christopher Date: Mon, 14 Dec 2020 20:27:59 +0100 Subject: [PATCH 2/9] feat(idontknowwhatthisis) --- phone/src/apps/settings/components/SettingsApp.tsx | 9 +++++++-- phone/src/config/hooks/useConfig.ts | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/phone/src/apps/settings/components/SettingsApp.tsx b/phone/src/apps/settings/components/SettingsApp.tsx index ac7eaeb..5d589e7 100644 --- a/phone/src/apps/settings/components/SettingsApp.tsx +++ b/phone/src/apps/settings/components/SettingsApp.tsx @@ -1,4 +1,4 @@ -import React, { useState } from 'react'; +import React, { useEffect, useState } from 'react'; import { AppWrapper } from '../../../ui/components'; import { AppTitle } from '../../../ui/components/AppTitle'; import { AppContent } from '../../../ui/components/AppContent'; @@ -36,9 +36,14 @@ export const SettingsApp = () => { const settingsApp = useApp('SETTINGS'); const [config] = useConfig(); const { setSettings, settings } = useSettings(); - const [, setVal, getStorageItem] = useLocalStorage(); + const [localVal, setVal, getStorageItem] = useLocalStorage(); const simcard = useSimcard(); + useEffect(() => { + console.log('new localstorage'); + // this will be used to trigger a alert that gives feedback when the a setting is changed + }, [localVal]); + const wallpapers = config.wallpapers.map( MapStringOptions(getStorageItem('wallpaper'), (val: string) => setVal('wallpaper', val) diff --git a/phone/src/config/hooks/useConfig.ts b/phone/src/config/hooks/useConfig.ts index 617940e..ab2b06e 100644 --- a/phone/src/config/hooks/useConfig.ts +++ b/phone/src/config/hooks/useConfig.ts @@ -9,7 +9,7 @@ const configState = atom({ export const useConfig = (state: any = configState): any => { const [, setVal] = useLocalStorage(); - const [config, _setConfig] = useRecoilState(state); + const [config] = useRecoilState(state); const setConfig = (key, value) => { console.log(`setConfig: ${key} ${value}`); From dddddc01f83116316ce8bc83a48adc83cf76bd5c Mon Sep 17 00:00:00 2001 From: Christopher Date: Mon, 4 Jan 2021 20:33:53 +0100 Subject: [PATCH 3/9] feat(localstorage): resolved issue with phone not re-rendering --- phone/src/apps/settings/components/SettingItem.tsx | 1 + phone/src/apps/settings/components/SettingsApp.tsx | 10 ++++------ phone/src/os/phone/hooks/forceUpdate.ts | 7 +++++++ phone/src/os/phone/hooks/state.ts | 4 ++++ phone/src/os/phone/hooks/useLocalStorage.ts | 3 +++ 5 files changed, 19 insertions(+), 6 deletions(-) create mode 100644 phone/src/os/phone/hooks/forceUpdate.ts diff --git a/phone/src/apps/settings/components/SettingItem.tsx b/phone/src/apps/settings/components/SettingItem.tsx index 8dd485c..6665acf 100644 --- a/phone/src/apps/settings/components/SettingItem.tsx +++ b/phone/src/apps/settings/components/SettingItem.tsx @@ -6,6 +6,7 @@ import { ListItemIcon, } from '@material-ui/core'; import { SvgIconProps } from '@material-ui/core'; + interface IProps { options?: any; label: string; diff --git a/phone/src/apps/settings/components/SettingsApp.tsx b/phone/src/apps/settings/components/SettingsApp.tsx index 5d589e7..fc307e1 100644 --- a/phone/src/apps/settings/components/SettingsApp.tsx +++ b/phone/src/apps/settings/components/SettingsApp.tsx @@ -35,15 +35,9 @@ const SubHeaderComp = (props: { text: string }) => ( export const SettingsApp = () => { const settingsApp = useApp('SETTINGS'); const [config] = useConfig(); - const { setSettings, settings } = useSettings(); const [localVal, setVal, getStorageItem] = useLocalStorage(); const simcard = useSimcard(); - useEffect(() => { - console.log('new localstorage'); - // this will be used to trigger a alert that gives feedback when the a setting is changed - }, [localVal]); - const wallpapers = config.wallpapers.map( MapStringOptions(getStorageItem('wallpaper'), (val: string) => setVal('wallpaper', val) @@ -77,6 +71,10 @@ export const SettingsApp = () => { // TODO: These new settings all work + useEffect(() => { + // this will be used to trigger a alert that gives feedback when the a setting is changed + }, [setVal]); + const [openMenu, closeMenu, ContextMenu, isMenuOpen] = useContextMenu(); return ( diff --git a/phone/src/os/phone/hooks/forceUpdate.ts b/phone/src/os/phone/hooks/forceUpdate.ts new file mode 100644 index 0000000..ebf5e3c --- /dev/null +++ b/phone/src/os/phone/hooks/forceUpdate.ts @@ -0,0 +1,7 @@ +import { useRecoilState } from 'recoil'; +import { phoneState } from './state'; + +export const useForceUpdate = () => { + const [update, setUpdate] = useRecoilState(phoneState.forceUpdateState); + return { update, setUpdate }; +}; diff --git a/phone/src/os/phone/hooks/state.ts b/phone/src/os/phone/hooks/state.ts index 5c37fb6..1dc0ad3 100644 --- a/phone/src/os/phone/hooks/state.ts +++ b/phone/src/os/phone/hooks/state.ts @@ -9,4 +9,8 @@ export const phoneState = { key: 'phoneConfig', default: undefined, }), + forceUpdateState: atom({ + key: 'fuckingupdate', + default: 0, + }), }; diff --git a/phone/src/os/phone/hooks/useLocalStorage.ts b/phone/src/os/phone/hooks/useLocalStorage.ts index 9c8bd80..fab9019 100644 --- a/phone/src/os/phone/hooks/useLocalStorage.ts +++ b/phone/src/os/phone/hooks/useLocalStorage.ts @@ -1,4 +1,5 @@ import { useState } from 'react'; +import { useForceUpdate } from '../../../os/phone/hooks/forceUpdate'; // TODO: Integrate debug log to fetch when that branch is merged @@ -10,6 +11,7 @@ import { useState } from 'react'; */ function useLocalStorage(key?: string, initialValue?: T) { + const { update, setUpdate } = useForceUpdate(); // Serves as a nice identifying prefix for the key const UNIQ_PREFIX = 'npwd_phone_'; const [localVal, setLocalVal] = useState(() => { @@ -42,6 +44,7 @@ function useLocalStorage(key?: string, initialValue?: T) { const setVal = (localKey, value: T | ((val: T) => T)) => { console.log(localKey, value); try { + setUpdate(update + 1); // Same API as useState meaning we can accept a function for value const valForStore = value instanceof Function ? value(localVal) : value; // Save that state so we repli useState From 07dc73f0cbb4c3eae4e5ac47aed17d11195260c3 Mon Sep 17 00:00:00 2001 From: Christopher Date: Thu, 7 Jan 2021 21:17:44 +0100 Subject: [PATCH 4/9] minor changes in localStorage - nothing to see here --- phone/src/Phone.tsx | 3 +-- phone/src/apps/settings/hooks/useSettings.ts | 6 ++--- phone/src/config/hooks/useConfig.ts | 11 ++++++---- phone/src/os/phone/hooks/getLocalStorage.ts | 12 ++++++++++ phone/src/os/phone/hooks/settingState.ts | 12 ++++++++++ phone/src/os/phone/hooks/useLocalStorage.ts | 23 +++----------------- 6 files changed, 38 insertions(+), 29 deletions(-) create mode 100644 phone/src/os/phone/hooks/getLocalStorage.ts create mode 100644 phone/src/os/phone/hooks/settingState.ts diff --git a/phone/src/Phone.tsx b/phone/src/Phone.tsx index 09a5bb6..9da3827 100644 --- a/phone/src/Phone.tsx +++ b/phone/src/Phone.tsx @@ -25,7 +25,7 @@ import { useNotesService } from './apps/notes/hooks/useNotesService'; import { usePhotoService } from './apps/camera/hooks/usePhotoService'; import Nui from './os/nui-events/utils/Nui'; import { usePhone } from './os/phone/hooks/usePhone'; -import useLocalStorage from './os/phone/hooks/useLocalStorage'; +import { getStorageItem } from './os/phone/hooks/getLocalStorage'; // Inject mock data when in development env. if (process.env.NODE_ENV === 'development') { @@ -246,7 +246,6 @@ function Phone() { useNuiService(); usePhoneService(); const { visibility } = usePhone(); - const [, , getStorageItem] = useLocalStorage(); const { settings, currentTheme } = useSettings(); const { allApps } = useApps(); useSimcardService(); diff --git a/phone/src/apps/settings/hooks/useSettings.ts b/phone/src/apps/settings/hooks/useSettings.ts index 8ef1312..c472605 100644 --- a/phone/src/apps/settings/hooks/useSettings.ts +++ b/phone/src/apps/settings/hooks/useSettings.ts @@ -3,6 +3,7 @@ import { useConfig } from '../../../config/hooks/useConfig'; import { atom } from 'recoil'; import { createMuiTheme } from '@material-ui/core'; import useLocalStorage from '../../../os/phone/hooks/useLocalStorage'; +import { getStorageItem } from '../../../os/phone/hooks/getLocalStorage'; const settingsState = atom({ key: 'settings', @@ -10,10 +11,9 @@ const settingsState = atom({ }); export const useSettings = (): any => { - const [, , getStorageItem] = useLocalStorage('theme', 'taso-dark'); + const theme = getStorageItem('theme'); const [settings, setSettings] = useLocalStorage(); const [config] = useConfig(); - const currentTheme = () => - createMuiTheme(config.themes[getStorageItem('theme')]); + const currentTheme = () => createMuiTheme(config.themes[theme]); return { settings, setSettings, currentTheme }; }; diff --git a/phone/src/config/hooks/useConfig.ts b/phone/src/config/hooks/useConfig.ts index ab2b06e..02f15e7 100644 --- a/phone/src/config/hooks/useConfig.ts +++ b/phone/src/config/hooks/useConfig.ts @@ -8,12 +8,15 @@ const configState = atom({ }); export const useConfig = (state: any = configState): any => { - const [, setVal] = useLocalStorage(); - const [config] = useRecoilState(state); + const [, setVal] = useLocalStorage(''); + const [config, _setConfig] = useRecoilState(state); const setConfig = (key, value) => { - console.log(`setConfig: ${key} ${value}`); - setVal(key, value); + _setConfig((oldConfig) => ({ + ...oldConfig, + [key]: value, + })); + //setVal(key, value); }; return [config, setConfig]; diff --git a/phone/src/os/phone/hooks/getLocalStorage.ts b/phone/src/os/phone/hooks/getLocalStorage.ts new file mode 100644 index 0000000..84e2838 --- /dev/null +++ b/phone/src/os/phone/hooks/getLocalStorage.ts @@ -0,0 +1,12 @@ +export const getStorageItem = (key: string) => { + const UNIQ_PREFIX = 'npwd_phone_'; + try { + const data = window.localStorage.getItem(UNIQ_PREFIX + key); + // return stored or initValue if none stored + return JSON.parse(data); + } catch (e) { + // TODO: Integrate debug error state here + console.log(e); + // We still return initVal if error is thrown + } +}; diff --git a/phone/src/os/phone/hooks/settingState.ts b/phone/src/os/phone/hooks/settingState.ts new file mode 100644 index 0000000..a8edf73 --- /dev/null +++ b/phone/src/os/phone/hooks/settingState.ts @@ -0,0 +1,12 @@ +import { atom } from 'recoil'; + +export const phoneSettings = { + theme: atom({ + key: 'settingTheme', + default: 'default-dark', + }), + zoom: atom({ + key: 'settingZoom', + default: '100%', + }), +}; diff --git a/phone/src/os/phone/hooks/useLocalStorage.ts b/phone/src/os/phone/hooks/useLocalStorage.ts index fab9019..042acf3 100644 --- a/phone/src/os/phone/hooks/useLocalStorage.ts +++ b/phone/src/os/phone/hooks/useLocalStorage.ts @@ -1,5 +1,4 @@ import { useState } from 'react'; -import { useForceUpdate } from '../../../os/phone/hooks/forceUpdate'; // TODO: Integrate debug log to fetch when that branch is merged @@ -11,7 +10,6 @@ import { useForceUpdate } from '../../../os/phone/hooks/forceUpdate'; */ function useLocalStorage(key?: string, initialValue?: T) { - const { update, setUpdate } = useForceUpdate(); // Serves as a nice identifying prefix for the key const UNIQ_PREFIX = 'npwd_phone_'; const [localVal, setLocalVal] = useState(() => { @@ -27,31 +25,16 @@ function useLocalStorage(key?: string, initialValue?: T) { } }); - const getStorageItem = (localKey: string) => { - try { - const data = window.localStorage.getItem(UNIQ_PREFIX + localKey); - // return stored or initValue if none stored - return data ? JSON.parse(data) : initialValue; - } catch (e) { - // TODO: Integrate debug error state here - console.log(e); - // We still return initVal if error is thrown - return initialValue; - } - }; - // Trying to rep useState setter pretty close just with localStorage - const setVal = (localKey, value: T | ((val: T) => T)) => { - console.log(localKey, value); + const setVal = (value: T | ((val: T) => T)) => { try { - setUpdate(update + 1); // Same API as useState meaning we can accept a function for value const valForStore = value instanceof Function ? value(localVal) : value; // Save that state so we repli useState setLocalVal(valForStore); // Set that localStorage yo window.localStorage.setItem( - UNIQ_PREFIX + localKey, + UNIQ_PREFIX + key, JSON.stringify(valForStore) ); } catch (e) { @@ -60,7 +43,7 @@ function useLocalStorage(key?: string, initialValue?: T) { } }; - return [localVal, setVal, getStorageItem] as const; + return [localVal, setVal] as const; } export default useLocalStorage; From 5fdb9ba21c098ee436bf55031c05a396bc9b0043 Mon Sep 17 00:00:00 2001 From: Christopher Date: Fri, 8 Jan 2021 21:48:24 +0100 Subject: [PATCH 5/9] fix(localStorage): solution to localStorage issue Still need to find a good way to re-render --- phone/src/Phone.tsx | 10 ++--- .../apps/settings/components/SettingsApp.tsx | 40 +++++++++---------- phone/src/apps/settings/hooks/useSettings.ts | 10 ++--- phone/src/config/hooks/useConfig.ts | 1 - phone/src/os/phone/hooks/forceUpdate.ts | 7 ---- phone/src/os/phone/hooks/getLocalStorage.ts | 12 ------ phone/src/os/phone/hooks/useLocalStorage.ts | 24 ++++++++++- 7 files changed, 51 insertions(+), 53 deletions(-) delete mode 100644 phone/src/os/phone/hooks/forceUpdate.ts delete mode 100644 phone/src/os/phone/hooks/getLocalStorage.ts diff --git a/phone/src/Phone.tsx b/phone/src/Phone.tsx index 9da3827..9627e86 100644 --- a/phone/src/Phone.tsx +++ b/phone/src/Phone.tsx @@ -25,7 +25,7 @@ import { useNotesService } from './apps/notes/hooks/useNotesService'; import { usePhotoService } from './apps/camera/hooks/usePhotoService'; import Nui from './os/nui-events/utils/Nui'; import { usePhone } from './os/phone/hooks/usePhone'; -import { getStorageItem } from './os/phone/hooks/getLocalStorage'; +import { getStorage } from './os/phone/hooks/useLocalStorage'; // Inject mock data when in development env. if (process.env.NODE_ENV === 'development') { @@ -273,21 +273,19 @@ function Phone() { return (
-
+
( @@ -35,33 +38,32 @@ const SubHeaderComp = (props: { text: string }) => ( export const SettingsApp = () => { const settingsApp = useApp('SETTINGS'); const [config] = useConfig(); - const [localVal, setVal, getStorageItem] = useLocalStorage(); const simcard = useSimcard(); const wallpapers = config.wallpapers.map( - MapStringOptions(getStorageItem('wallpaper'), (val: string) => - setVal('wallpaper', val) + MapStringOptions(getStorage('wallpaper'), (val: string) => + writeStorage('wallpaper', val) ) ); const frames = config.frames.map( - MapStringOptions(getStorageItem('frame'), (val: string) => - setVal('frame', val) + MapStringOptions(getStorage('frame'), (val: string) => + writeStorage('frame', val) ) ); const themes = Object.keys(config.themes).map( - MapStringOptions(getStorageItem('theme'), (val: string) => - setVal('theme', val) + MapStringOptions(getStorage('theme'), (val: string) => + writeStorage('theme', val) ) ); const zoomOptions = config.zoomOptions.map( - MapStringOptions(getStorageItem('zoom'), (val: string) => - setVal('zoom', val) + MapStringOptions(getStorage('zoom'), (val: string) => + writeStorage('zoom', val) ) ); // Doesn't actually do anything for the time being const ringtones = config.ringtones.map( - MapStringOptions(getStorageItem('ringtone'), (val: string) => - setVal('ringtone', val) + MapStringOptions(getStorage('ringtone'), (val: string) => + writeStorage('ringtone', val) ) ); // * Probably gonna make this a slider component in the future @@ -71,9 +73,7 @@ export const SettingsApp = () => { // TODO: These new settings all work - useEffect(() => { - // this will be used to trigger a alert that gives feedback when the a setting is changed - }, [setVal]); + useEffect(() => {}, [getStorage]); const [openMenu, closeMenu, ContextMenu, isMenuOpen] = useContextMenu(); return ( @@ -88,7 +88,7 @@ export const SettingsApp = () => { /> } @@ -108,28 +108,28 @@ export const SettingsApp = () => { }> } /> } /> } /> } diff --git a/phone/src/apps/settings/hooks/useSettings.ts b/phone/src/apps/settings/hooks/useSettings.ts index c472605..dceedfe 100644 --- a/phone/src/apps/settings/hooks/useSettings.ts +++ b/phone/src/apps/settings/hooks/useSettings.ts @@ -2,8 +2,9 @@ import Default from '../default.json'; import { useConfig } from '../../../config/hooks/useConfig'; import { atom } from 'recoil'; import { createMuiTheme } from '@material-ui/core'; -import useLocalStorage from '../../../os/phone/hooks/useLocalStorage'; -import { getStorageItem } from '../../../os/phone/hooks/getLocalStorage'; +import useLocalStorage, { + getStorage, +} from '../../../os/phone/hooks/useLocalStorage'; const settingsState = atom({ key: 'settings', @@ -11,9 +12,8 @@ const settingsState = atom({ }); export const useSettings = (): any => { - const theme = getStorageItem('theme'); - const [settings, setSettings] = useLocalStorage(); + const theme = getStorage('theme'); const [config] = useConfig(); const currentTheme = () => createMuiTheme(config.themes[theme]); - return { settings, setSettings, currentTheme }; + return { currentTheme }; }; diff --git a/phone/src/config/hooks/useConfig.ts b/phone/src/config/hooks/useConfig.ts index 02f15e7..59785dd 100644 --- a/phone/src/config/hooks/useConfig.ts +++ b/phone/src/config/hooks/useConfig.ts @@ -8,7 +8,6 @@ const configState = atom({ }); export const useConfig = (state: any = configState): any => { - const [, setVal] = useLocalStorage(''); const [config, _setConfig] = useRecoilState(state); const setConfig = (key, value) => { diff --git a/phone/src/os/phone/hooks/forceUpdate.ts b/phone/src/os/phone/hooks/forceUpdate.ts deleted file mode 100644 index ebf5e3c..0000000 --- a/phone/src/os/phone/hooks/forceUpdate.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { useRecoilState } from 'recoil'; -import { phoneState } from './state'; - -export const useForceUpdate = () => { - const [update, setUpdate] = useRecoilState(phoneState.forceUpdateState); - return { update, setUpdate }; -}; diff --git a/phone/src/os/phone/hooks/getLocalStorage.ts b/phone/src/os/phone/hooks/getLocalStorage.ts deleted file mode 100644 index 84e2838..0000000 --- a/phone/src/os/phone/hooks/getLocalStorage.ts +++ /dev/null @@ -1,12 +0,0 @@ -export const getStorageItem = (key: string) => { - const UNIQ_PREFIX = 'npwd_phone_'; - try { - const data = window.localStorage.getItem(UNIQ_PREFIX + key); - // return stored or initValue if none stored - return JSON.parse(data); - } catch (e) { - // TODO: Integrate debug error state here - console.log(e); - // We still return initVal if error is thrown - } -}; diff --git a/phone/src/os/phone/hooks/useLocalStorage.ts b/phone/src/os/phone/hooks/useLocalStorage.ts index 042acf3..2467a98 100644 --- a/phone/src/os/phone/hooks/useLocalStorage.ts +++ b/phone/src/os/phone/hooks/useLocalStorage.ts @@ -9,7 +9,7 @@ import { useState } from 'react'; * if there is no savedState */ -function useLocalStorage(key?: string, initialValue?: T) { +function useLocalStorage(key: string, initialValue: T) { // Serves as a nice identifying prefix for the key const UNIQ_PREFIX = 'npwd_phone_'; const [localVal, setLocalVal] = useState(() => { @@ -43,7 +43,27 @@ function useLocalStorage(key?: string, initialValue?: T) { } }; - return [localVal, setVal] as const; + return [localVal, setVal]; } +export const writeStorage = (key: string, value: T) => { + const UNIQ_PREFIX = 'npwd_phone_'; + + try { + window.localStorage.setItem(UNIQ_PREFIX + key, JSON.stringify(value)); + } catch (error) { + console.log(error); + } +}; + +export const getStorage = (key: string) => { + const UNIQ_PREFIX = 'npwd_phone_'; + try { + const data = window.localStorage.getItem(UNIQ_PREFIX + key); + return JSON.parse(data); + } catch (error) { + console.log(error); + } +}; + export default useLocalStorage; From 6458bce17f111506667ccbab3ace076777fda293 Mon Sep 17 00:00:00 2001 From: Christopher Date: Sat, 9 Jan 2021 18:45:18 +0100 Subject: [PATCH 6/9] tweak(settings): switced to useLocalStorage hook --- .../apps/settings/components/SettingsApp.tsx | 29 +++++++++---------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/phone/src/apps/settings/components/SettingsApp.tsx b/phone/src/apps/settings/components/SettingsApp.tsx index 3db5d88..0cd327b 100644 --- a/phone/src/apps/settings/components/SettingsApp.tsx +++ b/phone/src/apps/settings/components/SettingsApp.tsx @@ -40,31 +40,30 @@ export const SettingsApp = () => { const [config] = useConfig(); const simcard = useSimcard(); + const [wallpaper, setWallpaper] = useLocalStorage( + 'wallpaper', + 'surf.jpg' + ); + const [frame, setFrame] = useLocalStorage('frame', 's10.png'); + const [theme, setTheme] = useLocalStorage('theme', 'default-dark'); + const [zoom, setZoom] = useLocalStorage('zoom', '100%'); + const [ringtone, setRingtone] = useLocalStorage('ringtone', ''); + const wallpapers = config.wallpapers.map( - MapStringOptions(getStorage('wallpaper'), (val: string) => - writeStorage('wallpaper', val) - ) + MapStringOptions(wallpaper, (val: string) => setWallpaper(val)) ); const frames = config.frames.map( - MapStringOptions(getStorage('frame'), (val: string) => - writeStorage('frame', val) - ) + MapStringOptions(frame, (val: string) => setFrame(val)) ); const themes = Object.keys(config.themes).map( - MapStringOptions(getStorage('theme'), (val: string) => - writeStorage('theme', val) - ) + MapStringOptions(theme, (val: string) => setTheme(val)) ); const zoomOptions = config.zoomOptions.map( - MapStringOptions(getStorage('zoom'), (val: string) => - writeStorage('zoom', val) - ) + MapStringOptions(zoom, (val: string) => setZoom(val)) ); // Doesn't actually do anything for the time being const ringtones = config.ringtones.map( - MapStringOptions(getStorage('ringtone'), (val: string) => - writeStorage('ringtone', val) - ) + MapStringOptions(ringtone, (val: string) => setRingtone(val)) ); // * Probably gonna make this a slider component in the future // const ringtoneVols = config.ringtoneVols.map( From 5af6e4936def7713f83d34f770f5c1718c6fd8f5 Mon Sep 17 00:00:00 2001 From: Christopher Date: Sat, 9 Jan 2021 20:09:30 +0100 Subject: [PATCH 7/9] feat(settings): utilze useLocalStorage --- .../apps/settings/components/SettingsApp.tsx | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/phone/src/apps/settings/components/SettingsApp.tsx b/phone/src/apps/settings/components/SettingsApp.tsx index 0cd327b..1604349 100644 --- a/phone/src/apps/settings/components/SettingsApp.tsx +++ b/phone/src/apps/settings/components/SettingsApp.tsx @@ -24,10 +24,7 @@ import { } from '@material-ui/icons'; import { ListSubheader } from '@material-ui/core'; -import useLocalStorage, { - writeStorage, - getStorage, -} from '../../../os/phone/hooks/useLocalStorage'; +import useLocalStorage from '../../../os/phone/hooks/useLocalStorage'; const SubHeaderComp = (props: { text: string }) => ( @@ -72,7 +69,7 @@ export const SettingsApp = () => { // TODO: These new settings all work - useEffect(() => {}, [getStorage]); + useEffect(() => {}, [theme]); const [openMenu, closeMenu, ContextMenu, isMenuOpen] = useContextMenu(); return ( @@ -87,7 +84,7 @@ export const SettingsApp = () => { /> } @@ -107,28 +104,28 @@ export const SettingsApp = () => { }> } /> } /> } /> } From 8912650f0e7592f903ae141100035415ef2ec1be Mon Sep 17 00:00:00 2001 From: Taso Date: Tue, 12 Jan 2021 11:28:20 -0500 Subject: [PATCH 8/9] refactor: LocalStorage state integration --- phone/package.json | 2 +- phone/src/Phone.tsx | 23 ++++--- .../apps/settings/components/SettingsApp.tsx | 48 +++++++------ phone/src/apps/settings/default.json | 8 --- phone/src/apps/settings/hooks/useSettings.ts | 37 ++++++---- phone/src/config/default.json | 8 +++ phone/src/config/hooks/useConfig.ts | 1 - phone/src/os/phone/hooks/useLocalStorage.ts | 69 ------------------- phone/src/ui/components/Notification.tsx | 53 +++++++------- phone/yarn.lock | 8 +-- 10 files changed, 103 insertions(+), 154 deletions(-) delete mode 100644 phone/src/apps/settings/default.json delete mode 100644 phone/src/os/phone/hooks/useLocalStorage.ts diff --git a/phone/package.json b/phone/package.json index 7ecf6e3..a271fbf 100644 --- a/phone/package.json +++ b/phone/package.json @@ -31,7 +31,7 @@ "react-popper": "^2.2.3", "react-router-dom": "^5.2.0", "react-scripts": "3.4.3", - "recoil": "^0.0.10", + "recoil": "^0.1.2", "styled-components": "^5.1.1" }, "devDependencies": { diff --git a/phone/src/Phone.tsx b/phone/src/Phone.tsx index 9627e86..18b7906 100644 --- a/phone/src/Phone.tsx +++ b/phone/src/Phone.tsx @@ -2,11 +2,10 @@ import React from 'react'; import './Phone.css'; import './i18n'; import { Route } from 'react-router-dom'; -import { useSettings } from './apps/settings/hooks/useSettings'; import MessageIcon from '@material-ui/icons/Email'; import { CallModal } from './modal/components/CallModal'; import { HomeApp } from './apps/home/components/Home'; -import { ThemeProvider } from '@material-ui/core'; +import { createMuiTheme, ThemeProvider } from '@material-ui/core'; import { useInitKeyboard } from './os/keyboard/hooks/useKeyboard'; import { NotificationIcon } from './os/notifications/components/NotificationIcon'; import { NotificationBar } from './os/notifications/components/NotificationBar'; @@ -25,7 +24,10 @@ import { useNotesService } from './apps/notes/hooks/useNotesService'; import { usePhotoService } from './apps/camera/hooks/usePhotoService'; import Nui from './os/nui-events/utils/Nui'; import { usePhone } from './os/phone/hooks/usePhone'; -import { getStorage } from './os/phone/hooks/useLocalStorage'; +import { settingsState } from './apps/settings/hooks/useSettings'; + +import config from './config/default.json'; +import { useRecoilState } from 'recoil'; // Inject mock data when in development env. if (process.env.NODE_ENV === 'development') { @@ -246,7 +248,6 @@ function Phone() { useNuiService(); usePhoneService(); const { visibility } = usePhone(); - const { settings, currentTheme } = useSettings(); const { allApps } = useApps(); useSimcardService(); useContactsService(); @@ -258,10 +259,14 @@ function Phone() { useNotesService(); usePhotoService(); + const [settings] = useRecoilState(settingsState); + if (visibility === false) { return null; } + const currentTheme = () => createMuiTheme(config.themes[settings.theme]); + const calling = false; document.onkeyup = function (data) { @@ -273,21 +278,19 @@ function Phone() { return (
-
+
+ />
<> diff --git a/phone/src/apps/settings/components/SettingsApp.tsx b/phone/src/apps/settings/components/SettingsApp.tsx index 1604349..acbe2d3 100644 --- a/phone/src/apps/settings/components/SettingsApp.tsx +++ b/phone/src/apps/settings/components/SettingsApp.tsx @@ -7,7 +7,6 @@ import { MapStringOptions, } from '../../../ui/hooks/useContextMenu'; import { useConfig } from '../../../config/hooks/useConfig'; -import { useSettings } from '../hooks/useSettings'; import { List } from '../../../ui/components/List'; import { useSimcard } from '../../../os/simcard/hooks/useSimcard'; import { useApp } from '../../../os/apps/hooks/useApps'; @@ -24,7 +23,8 @@ import { } from '@material-ui/icons'; import { ListSubheader } from '@material-ui/core'; -import useLocalStorage from '../../../os/phone/hooks/useLocalStorage'; +import { useRecoilState } from 'recoil'; +import { settingsState } from '../hooks/useSettings'; const SubHeaderComp = (props: { text: string }) => ( @@ -36,31 +36,37 @@ export const SettingsApp = () => { const settingsApp = useApp('SETTINGS'); const [config] = useConfig(); const simcard = useSimcard(); + const [settings, setSettings] = useRecoilState(settingsState); - const [wallpaper, setWallpaper] = useLocalStorage( - 'wallpaper', - 'surf.jpg' - ); - const [frame, setFrame] = useLocalStorage('frame', 's10.png'); - const [theme, setTheme] = useLocalStorage('theme', 'default-dark'); - const [zoom, setZoom] = useLocalStorage('zoom', '100%'); - const [ringtone, setRingtone] = useLocalStorage('ringtone', ''); + const handleSettingChange = (key: string | number, value: unknown) => { + setSettings({ ...settings, [key]: value }); + }; const wallpapers = config.wallpapers.map( - MapStringOptions(wallpaper, (val: string) => setWallpaper(val)) + MapStringOptions(settings.wallpaper, (val: string) => + handleSettingChange('wallpaper', val) + ) ); const frames = config.frames.map( - MapStringOptions(frame, (val: string) => setFrame(val)) + MapStringOptions(settings.frame, (val: string) => + handleSettingChange('frame', val) + ) ); const themes = Object.keys(config.themes).map( - MapStringOptions(theme, (val: string) => setTheme(val)) + MapStringOptions(settings.theme, (val: string) => + handleSettingChange('theme', val) + ) ); const zoomOptions = config.zoomOptions.map( - MapStringOptions(zoom, (val: string) => setZoom(val)) + MapStringOptions(settings.zoom, (val: string) => + handleSettingChange('zoom', val) + ) ); // Doesn't actually do anything for the time being const ringtones = config.ringtones.map( - MapStringOptions(ringtone, (val: string) => setRingtone(val)) + MapStringOptions(settings.ringtone, (val: string) => + handleSettingChange('ringtone', val) + ) ); // * Probably gonna make this a slider component in the future // const ringtoneVols = config.ringtoneVols.map( @@ -69,8 +75,6 @@ export const SettingsApp = () => { // TODO: These new settings all work - useEffect(() => {}, [theme]); - const [openMenu, closeMenu, ContextMenu, isMenuOpen] = useContextMenu(); return ( @@ -84,7 +88,7 @@ export const SettingsApp = () => { /> } @@ -104,28 +108,28 @@ export const SettingsApp = () => { }> } /> } /> } /> } diff --git a/phone/src/apps/settings/default.json b/phone/src/apps/settings/default.json deleted file mode 100644 index 70b0b4e..0000000 --- a/phone/src/apps/settings/default.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "wallpaper": "default.png", - "frame": "s10.png", - "theme": "taso-dark", - "zoom": "100%", - "ringtone": "pixel", - "ringtoneVol": 100 -} diff --git a/phone/src/apps/settings/hooks/useSettings.ts b/phone/src/apps/settings/hooks/useSettings.ts index dceedfe..4b2114f 100644 --- a/phone/src/apps/settings/hooks/useSettings.ts +++ b/phone/src/apps/settings/hooks/useSettings.ts @@ -1,19 +1,28 @@ -import Default from '../default.json'; -import { useConfig } from '../../../config/hooks/useConfig'; -import { atom } from 'recoil'; -import { createMuiTheme } from '@material-ui/core'; -import useLocalStorage, { - getStorage, -} from '../../../os/phone/hooks/useLocalStorage'; +import { atom, DefaultValue, useRecoilState } from 'recoil'; +import config from '../../../config/default.json'; -const settingsState = atom({ +const localStorageEffect = (key) => ({ setSelf, onSet }) => { + const savedVal = localStorage.getItem(key); + if (savedVal != null) { + setSelf(JSON.parse(savedVal)); + } + + onSet((newValue) => { + if (newValue instanceof DefaultValue) { + localStorage.removeItem(key); + } else { + localStorage.setItem(key, JSON.stringify(newValue)); + } + }); +}; + +export const settingsState = atom({ key: 'settings', - default: Default, + default: config.defaultSettings, + effects_UNSTABLE: [localStorageEffect('settings')], }); -export const useSettings = (): any => { - const theme = getStorage('theme'); - const [config] = useConfig(); - const currentTheme = () => createMuiTheme(config.themes[theme]); - return { currentTheme }; +export const useSettings = () => { + const [settings, setSettings] = useRecoilState(settingsState); + return [settings, setSettings]; }; diff --git a/phone/src/config/default.json b/phone/src/config/default.json index fe6fc4c..63270d4 100644 --- a/phone/src/config/default.json +++ b/phone/src/config/default.json @@ -10,6 +10,14 @@ "surf.jpg", "beach.jpg" ], + "defaultSettings": { + "wallpaper": "default.png", + "frame": "s10.png", + "theme": "taso-dark", + "zoom": "100%", + "ringtone": "pixel", + "ringtoneVol": 100 + }, "frames": ["default.png", "s10.png", "tw.png", "samsung.png"], "zoomOptions": ["120%", "100%", "80%", "60%", "40%"], "ringtones": ["marimba", "pixel"], diff --git a/phone/src/config/hooks/useConfig.ts b/phone/src/config/hooks/useConfig.ts index 59785dd..7789a0e 100644 --- a/phone/src/config/hooks/useConfig.ts +++ b/phone/src/config/hooks/useConfig.ts @@ -1,6 +1,5 @@ import Default from '../default.json'; import { atom, useRecoilState } from 'recoil'; -import useLocalStorage from '../../os/phone/hooks/useLocalStorage'; const configState = atom({ key: 'config', diff --git a/phone/src/os/phone/hooks/useLocalStorage.ts b/phone/src/os/phone/hooks/useLocalStorage.ts deleted file mode 100644 index 2467a98..0000000 --- a/phone/src/os/phone/hooks/useLocalStorage.ts +++ /dev/null @@ -1,69 +0,0 @@ -import { useState } from 'react'; - -// TODO: Integrate debug log to fetch when that branch is merged - -/** - * A LocalStorage hook designed to behave like the useState hook. - * @param {string} key - The unique identifier to be used as a key - * @param {string} intialValue - The initialValue to be used - * if there is no savedState - */ - -function useLocalStorage(key: string, initialValue: T) { - // Serves as a nice identifying prefix for the key - const UNIQ_PREFIX = 'npwd_phone_'; - const [localVal, setLocalVal] = useState(() => { - try { - const data = window.localStorage.getItem(UNIQ_PREFIX + key); - // return stored or initValue if none stored - return data ? JSON.parse(data) : initialValue; - } catch (e) { - // TODO: Integrate debug error state here - console.log(e); - // We still return initVal if error is thrown - return initialValue; - } - }); - - // Trying to rep useState setter pretty close just with localStorage - const setVal = (value: T | ((val: T) => T)) => { - try { - // Same API as useState meaning we can accept a function for value - const valForStore = value instanceof Function ? value(localVal) : value; - // Save that state so we repli useState - setLocalVal(valForStore); - // Set that localStorage yo - window.localStorage.setItem( - UNIQ_PREFIX + key, - JSON.stringify(valForStore) - ); - } catch (e) { - // TODO: Also integrate debug log state error here - console.log(e); - } - }; - - return [localVal, setVal]; -} - -export const writeStorage = (key: string, value: T) => { - const UNIQ_PREFIX = 'npwd_phone_'; - - try { - window.localStorage.setItem(UNIQ_PREFIX + key, JSON.stringify(value)); - } catch (error) { - console.log(error); - } -}; - -export const getStorage = (key: string) => { - const UNIQ_PREFIX = 'npwd_phone_'; - try { - const data = window.localStorage.getItem(UNIQ_PREFIX + key); - return JSON.parse(data); - } catch (error) { - console.log(error); - } -}; - -export default useLocalStorage; diff --git a/phone/src/ui/components/Notification.tsx b/phone/src/ui/components/Notification.tsx index 03254f1..0a2ebfe 100644 --- a/phone/src/ui/components/Notification.tsx +++ b/phone/src/ui/components/Notification.tsx @@ -1,17 +1,17 @@ -import React from "react"; -import { ThemeProvider } from "@material-ui/core"; -import Paper from "@material-ui/core/Paper"; -import Snackbar from "@material-ui/core/Snackbar"; -import Fade from "@material-ui/core/Fade"; -import { makeStyles } from "@material-ui/core/styles"; -import { useSettings } from "../../apps/settings/hooks/useSettings"; -import { usePhone } from "../../os/phone/hooks/usePhone"; +import React from 'react'; +import { createMuiTheme, ThemeProvider } from '@material-ui/core'; +import Paper from '@material-ui/core/Paper'; +import Snackbar from '@material-ui/core/Snackbar'; +import Fade from '@material-ui/core/Fade'; +import { makeStyles } from '@material-ui/core/styles'; +import { useSettings } from '../../apps/settings/hooks/useSettings'; +import { usePhone } from '../../os/phone/hooks/usePhone'; const useStyles = makeStyles({ paper: { - width: "350px", - height: "100px", - opacity: "0.93", + width: '350px', + height: '100px', + opacity: '0.93', }, snackBar: { zIndex: -5, // we want this to appear behind other active NUI events...probably @@ -20,7 +20,7 @@ const useStyles = makeStyles({ function Notification({ children, handleClose, open }) { const classes = useStyles(); - const { currentTheme } = useSettings(); + const [settings] = useSettings(); const { config } = usePhone(); if (!config) return null; @@ -28,19 +28,22 @@ function Notification({ children, handleClose, open }) { const { horizontal, vertical } = config.notificationPosition; return ( - - setTimeout(() => { handleClose() }, 5000) }} - onClose={handleClose} - open={open} - TransitionComponent={Fade} - autoHideDuration={6000} - > - {children} - - + + setTimeout(() => { + handleClose(); + }, 5000), + }} + onClose={handleClose} + open={open} + TransitionComponent={Fade} + autoHideDuration={6000} + > + {children} + ); } diff --git a/phone/yarn.lock b/phone/yarn.lock index 438c9f6..d525f85 100644 --- a/phone/yarn.lock +++ b/phone/yarn.lock @@ -10124,10 +10124,10 @@ recast@~0.11.12: private "~0.1.5" source-map "~0.5.0" -recoil@^0.0.10: - version "0.0.10" - resolved "https://registry.yarnpkg.com/recoil/-/recoil-0.0.10.tgz#679ab22306f559f8a63c46fd5ff5241539f9248f" - integrity sha512-+9gRqehw3yKETmoZbhSnWu4GO10HDb5xYf1CjLF1oXGK2uT6GX5Lu9mfTXwjxV/jXxEKx8MIRUUbgPxvbJ8SEw== +recoil@^0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/recoil/-/recoil-0.1.2.tgz#844c612f535826dbe54c977761a67ded16f6d063" + integrity sha512-hIRrHlkmW4yITlBFprVYjVPhzPKYrJKoaDrrJtAtbkMeXfXaa/XE5OlyR10n+rNfnKWNToCKb3Z4fo86IGjkzg== recursive-readdir@2.2.2: version "2.2.2" From d65806ffa5f3143ad27bd0ba12d1ba21a0185e7f Mon Sep 17 00:00:00 2001 From: Taso Date: Tue, 12 Jan 2021 11:30:43 -0500 Subject: [PATCH 9/9] Misc: cleanup for rebase of master --- phone/src/ui/components/Notification.tsx | 1 - resources/.gitignore | 3 ++- yarn.lock | 8 -------- 3 files changed, 2 insertions(+), 10 deletions(-) delete mode 100644 yarn.lock diff --git a/phone/src/ui/components/Notification.tsx b/phone/src/ui/components/Notification.tsx index 0a2ebfe..e22689c 100644 --- a/phone/src/ui/components/Notification.tsx +++ b/phone/src/ui/components/Notification.tsx @@ -1,5 +1,4 @@ import React from 'react'; -import { createMuiTheme, ThemeProvider } from '@material-ui/core'; import Paper from '@material-ui/core/Paper'; import Snackbar from '@material-ui/core/Snackbar'; import Fade from '@material-ui/core/Fade'; diff --git a/resources/.gitignore b/resources/.gitignore index 11abf92..015b151 100644 --- a/resources/.gitignore +++ b/resources/.gitignore @@ -1,4 +1,5 @@ .vscode dist/ node_modules/ -yarn-error.log \ No newline at end of file +yarn-error.log +html \ No newline at end of file diff --git a/yarn.lock b/yarn.lock deleted file mode 100644 index 102d128..0000000 --- a/yarn.lock +++ /dev/null @@ -1,8 +0,0 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -# yarn lockfile v1 - - -typescript@3.9.7: - version "3.9.7" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.9.7.tgz#98d600a5ebdc38f40cb277522f12dc800e9e25fa" - integrity sha512-BLbiRkiBzAwsjut4x/dsibSTB6yWpwT5qWmC2OfuCg3GgVQCSgMs4vEctYPhsaGtd0AeuuHMkjZ2h2WG8MSzRw==