Skip to content

Commit

Permalink
Merge pull request #472 from MrHertal/master
Browse files Browse the repository at this point in the history
Fix registerPhoneAccount method when manually registering Android phone
  • Loading branch information
manuquentin authored Oct 13, 2021
2 parents c2949ad + de8234b commit 0b891fd
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 @@ -662,7 +662,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 @@ -156,7 +156,7 @@ public void setup(ReadableMap options) {
}

if (isConnectionServiceAvailable()) {
this.registerPhoneAccount();
this.registerPhoneAccount(options);
this.registerEvents();
VoiceConnectionService.setAvailable(true);
}
Expand All @@ -165,7 +165,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 @@ -79,7 +79,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 0b891fd

Please sign in to comment.