Skip to content

Commit 352660e

Browse files
committed
add new methods and fix contact and video call bugs
1 parent 5cae457 commit 352660e

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

index.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,12 @@ class RNCallKeep {
116116
RNCallKeepModule.setCurrentCallActive();
117117
};
118118

119+
reportUpdatedCall(uuid, localizedCallerName?: String) {
120+
return Platform.OS === 'ios'
121+
? _RNCallKit.reportUpdatedCall(uuid, localizedCallerName)
122+
: Promise.reject('RNCallKeep.reportUpdatedCall was called from unsupported OS');
123+
}
124+
119125
_setupIOS = async (options) => new Promise((resolve, reject) => {
120126
if (!options.appName) {
121127
reject('RNCallKeep.setup: option "appName" is required');

ios/RNCallKeep/RNCallKeep.m

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,11 +247,12 @@ - (void)requestTransaction:(CXTransaction *)transaction
247247
CXStartCallAction *startCallAction = [transaction.actions firstObject];
248248
CXCallUpdate *callUpdate = [[CXCallUpdate alloc] init];
249249
callUpdate.remoteHandle = startCallAction.handle;
250+
callUpdate.hasVideo = startCallAction.video;
251+
callUpdate.localizedCallerName = startCallAction.contactIdentifier;
250252
callUpdate.supportsDTMF = YES;
251253
callUpdate.supportsHolding = YES;
252254
callUpdate.supportsGrouping = YES;
253255
callUpdate.supportsUngrouping = YES;
254-
callUpdate.hasVideo = NO;
255256
[self.callKeepProvider reportCallWithUUID:startCallAction.callUUID updated:callUpdate];
256257
}
257258
}
@@ -433,6 +434,19 @@ - (void)provider:(CXProvider *)provider performStartCallAction:(CXStartCallActio
433434
[action fulfill];
434435
}
435436

437+
// Update call contact info
438+
RCT_EXPORT_METHOD(reportUpdatedCall:(NSString *)uuidString contactIdentifier:(NSString *)contactIdentifier)
439+
{
440+
#ifdef DEBUG
441+
NSLog(@"[RNCallKeep][reportUpdatedCall] contactIdentifier = %i", contactIdentifier);
442+
#endif
443+
NSUUID *uuid = [[NSUUID alloc] initWithUUIDString:uuidString];
444+
CXCallUpdate *callUpdate = [[CXCallUpdate alloc] init];
445+
callUpdate.localizedCallerName = contactIdentifier;
446+
447+
[self.callKitProvider reportCallWithUUID:uuid updated:callUpdate];
448+
}
449+
436450
// Answering incoming call
437451
- (void)provider:(CXProvider *)provider performAnswerCallAction:(CXAnswerCallAction *)action
438452
{

0 commit comments

Comments
 (0)