mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 14:38:45 +00:00
This reverts commit cb5a00e57e.
Reverted due a non-descript bug in CEF. Will be reapplied after fix.
32 lines
957 B
TypeScript
32 lines
957 B
TypeScript
import { IPhoneSettings } from '../../../apps/settings/hooks/useSettings';
|
|
import { getNotificationPath, getRingtonePath } from '../../../apps/settings/utils/getRingtonePath';
|
|
|
|
const getPath = {
|
|
ringtone: getRingtonePath,
|
|
notiSound: getNotificationPath,
|
|
};
|
|
|
|
/**
|
|
* Gets the configuration for SoundProvider based on settings and apps
|
|
*/
|
|
export const getSoundSettings = (
|
|
type: 'ringtone' | 'notiSound',
|
|
settings: IPhoneSettings,
|
|
app?: string,
|
|
) => {
|
|
try {
|
|
return app
|
|
? {
|
|
sound: getPath[type](settings[`${app}_${type}`].value || settings[type].value),
|
|
volume: (settings[`${app}_${type}Vol`] || settings[`${type}Vol`]) / 100,
|
|
}
|
|
: {
|
|
sound: getPath[type](settings[type as string].value),
|
|
volume: settings[`${type}Vol`] / 100,
|
|
};
|
|
} catch (e) {
|
|
console.error('getSoundSettings.ts error', e, 'Using default sounds');
|
|
return { sound: getPath[type](), volume: 1 };
|
|
}
|
|
};
|