mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 22:16:40 +00:00
more formatting
This commit is contained in:
1 parent
046447b0fb
commit
f552c1212c
157 files changed
+635
-1579
No files matched your search
@@ -12,9 +12,7 @@ export const useRingtoneSound = () => {
|
||||
throw new Error('useRingtoneSound must be wrapped in SoundProvider');
|
||||
}
|
||||
|
||||
const options = useMemo(() => getSoundSettings('ringtone', settings), [
|
||||
settings,
|
||||
]);
|
||||
const options = useMemo(() => getSoundSettings('ringtone', settings), [settings]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!sound.isMounted(options.sound)) {
|
||||
|
||||
@@ -11,7 +11,7 @@ interface ISoundContext {
|
||||
url: string,
|
||||
volume?: number,
|
||||
loop?: boolean,
|
||||
autoplay?: boolean
|
||||
autoplay?: boolean,
|
||||
): Promise<IMountResponse>;
|
||||
play(url?: string, volume?: number, loop?: boolean): void;
|
||||
stop(url: string): void;
|
||||
@@ -36,7 +36,7 @@ export const SoundProvider = ({ children }: { children: React.ReactNode }) => {
|
||||
url: string,
|
||||
volume: number = 1,
|
||||
loop: boolean = false,
|
||||
autoplay: boolean = false
|
||||
autoplay: boolean = false,
|
||||
) => {
|
||||
return new Promise<IMountResponse>((res) => {
|
||||
if (!soundRefs.current) {
|
||||
@@ -78,7 +78,7 @@ export const SoundProvider = ({ children }: { children: React.ReactNode }) => {
|
||||
instance.once('playerror', onError);
|
||||
});
|
||||
},
|
||||
[]
|
||||
[],
|
||||
);
|
||||
|
||||
const play = useCallback(
|
||||
@@ -115,25 +115,19 @@ export const SoundProvider = ({ children }: { children: React.ReactNode }) => {
|
||||
}
|
||||
mount(url, volume, loop, true);
|
||||
},
|
||||
[mount]
|
||||
[mount],
|
||||
);
|
||||
|
||||
const volume = useCallback(
|
||||
(url: string, volume: number = undefined): number => {
|
||||
const sound = soundRefs.current.get(url);
|
||||
return sound?.howl.volume(volume) as number;
|
||||
},
|
||||
[]
|
||||
);
|
||||
const volume = useCallback((url: string, volume: number = undefined): number => {
|
||||
const sound = soundRefs.current.get(url);
|
||||
return sound?.howl.volume(volume) as number;
|
||||
}, []);
|
||||
|
||||
const loop = useCallback(
|
||||
(url: string, loop: boolean = undefined): boolean => {
|
||||
const sound = soundRefs.current.get(url);
|
||||
sound.howl.loop(loop);
|
||||
return sound.howl.loop();
|
||||
},
|
||||
[]
|
||||
);
|
||||
const loop = useCallback((url: string, loop: boolean = undefined): boolean => {
|
||||
const sound = soundRefs.current.get(url);
|
||||
sound.howl.loop(loop);
|
||||
return sound.howl.loop();
|
||||
}, []);
|
||||
|
||||
const stop = useCallback((url: string) => {
|
||||
if (!soundRefs.current) {
|
||||
|
||||
@@ -15,14 +15,13 @@ const getPath = {
|
||||
export const getSoundSettings = (
|
||||
type: 'ringtone' | 'notification',
|
||||
settings: IPhoneSettings,
|
||||
app?: string
|
||||
app?: string,
|
||||
) => {
|
||||
try {
|
||||
return app
|
||||
? {
|
||||
sound: getPath[type](settings[`${app}_${type}`] || settings[type]),
|
||||
volume:
|
||||
(settings[`${app}_${type}Vol`] || settings[`${type}Vol`]) / 100,
|
||||
volume: (settings[`${app}_${type}Vol`] || settings[`${type}Vol`]) / 100,
|
||||
}
|
||||
: {
|
||||
sound: getPath[type](settings[type]),
|
||||
|
||||
Reference in new issue
Block a user