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

Commit b631864

Browse files
authored
Merge pull request #31 from aarkalyk/uppercased-callid-fix
Fix / CallKit uppercasing call uuid
2 parents d47d7ee + f389628 commit b631864

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

ios/RNCallKit/RNCallKit.m

+10-2
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,12 @@ - (BOOL)lessThanIos10_2
208208
}
209209
}
210210

211+
- (BOOL)containsLowerCaseLetter:(NSString *)callUUID
212+
{
213+
NSRegularExpression* regex = [[NSRegularExpression alloc] initWithPattern:@"[a-z]" options:0 error:nil];
214+
return [regex numberOfMatchesInString:callUUID options:0 range:NSMakeRange(0, [callUUID length])] > 0;
215+
}
216+
211217
- (int)getHandleType:(NSString *)handleType
212218
{
213219
int _handleType;
@@ -366,7 +372,8 @@ - (void)provider:(CXProvider *)provider performAnswerCallAction:(CXAnswerCallAct
366372
if (![self lessThanIos10_2]) {
367373
[self configureAudioSession];
368374
}
369-
[self sendEventWithName:RNCallKitPerformAnswerCallAction body:@{ @"callUUID": action.callUUID.UUIDString }];
375+
NSString *callUUID = [self containsLowerCaseLetter:action.callUUID.UUIDString] ? action.callUUID.UUIDString : [action.callUUID.UUIDString lowercaseString];
376+
[self sendEventWithName:RNCallKitPerformAnswerCallAction body:@{ @"callUUID": callUUID }];
370377
[action fulfill];
371378
}
372379

@@ -376,7 +383,8 @@ - (void)provider:(CXProvider *)provider performEndCallAction:(CXEndCallAction *)
376383
#ifdef DEBUG
377384
NSLog(@"[RNCallKit][CXProviderDelegate][provider:performEndCallAction]");
378385
#endif
379-
[self sendEventWithName:RNCallKitPerformEndCallAction body:@{ @"callUUID": action.callUUID.UUIDString }];
386+
NSString *callUUID = [self containsLowerCaseLetter:action.callUUID.UUIDString] ? action.callUUID.UUIDString : [action.callUUID.UUIDString lowercaseString];
387+
[self sendEventWithName:RNCallKitPerformEndCallAction body:@{ @"callUUID": callUUID }];
380388
[action fulfill];
381389
}
382390

0 commit comments

Comments
 (0)