Skip to content

Commit 884d6a0

Browse files
author
Kyle Kurz
authored
Merge pull request #33 from sangoma/updateDocsAndHandle
Update docs and change number to handle
2 parents e59f2e6 + 6bc295c commit 884d6a0

File tree

3 files changed

+32
-17
lines changed

3 files changed

+32
-17
lines changed

README.md

+24-12
Original file line numberDiff line numberDiff line change
@@ -145,17 +145,17 @@ different on iOS and Android:
145145

146146
iOS:
147147
```js
148-
RNCallKeep.startCall(uuid, number, contactIdentifier, handleType, hasVideo);
148+
RNCallKeep.startCall(uuid, handle, contactIdentifier, handleType, hasVideo);
149149
```
150150

151151
Android:
152152
```js
153-
RNCallKeep.startCall(uuid, number, contactIdentifier);
153+
RNCallKeep.startCall(uuid, handle, contactIdentifier);
154154
```
155155

156-
- _uuid_: string
156+
- `uuid`: string
157157
- An `uuid` that should be stored and re-used for `stopCall`.
158-
- `number`: string
158+
- `handle`: string
159159
- Phone number of the callee
160160
- `contactIdentifier`: string
161161
- The identifier is displayed in the native call UI, and is typically the name of the call recipient.
@@ -175,8 +175,10 @@ Sets the Android caller name and number
175175
Use this to update the Android display after an outgoing call has started
176176

177177
```js
178-
RNCallKeep.updateDisplay(localizedCallerName, handle)
178+
RNCallKeep.updateDisplay(uuid, localizedCallerName, handle)
179179
```
180+
- `uuid`: string
181+
- The `uuid` used for `startCall` or `displayIncomingCall`
180182
- `handle`: string
181183
- Phone number of the caller
182184
- `localizedCallerName`: string (optional)
@@ -313,13 +315,17 @@ or by the app calling `RNCallKeep.startCall`.
313315
Try to start your app call action from here (e.g. get credentials of the user by `data.handle` and/or send INVITE to your SIP server)
314316

315317
```js
316-
RNCallKeep.addEventListener('didReceiveStartCallAction', ({ number, callUUID, name }) => {
318+
RNCallKeep.addEventListener('didReceiveStartCallAction', ({ handle, callUUID, name }) => {
317319

318320
});
319321
```
320322

321323
- `handle` (string)
322-
- The number/name got from Recents in built-in Phone app
324+
- Phone number of the callee
325+
- `callUUID` (string)
326+
- The UUID of the call that is to be answered
327+
- `name` (string)
328+
- Name of the callee
323329

324330
### - answerCall
325331

@@ -332,7 +338,7 @@ RNCallKeep.addEventListener('answerCall', ({ callUUID }) => {
332338
```
333339

334340
- `callUUID` (string)
335-
- The UUID of the call that is to be answered (iOS only).
341+
- The UUID of the call that is to be answered.
336342

337343
### - endCall
338344

@@ -345,7 +351,7 @@ RNCallKeep.addEventListener('endCall', ({ callUUID }) => {
345351
```
346352

347353
- `callUUID` (string)
348-
- The UUID of the call that is to be answered (iOS only).
354+
- The UUID of the call that is to be ended.
349355

350356
### - didActivateAudioSession
351357

@@ -380,8 +386,12 @@ A call was muted by the system or the user:
380386
RNCallKeep.addEventListener('didPerformSetMutedCallAction', ({ muted, callUUID }) => {
381387

382388
});
383-
384389
```
390+
391+
- `muted` (boolean)
392+
- `callUUID` (string)
393+
- The UUID of the call.
394+
385395
### - didToggleHoldCallAction
386396

387397
A call was held or unheld by the current user
@@ -394,7 +404,7 @@ RNCallKeep.addEventListener('didToggleHoldCallAction', ({ hold, callUUID }) => {
394404

395405
- `hold` (boolean)
396406
- `callUUID` (string)
397-
- The UUID of the call that is to be answered (iOS only).
407+
- The UUID of the call.
398408

399409
### - didPerformDTMFAction
400410

@@ -407,7 +417,9 @@ RNCallKeep.addEventListener('didPerformDTMFAction', ({ digits, callUUID }) => {
407417
```
408418

409419
- `digits` (string)
420+
- The digits that emit the dtmf tone
410421
- `callUUID` (string)
422+
- The UUID of the call.
411423

412424
## Example
413425

@@ -477,7 +489,7 @@ class RNCallKeepExample extends React.Component {
477489
// Event Listener Callbacks
478490

479491
didReceiveStartCallAction(data) => {
480-
let { number, callUUID, name } = data;
492+
let { handle, callUUID, name } = data;
481493
// Get this event after the system decides you can start a call
482494
// You can now start a call from within your app
483495
};

docs/android-installation.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,11 @@ public class MainActivity extends ReactActivity {
4646
// Permission results
4747
@Override
4848
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
49-
if (grantResults.length > 0) {
50-
RNCallKeepModule.onRequestPermissionsResult(requestCode, permissions, grantResults);
49+
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
50+
switch (requestCode) {
51+
case RNCallKeepModule.REQUEST_READ_PHONE_STATE:
52+
RNCallKeepModule.onRequestPermissionsResult(requestCode, permissions, grantResults);
53+
break;
5154
}
5255
}
5356
}

ios/RNCallKeep/RNCallKeep.m

+3-3
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ - (void)dealloc
151151
}
152152

153153
RCT_EXPORT_METHOD(startCall:(NSString *)uuidString
154-
number:(NSString *)number
154+
handle:(NSString *)handle
155155
contactIdentifier:(NSString * _Nullable)contactIdentifier
156156
handleType:(NSString *)handleType
157157
video:(BOOL)video)
@@ -161,7 +161,7 @@ - (void)dealloc
161161
#endif
162162
int _handleType = [self getHandleType:handleType];
163163
NSUUID *uuid = [[NSUUID alloc] initWithUUIDString:uuidString];
164-
CXHandle *callHandle = [[CXHandle alloc] initWithType:_handleType value:number];
164+
CXHandle *callHandle = [[CXHandle alloc] initWithType:_handleType value:handle];
165165
CXStartCallAction *startCallAction = [[CXStartCallAction alloc] initWithCallUUID:uuid handle:callHandle];
166166
[startCallAction setVideo:video];
167167
[startCallAction setContactIdentifier:contactIdentifier];
@@ -495,7 +495,7 @@ - (void)provider:(CXProvider *)provider performStartCallAction:(CXStartCallActio
495495
//do this first, audio sessions are flakey
496496
[self configureAudioSession];
497497
//tell the JS to actually make the call
498-
[self sendEventWithName:RNCallKeepDidReceiveStartCallAction body:@{ @"callUUID": [action.callUUID.UUIDString lowercaseString], @"number": action.handle.value }];
498+
[self sendEventWithName:RNCallKeepDidReceiveStartCallAction body:@{ @"callUUID": [action.callUUID.UUIDString lowercaseString], @"handle": action.handle.value }];
499499
[action fulfill];
500500
}
501501

0 commit comments

Comments
 (0)