mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-05 06:28:51 +00:00
update dial events
This commit is contained in:
1 parent
98efed4e64
commit
2cd3e9e93d
4 files changed
+14
-10
No files matched your search
@@ -1,8 +1,9 @@
|
|||||||
import { useSetRecoilState } from 'recoil';
|
import { useSetRecoilState } from 'recoil';
|
||||||
import { useNuiEvent } from '../../../os/nui-events/hooks/useNuiEvent';
|
import { useNuiEvent } from '../../../os/nui-events/hooks/useNuiEvent';
|
||||||
import { dialState } from './state';
|
import { dialState } from './state';
|
||||||
|
import { CallEvents } from '../../../../../typings/call';
|
||||||
|
|
||||||
export const useDialService = () => {
|
export const useDialService = () => {
|
||||||
const setHistory = useSetRecoilState(dialState.history);
|
const setHistory = useSetRecoilState(dialState.history);
|
||||||
useNuiEvent('DIALER', 'setHistory', setHistory);
|
useNuiEvent('DIALER', CallEvents.SET_CALL_HISTORY, setHistory);
|
||||||
};
|
};
|
||||||
@@ -2,7 +2,7 @@ import { useEffect, useState } from 'react';
|
|||||||
import { useNuiEvent } from '../../nui-events/hooks/useNuiEvent';
|
import { useNuiEvent } from '../../nui-events/hooks/useNuiEvent';
|
||||||
import { useSetRecoilState } from 'recoil';
|
import { useSetRecoilState } from 'recoil';
|
||||||
import { useCall } from './useCall';
|
import { useCall } from './useCall';
|
||||||
import { CallProps } from '../../../../../typings/call';
|
import { CallEvents, CallProps } from '../../../../../typings/call';
|
||||||
import InjectDebugData from '../../debug/InjectDebugData';
|
import InjectDebugData from '../../debug/InjectDebugData';
|
||||||
import { useCallModal } from './useCallModal';
|
import { useCallModal } from './useCallModal';
|
||||||
import { useHistory, useLocation } from 'react-router-dom';
|
import { useHistory, useLocation } from 'react-router-dom';
|
||||||
@@ -61,6 +61,6 @@ export const useCallService = () => {
|
|||||||
setCall(_call);
|
setCall(_call);
|
||||||
setNotification(_call);
|
setNotification(_call);
|
||||||
};
|
};
|
||||||
useNuiEvent<CallProps>('CALL', 'setCaller', _setCall, call);
|
useNuiEvent<CallProps>('CALL', CallEvents.SET_CALLER, _setCall, call);
|
||||||
useNuiEvent<boolean>('CALL', 'callModal', setModal);
|
useNuiEvent<boolean>('CALL', CallEvents.SET_CALL_MODAL, setModal);
|
||||||
};
|
};
|
||||||
@@ -16,7 +16,7 @@ onNet(CallEvents.START_CALL, (transmitter: string, receiver: string, isTransmitt
|
|||||||
SendNuiMessage(
|
SendNuiMessage(
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
app: 'CALL',
|
app: 'CALL',
|
||||||
method: 'setCaller',
|
method: CallEvents.SET_CALLER,
|
||||||
data: {
|
data: {
|
||||||
active: true,
|
active: true,
|
||||||
transmitter: transmitter,
|
transmitter: transmitter,
|
||||||
@@ -40,7 +40,7 @@ onNet(CallEvents.WAS_ACCEPTED, (channelId: number, currentCall: ICall, isTransmi
|
|||||||
SendNuiMessage(
|
SendNuiMessage(
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
app: 'CALL',
|
app: 'CALL',
|
||||||
method: 'setCaller',
|
method: CallEvents.SET_CALLER,
|
||||||
data: {
|
data: {
|
||||||
active: true,
|
active: true,
|
||||||
transmitter: currentCall.transmitter,
|
transmitter: currentCall.transmitter,
|
||||||
@@ -63,7 +63,7 @@ onNet(CallEvents.WAS_REJECTED, () => {
|
|||||||
SendNuiMessage(
|
SendNuiMessage(
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
app: 'CALL',
|
app: 'CALL',
|
||||||
method: 'setCaller',
|
method: CallEvents.SET_CALLER,
|
||||||
data: {
|
data: {
|
||||||
transmitter: null,
|
transmitter: null,
|
||||||
receiver: null,
|
receiver: null,
|
||||||
@@ -93,7 +93,7 @@ onNet(CallEvents.WAS_ENDED, () => {
|
|||||||
SendNuiMessage(
|
SendNuiMessage(
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
app: 'CALL',
|
app: 'CALL',
|
||||||
method: 'setCaller',
|
method: CallEvents.SET_CALLER,
|
||||||
data: {
|
data: {
|
||||||
transmitter: null,
|
transmitter: null,
|
||||||
receiver: null,
|
receiver: null,
|
||||||
@@ -109,7 +109,7 @@ function openCallModal(show: boolean) {
|
|||||||
SendNuiMessage(
|
SendNuiMessage(
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
app: 'CALL',
|
app: 'CALL',
|
||||||
method: 'callModal',
|
method: CallEvents.SET_CALL_MODAL,
|
||||||
data: show,
|
data: show,
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
@@ -119,7 +119,7 @@ onNet(CallEvents.SEND_HISTORY, (calls: ICall) => {
|
|||||||
SendNuiMessage(
|
SendNuiMessage(
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
app: 'DIALER',
|
app: 'DIALER',
|
||||||
method: 'setHistory',
|
method: CallEvents.SET_CALL_HISTORY,
|
||||||
data: calls,
|
data: calls,
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -37,4 +37,7 @@ export enum CallEvents {
|
|||||||
FETCH_CALLS = 'npwd:fetchCalls',
|
FETCH_CALLS = 'npwd:fetchCalls',
|
||||||
SEND_HISTORY = 'npwd:sendCallHistory',
|
SEND_HISTORY = 'npwd:sendCallHistory',
|
||||||
SEND_HANGUP_ANIM = 'npwd:sendHangupAnim',
|
SEND_HANGUP_ANIM = 'npwd:sendHangupAnim',
|
||||||
|
SET_CALLER = 'npwd:setCaller',
|
||||||
|
SET_CALL_MODAL = 'npwd:callModal',
|
||||||
|
SET_CALL_HISTORY = 'npwd:setCallHistory',
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user