fix(phone): only listen to UI Ready

This commit is contained in:
Christopher committed 2021-05-21 00:35:05 +02:00
1 parent 2411c39b95
commit fb32aaef15
6 files changed
+26 -47

No files matched your search

+16 -16
View File
@@ -81,28 +81,28 @@ function Phone() {
const { modal: callModal } = useCallModal();
const { isPhoneReady } = usePhone();
//const { isPhoneReady } = usePhone();
return (
<div>
<WindowSnackbar />
<PhoneWrapper>
{isPhoneReady ? (
{/*{isPhoneReady ? (
<>*/}
<NotificationBar />
<div className="PhoneAppContainer">
<>
<NotificationBar />
<div className="PhoneAppContainer">
<>
<Route exact path="/" component={HomeApp} />
{callModal && <Route exact path="/call" component={CallModal} />}
{apps.map((App) => (
<App.Route key={App.id} />
))}
</>
<NotificationAlert />
<PhoneSnackbar />
</div>
<Navigation />
<Route exact path="/" component={HomeApp} />
{callModal && <Route exact path="/call" component={CallModal} />}
{apps.map((App) => (
<App.Route key={App.id} />
))}
</>
<NotificationAlert />
<PhoneSnackbar />
</div>
<Navigation />
{/*</>
) : (
<Box
component={Paper}
@@ -118,7 +118,7 @@ function Phone() {
</Typography>
<Typography paragraph>{t('GENERIC_WAIT')}</Typography>
</Box>
)}
)}*/}
</PhoneWrapper>
</div>
);
+2 -2
View File
@@ -10,10 +10,10 @@ export const phoneState = {
key: 'resourceConfig',
default: null,
}),
phoneReady: atom<boolean>({
/*phoneReady: atom<boolean>({
key: 'phoneReady',
default: false,
}),
}),*/
phoneTime: atom<string>({
key: 'phoneTime',
default: null,
+3 -3
View File
@@ -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,
};
};
+2 -2
View File
@@ -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);