Skip to content
This repository has been archived by the owner on May 26, 2019. It is now read-only.

Add updateIncomingCall() #60

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,20 @@ Initialise RNCallKit with options

Call when you receive incoming calls to display system UI

### updateIncomingCall

- **uuid**: string
- **handle**: string
- **handleType**: string (optional)
- generic
- number (default)
- email
- **hasVideo**: boolean (optional)
- false (default)
- **localizedCallerName**: string (optional)

Call when you have updated information about incoming calls to display

### startCall

- **uuid**: string
Expand Down
5 changes: 5 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ export default class RNCallKit {
_RNCallKit.displayIncomingCall(uuid, handle, handleType, hasVideo, localizedCallerName);
}

static updateIncomingCall(uuid, handle, handleType = 'number', hasVideo = false, localizedCallerName?: String) {
if (Platform.OS !== 'ios') return;
_RNCallKit.updateIncomingCall(uuid, handle, handleType, hasVideo, localizedCallerName);
}

static startCall(uuid, handle, handleType = 'number', hasVideo = false, contactIdentifier?: String) {
if (Platform.OS !== 'ios') return;
_RNCallKit.startCall(uuid, handle, handleType, hasVideo, contactIdentifier);
Expand Down
24 changes: 24 additions & 0 deletions ios/RNCallKit/RNCallKit.m
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,30 @@ - (void)dealloc
}];
}

// Update display information about the incoming call
RCT_EXPORT_METHOD(updateIncomingCall:(NSString *)uuidString
handle:(NSString *)handle
handleType:(NSString *)handleType
hasVideo:(BOOL)hasVideo
localizedCallerName:(NSString * _Nullable)localizedCallerName)
{
#ifdef DEBUG
NSLog(@"[RNCallKit][updateIncomingCall] uuidString = %@", uuidString);
#endif
int _handleType = [self getHandleType:handleType];
NSUUID *uuid = [[NSUUID alloc] initWithUUIDString:uuidString];
CXCallUpdate *callUpdate = [[CXCallUpdate alloc] init];
callUpdate.remoteHandle = [[CXHandle alloc] initWithType:_handleType value:handle];
callUpdate.supportsDTMF = YES;
// TODO: Holding
callUpdate.supportsHolding = NO;
callUpdate.supportsGrouping = NO;
callUpdate.supportsUngrouping = NO;
callUpdate.hasVideo = hasVideo;
callUpdate.localizedCallerName = localizedCallerName;
[self.callKitProvider reportCallWithUUID:uuid updated:callUpdate];
}

RCT_EXPORT_METHOD(startCall:(NSString *)uuidString
handle:(NSString *)handle
handleType:(NSString *)handleType
Expand Down