|
25 | 25 | static NSString *const RNCallKeepDidDisplayIncomingCall = @"RNCallKeepDidDisplayIncomingCall"; |
26 | 26 | static NSString *const RNCallKeepDidPerformSetMutedCallAction = @"RNCallKeepDidPerformSetMutedCallAction"; |
27 | 27 | static NSString *const RNCallKeepPerformPlayDTMFCallAction = @"RNCallKeepDidPerformDTMFAction"; |
| 28 | +static NSString *const RNCallKeepDidToggleHoldAction = @"RNCallKeepDidToggleHoldAction"; |
28 | 29 |
|
29 | 30 | @implementation RNCallKeep |
30 | 31 | { |
@@ -69,7 +70,8 @@ - (void)dealloc |
69 | 70 | RNCallKeepDidActivateAudioSession, |
70 | 71 | RNCallKeepDidDisplayIncomingCall, |
71 | 72 | RNCallKeepDidPerformSetMutedCallAction, |
72 | | - RNCallKeepPerformPlayDTMFCallAction |
| 73 | + RNCallKeepPerformPlayDTMFCallAction, |
| 74 | + RNCallKeepDidToggleHoldAction |
73 | 75 | ]; |
74 | 76 | } |
75 | 77 |
|
@@ -123,11 +125,10 @@ - (void)dealloc |
123 | 125 | CXCallUpdate *callUpdate = [[CXCallUpdate alloc] init]; |
124 | 126 | callUpdate.remoteHandle = [[CXHandle alloc] initWithType:_handleType value:handle]; |
125 | 127 | callUpdate.supportsDTMF = YES; |
126 | | - // TODO: Holding |
127 | | - callUpdate.supportsHolding = NO; |
128 | | - callUpdate.supportsGrouping = NO; |
129 | | - callUpdate.supportsUngrouping = NO; |
130 | | - callUpdate.hasVideo = hasVideo; |
| 128 | + callUpdate.supportsHolding = YES; |
| 129 | + callUpdate.supportsGrouping = YES; |
| 130 | + callUpdate.supportsUngrouping = YES; |
| 131 | + callUpdate.hasVideo = NO; |
131 | 132 | callUpdate.localizedCallerName = localizedCallerName; |
132 | 133 |
|
133 | 134 | [self.callKeepProvider reportNewIncomingCallWithUUID:uuid update:callUpdate completion:^(NSError * _Nullable error) { |
@@ -243,9 +244,9 @@ - (void)requestTransaction:(CXTransaction *)transaction |
243 | 244 | CXCallUpdate *callUpdate = [[CXCallUpdate alloc] init]; |
244 | 245 | callUpdate.remoteHandle = startCallAction.handle; |
245 | 246 | callUpdate.supportsDTMF = YES; |
246 | | - callUpdate.supportsHolding = NO; |
247 | | - callUpdate.supportsGrouping = NO; |
248 | | - callUpdate.supportsUngrouping = NO; |
| 247 | + callUpdate.supportsHolding = YES; |
| 248 | + callUpdate.supportsGrouping = YES; |
| 249 | + callUpdate.supportsUngrouping = YES; |
249 | 250 | callUpdate.hasVideo = NO; |
250 | 251 | [self.callKeepProvider reportCallWithUUID:startCallAction.callUUID updated:callUpdate]; |
251 | 252 | } |
@@ -292,7 +293,7 @@ - (CXProviderConfiguration *)getProviderConfiguration |
292 | 293 | #endif |
293 | 294 | CXProviderConfiguration *providerConfiguration = [[CXProviderConfiguration alloc] initWithLocalizedName:_settings[@"appName"]]; |
294 | 295 | providerConfiguration.supportsVideo = YES; |
295 | | - providerConfiguration.maximumCallGroups = 1; |
| 296 | + providerConfiguration.maximumCallGroups = 3; |
296 | 297 | providerConfiguration.maximumCallsPerCallGroup = 1; |
297 | 298 | providerConfiguration.supportedHandleTypes = [NSSet setWithObjects:[NSNumber numberWithInteger:CXHandleTypePhoneNumber], [NSNumber numberWithInteger:CXHandleTypeEmailAddress], [NSNumber numberWithInteger:CXHandleTypeGeneric], nil]; |
298 | 299 | if (_settings[@"imageName"]) { |
@@ -448,16 +449,20 @@ - (void)provider:(CXProvider *)provider performEndCallAction:(CXEndCallAction *) |
448 | 449 | [action fulfill]; |
449 | 450 | } |
450 | 451 |
|
451 | | -- (void)provider:(CXProvider *)provider performSetHeldCallAction:(CXSetHeldCallAction *)action |
| 452 | +-(void)provider:(CXProvider *)provider performSetHeldCallAction:(CXSetHeldCallAction *)action |
452 | 453 | { |
453 | 454 | #ifdef DEBUG |
454 | 455 | NSLog(@"[RNCallKeep][CXProviderDelegate][provider:performSetHeldCallAction]"); |
455 | 456 | #endif |
| 457 | + NSString *callUUID = [self containsLowerCaseLetter:action.callUUID.UUIDString] ? action.callUUID.UUIDString : [action.callUUID.UUIDString lowercaseString]; |
| 458 | + |
| 459 | + [self sendEventWithName:RNCallKeepDidToggleHoldAction body:@{ @"hold": @(action.onHold), @"callUUID": callUUID }]; |
| 460 | + [action fulfill]; |
456 | 461 | } |
457 | 462 |
|
458 | 463 | - (void)provider:(CXProvider *)provider performPlayDTMFCallAction:(CXPlayDTMFCallAction *)action { |
459 | 464 | #ifdef DEBUG |
460 | | - NSLog(@"[RNCallKit][CXProviderDelegate][provider:performPlayDTMFCallAction]"); |
| 465 | + NSLog(@"[RNCallKeep][CXProviderDelegate][provider:performPlayDTMFCallAction]"); |
461 | 466 | #endif |
462 | 467 | NSString *callUUID = [self containsLowerCaseLetter:action.callUUID.UUIDString] ? action.callUUID.UUIDString : [action.callUUID.UUIDString lowercaseString]; |
463 | 468 | [self sendEventWithName:RNCallKeepPerformPlayDTMFCallAction body:@{ @"digits": action.digits, @"callUUID": callUUID }]; |
|
0 commit comments