Skip to content

Commit 06b0e9b

Browse files
committed
rename checkDefault to hasDefaultPhoneAccount and add to README
1 parent 05e69b1 commit 06b0e9b

File tree

2 files changed

+35
-16
lines changed

2 files changed

+35
-16
lines changed

README.md

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,13 @@ RNCallKeep.setup(options);
6969
Cancel button label
7070
- `okButton`: string (required)
7171
Ok button label
72-
72+
7373
## Methods
7474

7575
### setAvailable
7676
_This feature is available only on Android._
7777

78-
Tell _ConnectionService_ that the device is ready to accept outgoing calls.
78+
Tell _ConnectionService_ that the device is ready to accept outgoing calls.
7979
If not the user will be stuck in the build UI screen without any actions.
8080
Eg: Call it with `false` when disconnected from the sip client, when your token expires ...
8181

@@ -207,6 +207,25 @@ _This feature is available only on Android._
207207
await RNCallKeep.hasPhoneAccount();
208208
```
209209

210+
### hasDefaultPhoneAccount
211+
212+
Checks if the user has set a default [phone account](https://developer.android.com/reference/android/telecom/PhoneAccount).
213+
If the user has not set a default they will be prompted to do so with an alert.
214+
215+
This is a workaround for an [issue](https://github.com/wazo-pbx/react-native-callkeep/issues/33) affecting some Samsung devices.
216+
217+
_This feature is available only on Android._
218+
219+
```js
220+
const options = {
221+
alertTitle: 'Default not set',
222+
alertDescription: 'Please set the default phone account'
223+
};
224+
225+
RNCallKeep.hasDefaultPhoneAccount(options);
226+
```
227+
228+
210229
## Events
211230

212231
### didReceiveStartCallAction
@@ -219,7 +238,7 @@ After all works are done, remember to call `RNCallKeep.startCall(uuid, calleeNum
219238

220239
```js
221240
RNCallKeep.addEventListener('didReceiveStartCallAction', ({ handle }) => {
222-
241+
223242
});
224243
```
225244

@@ -283,7 +302,7 @@ A call was muted by the system or the user:
283302

284303
```js
285304
RNCallKeep.addEventListener('didPerformSetMutedCallAction', (muted) => {
286-
305+
287306
});
288307

289308
```
@@ -293,7 +312,7 @@ A call was held or unheld by the current user
293312

294313
```js
295314
RNCallKeep.addEventListener('didToggleHoldCallAction', ({ hold, callUUID }) => {
296-
315+
297316
});
298317
```
299318

@@ -307,7 +326,7 @@ Used type a number on his dialer
307326

308327
```js
309328
RNCallKeep.addEventListener('didPerformDTMFAction', ({ dtmf, callUUID }) => {
310-
329+
311330
});
312331
```
313332

@@ -327,9 +346,9 @@ import uuid from 'uuid';
327346
class RNCallKeepExample extends React.Component {
328347
constructor(props) {
329348
super(props);
330-
349+
331350
this.currentCallId = null;
332-
351+
333352
// Initialise RNCallKeep
334353
const options = {
335354
ios: {
@@ -342,7 +361,7 @@ class RNCallKeepExample extends React.Component {
342361
okButton: 'ok',
343362
}
344363
};
345-
364+
346365

347366
try {
348367
RNCallKeep.setup(options);
@@ -369,13 +388,13 @@ class RNCallKeepExample extends React.Component {
369388
onAnswerCallAction = ({ callUUID }) => {
370389
// called when the user answer the incoming call
371390
};
372-
391+
373392
onEndCallAction = ({ callUUID }) => {
374393
RNCallKeep.endCall(this.getCurrentCallId());
375-
394+
376395
this.currentCallId = null;
377396
};
378-
397+
379398
onIncomingCallDisplayed = error => {
380399
// You will get this event after RNCallKeep finishes showing incoming call UI
381400
// You can check if there was an error while displaying
@@ -389,7 +408,7 @@ class RNCallKeepExample extends React.Component {
389408
// you might want to do following things when receiving this event:
390409
// - Start playing ringback if it is an outgoing call
391410
};
392-
411+
393412
getCurrentCallId = () => {
394413
if (!this.currentCallId) {
395414
this.currentCallId = uuid.v4();

index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ class RNCallKeep {
3737
return this._setupIOS(options.ios);
3838
};
3939

40-
checkDefault = async (options) => {
40+
hasDefaultPhoneAccount = async (options) => {
4141
if (!isIOS) {
42-
return this._checkDefault(options);
42+
return this._hasDefaultPhoneAccount(options);
4343
}
4444

4545
return;
@@ -136,7 +136,7 @@ class RNCallKeep {
136136
}
137137
};
138138

139-
_checkDefault = async (options) => {
139+
_hasDefaultPhoneAccount = async (options) => {
140140
const hasDefault = await RNCallKeepModule.checkDefaultPhoneAccount();
141141
const shouldOpenAccounts = await this._alert(options, hasDefault);
142142

0 commit comments

Comments
 (0)