Skip to content

Commit

Permalink
revert: feat: Added call.outgoing_call event
Browse files Browse the repository at this point in the history
  • Loading branch information
icleitoncosta committed Jun 18, 2024
1 parent cda7e7a commit c2f470a
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 96 deletions.
38 changes: 0 additions & 38 deletions src/call/events/eventTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,42 +55,4 @@ export interface CallEventTypes {
*/
peerJid: Wid;
};
/**
* Triggered when you a outgoing call
*
* @example
* ```javascript
* WPP.on('call.outgoing_call', (call) => {
* // Your code
* //Example: End any outgoing call
* WPP.call.endCall(call.id);
* });
* ```
*/
'call.outgoing_call': {
/**
* The call id
*/
id: string;
/**
* Is a call from a group
*/
isGroup: boolean;
/**
* Is call with video
*/
isVideo: boolean;
/**
* timestamp of offer
*/
offerTime: number;
/**
* Wid of sender without device id
*/
sender: Wid;
/**
* Wid of sender with device id
*/
peerJid: Wid;
};
}
1 change: 0 additions & 1 deletion src/call/events/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,3 @@
*/

import './registerIncomingCallEvent';
import './registerOutgoingCallEvent';
50 changes: 0 additions & 50 deletions src/call/events/registerOutgoingCallEvent.ts

This file was deleted.

14 changes: 7 additions & 7 deletions src/call/functions/end.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@ import { CallModel, CallStore, websocket } from '../../whatsapp';
import { CALL_STATES } from '../../whatsapp/enums';

/**
* End a outgoing call
* End a call
*
* @example
* ```javascript
* // End any outgoing call
* // End any call
* WPP.call.end();
*
* // End specific call id
* WPP.call.end(callId);
*
* // End any outgoing call
* WPP.on('call.outgoing_call', (call) => {
* // End any incoming call
* WPP.on('call.incoming_call', (call) => {
* WPP.call.end(call.id);
* });
* ```
Expand All @@ -50,7 +50,7 @@ export async function end(callId?: string): Promise<boolean> {
if (callId) {
call = CallStore.get(callId);
} else {
// First outgoing ring or call group
// First outcoming ring or call group
call = CallStore.findFirst(
(c) => callOut.includes(c.getState()) || c.isGroup
);
Expand All @@ -68,8 +68,8 @@ export async function end(callId?: string): Promise<boolean> {

if (!callOut.includes(call.getState()) && !call.isGroup) {
throw new WPPError(
'call_is_not_outgoing_calling',
`Call ${callId || '<empty>'} is not outgoing calling`,
'call_is_not_outcoming_calling',
`Call ${callId || '<empty>'} is not incoming calling`,
{
callId,
state: call.getState(),
Expand Down

0 comments on commit c2f470a

Please sign in to comment.