Feature/floating notifications calling and twitter (#112)

* Add floating notifications :O

* Add phone notifications and refactor calling ui

* This is unsafe

* Fix controls null check

* Remove go to alert

* Fix phone stuck after call

* Remove lazy mount for Phone

* Fix open/close cl_main

* Use effect for notification visibility

* Remove all alerts when phone closes

* Avoid re-render useNuiEvent

* It works now :c
This commit is contained in:
J Francisco Rader authored and GitHub committed 2021-02-23 13:19:10 -05:00
1 parent 4633146d40
commit f6d7a3dbe1
42 files changed
+869 -679

No files matched your search

+36
View File
@@ -0,0 +1,36 @@
import { useRecoilState } from 'recoil';
import { CallProps } from '../../../common/typings/call';
import Nui from '../../nui-events/utils/Nui';
import { callerState } from './state';
interface CallHook {
call: CallProps;
setCall: (details: any) => void;
acceptCall(): void;
rejectCall(): void;
endCall(): void;
}
export const useCall = (): CallHook => {
const [call, setCall] = useRecoilState(callerState.currentCall);
const acceptCall = () => {
Nui.send('phone:acceptCall', {
transmitterNumber: call.transmitter,
});
};
const rejectCall = () => {
Nui.send('phone:rejectCall', {
phoneNumber: call.transmitter,
});
};
const endCall = () => {
Nui.send('phone:endCall', {
transmitterNumber: call.transmitter,
});
};
return { call, setCall, acceptCall, rejectCall, endCall };
};