Add calling and notification sounds (#119)

* Add calling and notification sounds

* Fix notification visibility on any resolution

* Add comments

* Log howler error src

* Revert removed files im stupid

* Make sliders on settings use changeCommitted instead of onChange

* Fix ringtone paths

* Break alert words overflow

* Fix tweet overflow pepega

* Remove unused hook

* Update volume sliders in real time

* Fix resolution notifications

* Fix initial value for vol sliders

* Fix call duration timer bugs

* Add alert when phone active and phone closes

* keep notification

* Stop ringing when accept
This commit is contained in:
J Francisco Rader authored and GitHub committed 2021-03-01 17:22:58 -05:00
1 parent 8ecb91e71f
commit 4eda44b9c2
28 files changed
+589 -142

No files matched your search

@@ -0,0 +1,34 @@
import { IPhoneSettings } from '../../../apps/settings/hooks/useSettings';
import {
getNotificationPath,
getRingtonePath,
} from '../../../apps/settings/utils/getRingtonePath';
const getPath = {
ringtone: getRingtonePath,
notification: getNotificationPath,
};
/**
* Gets the configuration for SoundProvider based on settings and apps
*/
export const getSoundSettings = (
type: 'ringtone' | 'notification',
settings: IPhoneSettings,
app?: string
) => {
try {
return app
? {
sound: getPath[type](settings[`${app}_${type}`]),
volume: settings[`${app}_${type}Vol`] / 100,
}
: {
sound: getPath[type](settings[type]),
volume: settings[`${type}Vol`] / 100,
};
} catch (e) {
console.error('getSoundSettings.ts error', e, 'Using default sounds');
return { sound: getPath[type](), volume: 1 };
}
};