Skip to content

Commit 07afe95

Browse files
committed
ios: implemet support options for updateDisplay
1 parent ae3830d commit 07afe95

File tree

3 files changed

+30
-2
lines changed

3 files changed

+30
-2
lines changed

index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ declare module 'react-native-callkeep' {
7676
uuid: string,
7777
displayName: string,
7878
handle: string,
79+
options?: object,
7980
): void
8081

8182
static checkPhoneAccountEnabled(): Promise<boolean>;

index.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,17 @@ class RNCallKeep {
212212
RNCallKeepModule.setCurrentCallActive(callUUID);
213213
};
214214

215-
updateDisplay = (uuid, displayName, handle) => RNCallKeepModule.updateDisplay(uuid, displayName, handle);
215+
updateDisplay = (uuid, displayName, handle, options = null) => {
216+
if (!isIOS) {
217+
RNCallKeepModule.updateDisplay(uuid, displayName, handle);
218+
return;
219+
}
220+
221+
if (!options) {
222+
options = {};
223+
}
224+
RNCallKeepModule.updateDisplay(uuid, displayName, handle, options);
225+
};
216226

217227
setOnHold = (uuid, shouldHold) => RNCallKeepModule.setOnHold(uuid, shouldHold);
218228

ios/RNCallKeep/RNCallKeep.m

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ + (void)initCallKitProvider {
279279
[RNCallKeep endCallWithUUID: uuidString reason:reason];
280280
}
281281

282-
RCT_EXPORT_METHOD(updateDisplay:(NSString *)uuidString :(NSString *)displayName :(NSString *)uri)
282+
RCT_EXPORT_METHOD(updateDisplay:(NSString *)uuidString :(NSString *)displayName :(NSString *)uri :(NSDictionary *)options)
283283
{
284284
#ifdef DEBUG
285285
NSLog(@"[RNCallKeep][updateDisplay] uuidString = %@ displayName = %@ uri = %@", uuidString, displayName, uri);
@@ -289,6 +289,23 @@ + (void)initCallKitProvider {
289289
CXCallUpdate *callUpdate = [[CXCallUpdate alloc] init];
290290
callUpdate.localizedCallerName = displayName;
291291
callUpdate.remoteHandle = callHandle;
292+
293+
if ([options valueForKey:@"hasVideo"] != nil) {
294+
callUpdate.hasVideo = [RCTConvert BOOL:options[@"hasVideo"]];
295+
}
296+
if ([options valueForKey:@"supportsHolding"] != nil) {
297+
callUpdate.supportsHolding = [RCTConvert BOOL:options[@"supportsHolding"]];
298+
}
299+
if ([options valueForKey:@"supportsDTMF"] != nil) {
300+
callUpdate.supportsDTMF = [RCTConvert BOOL:options[@"supportsDTMF"]];
301+
}
302+
if ([options valueForKey:@"supportsGrouping"] != nil) {
303+
callUpdate.supportsGrouping = [RCTConvert BOOL:options[@"supportsGrouping"]];
304+
}
305+
if ([options valueForKey:@"supportsUngrouping"] != nil) {
306+
callUpdate.supportsUngrouping = [RCTConvert BOOL:options[@"supportsUngrouping"]];
307+
}
308+
292309
[self.callKeepProvider reportCallWithUUID:uuid updated:callUpdate];
293310
}
294311

0 commit comments

Comments
 (0)