Skip to content

Commit

Permalink
Fix registerPhoneAccount method
Browse files Browse the repository at this point in the history
  • Loading branch information
MrHertal committed Aug 16, 2021
1 parent 8eaf418 commit cdefbf3
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -808,7 +808,7 @@ _This feature is available only on Android._
_On iOS you still have to call `setup()`._

```js
RNCallKeep.registerPhoneAccount();
RNCallKeep.registerPhoneAccount(options);
```

### registerAndroidEvents
Expand Down
6 changes: 4 additions & 2 deletions android/src/main/java/io/wazo/callkeep/RNCallKeepModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public void setup(ReadableMap options) {
}

if (isConnectionServiceAvailable()) {
this.registerPhoneAccount();
this.registerPhoneAccount(options);
this.registerEvents();
VoiceConnectionService.setAvailable(true);
}
Expand All @@ -159,7 +159,9 @@ public void setup(ReadableMap options) {
}

@ReactMethod
public void registerPhoneAccount() {
public void registerPhoneAccount(ReadableMap options) {
this._settings = options;

if (!isConnectionServiceAvailable()) {
Log.w(TAG, "[VoiceConnection] registerPhoneAccount ignored due to no ConnectionService");
return;
Expand Down
2 changes: 1 addition & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ declare module 'react-native-callkeep' {

static answerIncomingCall(uuid: string): void

static registerPhoneAccount(): void
static registerPhoneAccount(options: IOptions): void

static registerAndroidEvents(): void

Expand Down
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ class RNCallKeep {
return this._setupIOS(options.ios);
};

registerPhoneAccount = () => {
registerPhoneAccount = (options) => {
if (isIOS) {
return;
}
RNCallKeepModule.registerPhoneAccount();
RNCallKeepModule.registerPhoneAccount(options.android);
};

registerAndroidEvents = () => {
Expand Down

0 comments on commit cdefbf3

Please sign in to comment.