mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 14:38:45 +00:00
Fix: Workaround for ESX errors pertaining to player loading (#153)
* Set phone ready before sending any init events + Show initializing phone message if not ready yet * Send phone ready to nui
This commit is contained in:
1 parent
6e72e2c50e
commit
1a09fa57ae
7 files changed
+76
-31
No files matched your search
@@ -9,8 +9,8 @@ export const phoneState = {
|
||||
key: 'phoneConfig',
|
||||
default: undefined,
|
||||
}),
|
||||
forceUpdateState: atom({
|
||||
key: 'fuckingupdate',
|
||||
default: 0,
|
||||
phoneReady: atom({
|
||||
key: 'phoneReady',
|
||||
default: false,
|
||||
}),
|
||||
};
|
||||
@@ -10,10 +10,12 @@ interface IUsePhone {
|
||||
openPhone(): void;
|
||||
closePhone(): void;
|
||||
isPhoneOpen: boolean;
|
||||
isPhoneReady: boolean;
|
||||
}
|
||||
|
||||
export const usePhone = (): IUsePhone => {
|
||||
const isPhoneOpen = useRecoilValue(phoneState.visibility);
|
||||
const isPhoneReady = useRecoilValue(phoneState.phoneReady);
|
||||
|
||||
const { removeAlerts } = useNotifications();
|
||||
|
||||
@@ -25,5 +27,5 @@ export const usePhone = (): IUsePhone => {
|
||||
Nui.send('phone:open');
|
||||
};
|
||||
|
||||
return { config: ServerConfig as any, closePhone, openPhone, isPhoneOpen };
|
||||
return { config: ServerConfig as any, closePhone, openPhone, isPhoneOpen, isPhoneReady };
|
||||
};
|
||||
@@ -5,6 +5,8 @@ import { useNuiEvent } from '../../nui-events/hooks/useNuiEvent';
|
||||
export const usePhoneService = () => {
|
||||
const setVisibility = useSetRecoilState(phoneState.visibility);
|
||||
const setPhoneConfig = useSetRecoilState(phoneState.phoneConfig);
|
||||
const setPhoneReady = useSetRecoilState(phoneState.phoneReady);
|
||||
useNuiEvent('PHONE', 'setVisibility', setVisibility);
|
||||
useNuiEvent('PHONE', 'setPhoneReady', setPhoneReady);
|
||||
useNuiEvent('PHONE', 'phoneConfig', setPhoneConfig);
|
||||
};
|
||||
Reference in new issue
Block a user