Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,12 @@ const didDisplayIncomingCall = handler =>
const didPerformSetMutedCallAction = handler =>
eventEmitter.addListener(RNCallKeepDidPerformSetMutedCallAction, (data) => handler(data.muted));

const didPerformDTMFAction = handler => {
// @TODO: handle DTMF on iOS
if (isIOS) {
return;
}
const didPerformDTMFAction = handler =>
eventEmitter.addListener(RNCallKeepDidPerformDTMFAction, (data) => {
const payload = isIOS ? { dtmf: data.digits, callUUID: data.callUUID } : data;

eventEmitter.addListener(RNCallKeepDidPerformDTMFAction, handler);
};
return handler(payload);
});

export const listeners = {
didReceiveStartCallAction,
Expand Down
13 changes: 12 additions & 1 deletion ios/RNCallKeep/RNCallKeep.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
static NSString *const RNCallKeepDidActivateAudioSession = @"RNCallKeepDidActivateAudioSession";
static NSString *const RNCallKeepDidDisplayIncomingCall = @"RNCallKeepDidDisplayIncomingCall";
static NSString *const RNCallKeepDidPerformSetMutedCallAction = @"RNCallKeepDidPerformSetMutedCallAction";
static NSString *const RNCallKeepPerformPlayDTMFCallAction = @"RNCallKeepDidPerformDTMFAction";

@implementation RNCallKeep
{
Expand Down Expand Up @@ -67,7 +68,8 @@ - (void)dealloc
RNCallKeepPerformEndCallAction,
RNCallKeepDidActivateAudioSession,
RNCallKeepDidDisplayIncomingCall,
RNCallKeepDidPerformSetMutedCallAction
RNCallKeepDidPerformSetMutedCallAction,
RNCallKeepPerformPlayDTMFCallAction
];
}

Expand Down Expand Up @@ -453,6 +455,15 @@ - (void)provider:(CXProvider *)provider performSetHeldCallAction:(CXSetHeldCallA
#endif
}

- (void)provider:(CXProvider *)provider performPlayDTMFCallAction:(CXPlayDTMFCallAction *)action {
#ifdef DEBUG
NSLog(@"[RNCallKit][CXProviderDelegate][provider:performPlayDTMFCallAction]");
#endif
NSString *callUUID = [self containsLowerCaseLetter:action.callUUID.UUIDString] ? action.callUUID.UUIDString : [action.callUUID.UUIDString lowercaseString];
[self sendEventWithName:RNCallKeepPerformPlayDTMFCallAction body:@{ @"digits": action.digits, @"callUUID": callUUID }];
[action fulfill];
}

- (void)provider:(CXProvider *)provider timedOutPerformingAction:(CXAction *)action
{
#ifdef DEBUG
Expand Down