enhance(phone/settings): Added labels to settings and misc cleanup

This change alters the default localStorage schema, please clear your localStorage cache for testing
This commit is contained in:
Taso authored and Taso committed 2021-03-04 11:33:25 -05:00
1 parent 5969d33dc3
commit 64c4e0ec16
11 files changed
+290 -210

No files matched your search

@@ -162,7 +162,7 @@ export function NotificationsProvider({ children }) {
update?: Partial<INotification>,
) => {
if (n.sound) {
const { sound, volume } = getSoundSettings('notification', settings, n.app);
const { sound, volume } = getSoundSettings('notiSound', settings, n.app);
mount(sound, volume, false).then(({ url }) =>
setAlerts((curr) => [...curr, [n, persist, update, url]]),
);
+2 -3
View File
@@ -1,10 +1,9 @@
import { useMemo } from 'react';
import { createMuiTheme } from '@material-ui/core';
import { useSettings } from '../../../apps/settings/hooks/useSettings';
import * as config from '../../../config/default.json';
import themes from '../../../config/themes.json';
export const usePhoneTheme = () => {
const [settings] = useSettings();
return useMemo(() => createMuiTheme(config.themes[settings.theme]), [settings.theme]);
return useMemo(() => createMuiTheme(themes[settings.theme.value]), [settings.theme]);
};
+4 -4
View File
@@ -3,25 +3,25 @@ import { getNotificationPath, getRingtonePath } from '../../../apps/settings/uti
const getPath = {
ringtone: getRingtonePath,
notification: getNotificationPath,
notiSound: getNotificationPath,
};
/**
* Gets the configuration for SoundProvider based on settings and apps
*/
export const getSoundSettings = (
type: 'ringtone' | 'notification',
type: 'ringtone' | 'notiSound',
settings: IPhoneSettings,
app?: string,
) => {
try {
return app
? {
sound: getPath[type](settings[`${app}_${type}`] || settings[type]),
sound: getPath[type](settings[`${app}_${type}`].value || settings[type].value),
volume: (settings[`${app}_${type}Vol`] || settings[`${type}Vol`]) / 100,
}
: {
sound: getPath[type](settings[type]),
sound: getPath[type](settings[type as string].value),
volume: settings[`${type}Vol`] / 100,
};
} catch (e) {