Skip to content

Commit

Permalink
misc: add logout api (#118)
Browse files Browse the repository at this point in the history
  • Loading branch information
embbnux authored Oct 30, 2024
1 parent e4dcf86 commit b531468
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
8 changes: 7 additions & 1 deletion docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@
Init a call with phone number

```js
RCAdapter.clickToDial(phoneNumber)
RCAdapter.clickToDial(phoneNumber);
```

### Logout

```js
RCAdapter.logout();
```

### Register a logger and contact matcher service
Expand Down
1 change: 1 addition & 0 deletions src/enums/messageTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ export default ObjectMap.prefixKeys([
'sipEndCall',
'loginPopup',
'checkPopupWindow',
'logout',
], 'rc-ev');
6 changes: 6 additions & 0 deletions src/lib/Adapter/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,12 @@ class Adapter extends AdapterCore {
});
}

logout() {
this._postMessage({
type: messageTypes.logout,
});
}

get transport() {
return this._messageTransport;
}
Expand Down
4 changes: 3 additions & 1 deletion src/modules/Adapter/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
action,
} from '@ringcentral-integration/core/lib/RcModule';
import messageTypes from '../../enums/messageTypes';
import PopupWindowManager from '../../lib/PopupWindowManager';

import { Interface, Deps } from './interface';

Expand All @@ -16,6 +15,7 @@ import { Interface, Deps } from './interface';
'Alert',
'EvDialerUI',
'EvCall',
'EvAuth',
'EvAgentSession',
'GlobalStorage',
'Presence',
Expand Down Expand Up @@ -111,6 +111,8 @@ class Adapter extends RcModuleV2<Deps> implements Interface {
case this.messageTypes.setEnvironment:
this.setEnvironment();
break;
case this.messageTypes.logout:
this._deps.evAuth.logout();
default:
break;
}
Expand Down

0 comments on commit b531468

Please sign in to comment.