From 2993ee5257c4aac15045315b2c5f24f9021035f5 Mon Sep 17 00:00:00 2001 From: ARKALYK AKASH Date: Sat, 3 Feb 2018 12:55:18 +0100 Subject: [PATCH 1/2] callUUID string lowercased on answer and end callbacks. --- ios/RNCallKit/RNCallKit.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ios/RNCallKit/RNCallKit.m b/ios/RNCallKit/RNCallKit.m index e51972f..5d22345 100644 --- a/ios/RNCallKit/RNCallKit.m +++ b/ios/RNCallKit/RNCallKit.m @@ -366,7 +366,7 @@ - (void)provider:(CXProvider *)provider performAnswerCallAction:(CXAnswerCallAct if (![self lessThanIos10_2]) { [self configureAudioSession]; } - [self sendEventWithName:RNCallKitPerformAnswerCallAction body:@{ @"callUUID": action.callUUID.UUIDString }]; + [self sendEventWithName:RNCallKitPerformAnswerCallAction body:@{ @"callUUID": [action.callUUID.UUIDString lowercaseString] }]; [action fulfill]; } @@ -376,7 +376,7 @@ - (void)provider:(CXProvider *)provider performEndCallAction:(CXEndCallAction *) #ifdef DEBUG NSLog(@"[RNCallKit][CXProviderDelegate][provider:performEndCallAction]"); #endif - [self sendEventWithName:RNCallKitPerformEndCallAction body:@{ @"callUUID": action.callUUID.UUIDString }]; + [self sendEventWithName:RNCallKitPerformEndCallAction body:@{ @"callUUID": [action.callUUID.UUIDString lowercaseString] }]; [action fulfill]; } From 76eec1196027385e71eb68ac6bae35b336748b2d Mon Sep 17 00:00:00 2001 From: ARKALYK AKASH Date: Sat, 3 Feb 2018 22:05:56 +0100 Subject: [PATCH 2/2] lowercases callUUID only if there's no lowercase letters. --- ios/RNCallKit/RNCallKit.m | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/ios/RNCallKit/RNCallKit.m b/ios/RNCallKit/RNCallKit.m index 5d22345..9082363 100644 --- a/ios/RNCallKit/RNCallKit.m +++ b/ios/RNCallKit/RNCallKit.m @@ -223,6 +223,12 @@ - (int)getHandleType:(NSString *)handleType return _handleType; } +- (BOOL)containsLowerCaseLetter:(NSString *)callUUID +{ + NSRegularExpression* regex = [[NSRegularExpression alloc] initWithPattern:@"[a-z]" options:0 error:nil]; + return [regex numberOfMatchesInString:callUUID options:0 range:NSMakeRange(0, [callUUID length])] > 0; +} + - (CXProviderConfiguration *)getProviderConfiguration { #ifdef DEBUG @@ -366,7 +372,8 @@ - (void)provider:(CXProvider *)provider performAnswerCallAction:(CXAnswerCallAct if (![self lessThanIos10_2]) { [self configureAudioSession]; } - [self sendEventWithName:RNCallKitPerformAnswerCallAction body:@{ @"callUUID": [action.callUUID.UUIDString lowercaseString] }]; + NSString *callUUID = [self containsLowerCaseLetter:action.callUUID.UUIDString] ? action.callUUID.UUIDString : [action.callUUID.UUIDString lowercaseString]; + [self sendEventWithName:RNCallKitPerformAnswerCallAction body:@{ @"callUUID": callUUID }]; [action fulfill]; } @@ -376,7 +383,8 @@ - (void)provider:(CXProvider *)provider performEndCallAction:(CXEndCallAction *) #ifdef DEBUG NSLog(@"[RNCallKit][CXProviderDelegate][provider:performEndCallAction]"); #endif - [self sendEventWithName:RNCallKitPerformEndCallAction body:@{ @"callUUID": [action.callUUID.UUIDString lowercaseString] }]; + NSString *callUUID = [self containsLowerCaseLetter:action.callUUID.UUIDString] ? action.callUUID.UUIDString : [action.callUUID.UUIDString lowercaseString]; + [self sendEventWithName:RNCallKitPerformEndCallAction body:@{ @"callUUID": callUUID }]; [action fulfill]; }