fix(calls): fix some bugs encountered during refactor

This commit is contained in:
Taso committed 2021-07-28 14:26:01 -04:00
1 parent 10c5e97088
commit af6e291368
9 files changed
+15 -15

No files matched your search

@@ -1,6 +1,7 @@
import {
CallEvents,
CallWasAcceptedEvent,
EndCallDTO,
InitializeCallDTO,
StartCallEventData,
TransmitterNumDTO,
@@ -57,7 +58,7 @@ onNetTyped<CallWasAcceptedEvent>(
// Rejected call
RegisterNuiCB<TransmitterNumDTO>(CallEvents.REJECTED, (data, cb: NuiCallbackFunc) => {
emitNet(CallEvents.REJECTED, data.transmitterNumber);
emitNetTyped<TransmitterNumDTO>(CallEvents.REJECTED, data);
cb({});
});
@@ -66,7 +67,7 @@ onNet(CallEvents.WAS_REJECTED, async () => {
animationService.endPhoneCall();
});
RegisterNuiCB<TransmitterNumDTO>(CallEvents.END_CALL, async (data, cb) => {
RegisterNuiCB<EndCallDTO>(CallEvents.END_CALL, async (data, cb) => {
try {
const serverRes: ServerPromiseResp<void> = await ClUtils.emitNetPromise(
CallEvents.END_CALL,
@@ -1,5 +1,6 @@
import { IAlertProps } from '../../../typings/alerts';
import { CallEvents, CallHistoryItem, CallRejectReasons } from '../../../typings/call';
import { animationService } from '../animations/animation.controller';
const exp = (global as any).exports;
@@ -45,6 +46,7 @@ export class CallService {
return emitNet(CallEvents.REJECTED, transmitter, CallRejectReasons.BUSY_LINE);
this.openCallModal(true);
animationService.startPhoneCall();
SendNUIMessage({
app: 'CALL',
+2 -2
View File
@@ -18,7 +18,7 @@ onNetPromise<InitializeCallDTO, StartCallEventData>(CallEvents.INITIALIZE_CALL,
});
});
onNetTyped(CallEvents.ACCEPT_CALL, (transmitterNumber: string) => {
onNetTyped<TransmitterNumDTO>(CallEvents.ACCEPT_CALL, ({ transmitterNumber }) => {
const src = getSource();
CallService.handleAcceptCall(src, transmitterNumber).catch((e) =>
callLogger.error(
@@ -41,7 +41,7 @@ onNetTyped<TransmitterNumDTO>(CallEvents.REJECTED, (data) => {
onNetPromise<EndCallDTO, void>(CallEvents.END_CALL, (reqObj, resp) => {
CallService.handleEndCall(reqObj, resp).catch((e) => {
callLogger.error(
`Error occured in end call event (${reqObj.data.transmitter}), Error: ${e.message}`,
`Error occured in end call event (${reqObj.data.transmitterNumber}), Error: ${e.message}`,
);
resp({ status: 'error', errorMsg: 'SERVER_ERROR' });
});
+1 -1
View File
@@ -196,7 +196,7 @@ class CallsService {
}
async handleEndCall(reqObj: PromiseRequest<EndCallDTO>, resp: PromiseEventResp<void>) {
const transmitterNumber = reqObj.data.transmitter;
const transmitterNumber = reqObj.data.transmitterNumber;
const endCallTimeUnix = Math.floor(new Date().getTime() / 1000);
const currentCall = this.callMap.get(transmitterNumber);