diff --git a/phone/src/apps/dialer/hooks/useDialService.ts b/phone/src/apps/dialer/hooks/useDialService.ts index 2e5beeb..4a3eb03 100644 --- a/phone/src/apps/dialer/hooks/useDialService.ts +++ b/phone/src/apps/dialer/hooks/useDialService.ts @@ -18,5 +18,5 @@ export const useDialService = () => { const setHistory = useSetRecoilState(dialState.history); useNuiEvent('DIALER', CallEvents.SET_CALL_HISTORY, setHistory); - useNuiEvent('DAILER', CallEvents.SEND_ALERT, handleAddAlert); + useNuiEvent('DIALER', CallEvents.SEND_ALERT, handleAddAlert); }; diff --git a/phone/src/locale/en.json b/phone/src/locale/en.json index 01ca1e5..a59abbf 100644 --- a/phone/src/locale/en.json +++ b/phone/src/locale/en.json @@ -71,6 +71,7 @@ "APPS_DIALER_ACCEPT_CALL": "Accept", "APPS_DIALER_REJECT_CALL": "Reject", "APPS_DIALER_END_CALL": "End", + "APPS_DIALER_INVALID_NUMBER": "Invalid number", "APPS_DIALER_INPUT_PLACEHOLDER": "Enter a number", "APPS_DIALER_NO_HISTORY": "You have no call history", "APPS_DIALER_NAVBAR_HISTORY": "History", diff --git a/resources/client/cl_call.ts b/resources/client/cl_call.ts index 9445707..cd5df4c 100644 --- a/resources/client/cl_call.ts +++ b/resources/client/cl_call.ts @@ -1,6 +1,7 @@ import { CallEvents } from '../../typings/call'; import { CallHistoryItem } from '../../typings/call'; import { phoneCallStartAnim, phoneCallEndAnim } from './functions'; +import { IAlertProps } from '../../typings/alerts'; const exp = (global as any).exports; @@ -127,3 +128,14 @@ onNet(CallEvents.FETCH_CALLS, (calls: CallHistoryItem[]) => { }), ); }); + +onNet(CallEvents.SEND_ALERT, (alert: IAlertProps) => { + console.log(alert); + SendNuiMessage( + JSON.stringify({ + app: 'DIALER', + method: CallEvents.SEND_ALERT, + data: alert, + }), + ); +}); diff --git a/resources/server/calls/calls.service.ts b/resources/server/calls/calls.service.ts index 957f9a4..e307efd 100644 --- a/resources/server/calls/calls.service.ts +++ b/resources/server/calls/calls.service.ts @@ -4,6 +4,7 @@ import CallsDB, { CallsRepo } from './calls.db'; import { v4 as uuidv4 } from 'uuid'; import PlayerService from '../players/player.service'; import { callLogger } from './calls.utils'; +import { NotesEvents } from '../../../typings/notes'; class CallsService { private callMap: Collection; @@ -40,6 +41,14 @@ class CallsService { receivingNumber, true, ); + + if (!receiverIdentifier) { + emitNet(CallEvents.SEND_ALERT, src, { + message: 'DIALER_INVALID_NUMBER', + type: 'error', + }); + } + // Will be null if the player is offline const receivingPlayer = PlayerService.getPlayerFromIdentifier(receiverIdentifier); @@ -60,7 +69,7 @@ class CallsService { // TODO: handle offline player // FIXME: Add actual localization for this. - emitNet(CallEvents.ACTION_RESULT, src, { + emitNet(CallEvents.SEND_ALERT, src, { message: 'Could not reach player', type: 'error', });