diff --git a/phone/src/Phone.tsx b/phone/src/Phone.tsx index a2f3ae6..9412cbc 100644 --- a/phone/src/Phone.tsx +++ b/phone/src/Phone.tsx @@ -81,28 +81,28 @@ function Phone() { const { modal: callModal } = useCallModal(); - const { isPhoneReady } = usePhone(); + //const { isPhoneReady } = usePhone(); return (
- {isPhoneReady ? ( + {/*{isPhoneReady ? ( + <>*/} + +
<> - -
- <> - - {callModal && } - {apps.map((App) => ( - - ))} - - - -
- + + {callModal && } + {apps.map((App) => ( + + ))} + + +
+ + {/* ) : ( {t('GENERIC_WAIT')} - )} + )}*/}
); diff --git a/phone/src/os/phone/hooks/state.ts b/phone/src/os/phone/hooks/state.ts index 0b42183..0094a8f 100644 --- a/phone/src/os/phone/hooks/state.ts +++ b/phone/src/os/phone/hooks/state.ts @@ -10,10 +10,10 @@ export const phoneState = { key: 'resourceConfig', default: null, }), - phoneReady: atom({ + /*phoneReady: atom({ key: 'phoneReady', default: false, - }), + }),*/ phoneTime: atom({ key: 'phoneTime', default: null, diff --git a/phone/src/os/phone/hooks/usePhone.ts b/phone/src/os/phone/hooks/usePhone.ts index 43fed84..d3a3ef8 100644 --- a/phone/src/os/phone/hooks/usePhone.ts +++ b/phone/src/os/phone/hooks/usePhone.ts @@ -10,13 +10,13 @@ interface IUsePhone { openPhone(): void; closePhone(): void; isPhoneOpen: boolean; - isPhoneReady: boolean; + //isPhoneReady: boolean; } export const usePhone = (): IUsePhone => { const Nui = useNuiRequest(); const isPhoneOpen = useRecoilValue(phoneState.visibility); - const isPhoneReady = useRecoilValue(phoneState.phoneReady); + //const isPhoneReady = useRecoilValue(phoneState.phoneReady); const config = useRecoilValue(phoneState.resourceConfig); const { removeAlerts } = useNotifications(); @@ -34,6 +34,6 @@ export const usePhone = (): IUsePhone => { closePhone, openPhone, isPhoneOpen, - isPhoneReady, + //isPhoneReady, }; }; diff --git a/phone/src/os/phone/hooks/usePhoneService.ts b/phone/src/os/phone/hooks/usePhoneService.ts index c40679b..153835c 100644 --- a/phone/src/os/phone/hooks/usePhoneService.ts +++ b/phone/src/os/phone/hooks/usePhoneService.ts @@ -14,9 +14,9 @@ export const usePhoneService = () => { const setVisibility = useSetRecoilState(phoneState.visibility); const setResourceConfig = useSetRecoilState(phoneState.resourceConfig); - const setPhoneReady = useSetRecoilState(phoneState.phoneReady); + //const setPhoneReady = useSetRecoilState(phoneState.phoneReady); const setPhoneTime = useSetRecoilState(phoneState.phoneTime); - useNuiEvent('PHONE', PhoneEvents.SET_PHONE_READY, setPhoneReady); + //useNuiEvent('PHONE', PhoneEvents.SET_PHONE_READY, setPhoneReady); useNuiEvent('PHONE', PhoneEvents.SET_VISIBILITY, setVisibility); useNuiEvent('PHONE', PhoneEvents.SET_CONFIG, setResourceConfig); useNuiEvent('PHONE', PhoneEvents.SET_TIME, setPhoneTime); diff --git a/resources/client/cl_main.ts b/resources/client/cl_main.ts index ed28071..2a709bf 100644 --- a/resources/client/cl_main.ts +++ b/resources/client/cl_main.ts @@ -12,8 +12,6 @@ import { CallEvents } from '../../typings/call'; import { config } from './client'; let isPhoneOpen = false; -let isPlayerReady = false; -let isUiReady = false; /* * * * * * * * * * * * * * @@ -24,7 +22,6 @@ function fetchOnInitialize() { emitNet(ContactEvents.GET_CONTACTS); emitNet(MessageEvents.FETCH_MESSAGE_GROUPS); emitNet(TwitterEvents.GET_OR_CREATE_PROFILE); - sendMessage('PHONE', PhoneEvents.SET_PHONE_READY, true); sendMessage('PHONE', PhoneEvents.SET_CONFIG, config); } @@ -113,14 +110,10 @@ async function Phone(): Promise { } } -// Set the global depending on the response from event -onNet(PhoneEvents.PLAYER_IS_READY, (ready: boolean) => { - isPlayerReady = ready; +onNet(PhoneEvents.SEND_CREDENTIALS, (number: string) => { + sendMessage('SIMCARD', PhoneEvents.SET_NUMBER, number); }); -onNet(PhoneEvents.SEND_CREDENTIALS, (number: string) => { - sendMessage('SIMCARD', PhoneEvents.SET_NUMBER, number) -}) AddEventHandler('onResourceStop', function (resource: string) { if (resource === GetCurrentResourceName()) { sendMessage('PHONE', PhoneEvents.SET_VISIBILITY, false); @@ -132,15 +125,8 @@ AddEventHandler('onResourceStop', function (resource: string) { RegisterNuiCallbackType(PhoneEvents.UI_IS_READY); on(`__cfx_nui:${PhoneEvents.UI_IS_READY}`, (_data: any, cb: Function) => { - isUiReady = true; - if (isPlayerReady) { - fetchOnInitialize(); - } - cb(); -}); - -onNet(PhoneEvents.ON_INIT, () => { fetchOnInitialize(); + cb(); }); // DO NOT CHANGE THIS EITHER, PLEASE - CHIP diff --git a/resources/server/players/player.service.ts b/resources/server/players/player.service.ts index ac91d0b..2bf182c 100644 --- a/resources/server/players/player.service.ts +++ b/resources/server/players/player.service.ts @@ -129,10 +129,6 @@ class _PlayerService { playerLogger.info('NPWD Player Loaded!'); playerLogger.debug(newPlayer); - - // Emit to client that player is ready - console.log('init baby', pSource); - emitNet(PhoneEvents.PLAYER_IS_READY, pSource, true); } /** @@ -182,9 +178,6 @@ class _PlayerService { playerLogger.info(`New NPWD Player added through event (${src}) (${identifier})`); playerLogger.debug(player); - - // Emit to client that player is ready - emitNet(PhoneEvents.PLAYER_IS_READY, src, true); } /**