update dial events

This commit is contained in:
Christopher committed 2021-03-25 11:31:05 +01:00
1 parent 98efed4e64
commit 2cd3e9e93d
4 files changed
+14 -10

No files matched your search

@@ -1,8 +1,9 @@
import { useSetRecoilState } from 'recoil';
import { useNuiEvent } from '../../../os/nui-events/hooks/useNuiEvent';
import { dialState } from './state';
import { CallEvents } from '../../../../../typings/call';
export const useDialService = () => {
const setHistory = useSetRecoilState(dialState.history);
useNuiEvent('DIALER', 'setHistory', setHistory);
useNuiEvent('DIALER', CallEvents.SET_CALL_HISTORY, setHistory);
};
+3 -3
View File
@@ -2,7 +2,7 @@ import { useEffect, useState } from 'react';
import { useNuiEvent } from '../../nui-events/hooks/useNuiEvent';
import { useSetRecoilState } from 'recoil';
import { useCall } from './useCall';
import { CallProps } from '../../../../../typings/call';
import { CallEvents, CallProps } from '../../../../../typings/call';
import InjectDebugData from '../../debug/InjectDebugData';
import { useCallModal } from './useCallModal';
import { useHistory, useLocation } from 'react-router-dom';
@@ -61,6 +61,6 @@ export const useCallService = () => {
setCall(_call);
setNotification(_call);
};
useNuiEvent<CallProps>('CALL', 'setCaller', _setCall, call);
useNuiEvent<boolean>('CALL', 'callModal', setModal);
useNuiEvent<CallProps>('CALL', CallEvents.SET_CALLER, _setCall, call);
useNuiEvent<boolean>('CALL', CallEvents.SET_CALL_MODAL, setModal);
};
+6 -6
View File
@@ -16,7 +16,7 @@ onNet(CallEvents.START_CALL, (transmitter: string, receiver: string, isTransmitt
SendNuiMessage(
JSON.stringify({
app: 'CALL',
method: 'setCaller',
method: CallEvents.SET_CALLER,
data: {
active: true,
transmitter: transmitter,
@@ -40,7 +40,7 @@ onNet(CallEvents.WAS_ACCEPTED, (channelId: number, currentCall: ICall, isTransmi
SendNuiMessage(
JSON.stringify({
app: 'CALL',
method: 'setCaller',
method: CallEvents.SET_CALLER,
data: {
active: true,
transmitter: currentCall.transmitter,
@@ -63,7 +63,7 @@ onNet(CallEvents.WAS_REJECTED, () => {
SendNuiMessage(
JSON.stringify({
app: 'CALL',
method: 'setCaller',
method: CallEvents.SET_CALLER,
data: {
transmitter: null,
receiver: null,
@@ -93,7 +93,7 @@ onNet(CallEvents.WAS_ENDED, () => {
SendNuiMessage(
JSON.stringify({
app: 'CALL',
method: 'setCaller',
method: CallEvents.SET_CALLER,
data: {
transmitter: null,
receiver: null,
@@ -109,7 +109,7 @@ function openCallModal(show: boolean) {
SendNuiMessage(
JSON.stringify({
app: 'CALL',
method: 'callModal',
method: CallEvents.SET_CALL_MODAL,
data: show,
}),
);
@@ -119,7 +119,7 @@ onNet(CallEvents.SEND_HISTORY, (calls: ICall) => {
SendNuiMessage(
JSON.stringify({
app: 'DIALER',
method: 'setHistory',
method: CallEvents.SET_CALL_HISTORY,
data: calls,
}),
);
+3
View File
@@ -37,4 +37,7 @@ export enum CallEvents {
FETCH_CALLS = 'npwd:fetchCalls',
SEND_HISTORY = 'npwd:sendCallHistory',
SEND_HANGUP_ANIM = 'npwd:sendHangupAnim',
SET_CALLER = 'npwd:setCaller',
SET_CALL_MODAL = 'npwd:callModal',
SET_CALL_HISTORY = 'npwd:setCallHistory',
}