From f389628335af0600061731fa94d9236feb18bdd1 Mon Sep 17 00:00:00 2001 From: ARKALYK AKASH Date: Fri, 9 Feb 2018 13:16:31 +0100 Subject: [PATCH] Uppercased callUUID fixed. --- 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 2ec824d..4069e8f 100644 --- a/ios/RNCallKit/RNCallKit.m +++ b/ios/RNCallKit/RNCallKit.m @@ -208,6 +208,12 @@ - (BOOL)lessThanIos10_2 } } +- (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; +} + - (int)getHandleType:(NSString *)handleType { int _handleType; @@ -366,7 +372,8 @@ - (void)provider:(CXProvider *)provider performAnswerCallAction:(CXAnswerCallAct if (![self lessThanIos10_2]) { [self configureAudioSession]; } - [self sendEventWithName:RNCallKitPerformAnswerCallAction body:@{ @"callUUID": action.callUUID.UUIDString }]; + 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 }]; + NSString *callUUID = [self containsLowerCaseLetter:action.callUUID.UUIDString] ? action.callUUID.UUIDString : [action.callUUID.UUIDString lowercaseString]; + [self sendEventWithName:RNCallKitPerformEndCallAction body:@{ @"callUUID": callUUID }]; [action fulfill]; }