Skip to content
This repository has been archived by the owner on May 26, 2019. It is now read-only.

Commit

Permalink
Merge pull request #31 from aarkalyk/uppercased-callid-fix
Browse files Browse the repository at this point in the history
Fix / CallKit uppercasing call uuid
  • Loading branch information
ianlin authored Feb 13, 2018
2 parents d47d7ee + f389628 commit b631864
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions ios/RNCallKit/RNCallKit.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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];
}

Expand All @@ -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];
}

Expand Down

0 comments on commit b631864

Please sign in to comment.