Skip to content
Merged
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
15 changes: 2 additions & 13 deletions src/ios/CordovaCall.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ @implementation CordovaCall
NSString* callId;
NSDictionary* callData;
BOOL isMutedState;
BOOL isProgramaticMute;

NSMutableArray* pendingCallResponses;
NSString* const PENDING_RESPONSE_ANSWER = @"pendingResponseAnswer";
Expand Down Expand Up @@ -357,18 +356,16 @@ - (void)mute:(CDVInvokedUrlCommand*)command
[self.callController requestTransaction:transaction completion:^(NSError * _Nullable error) {
if (error == nil) {
isMutedState = YES;
isProgramaticMute = YES;
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:@"Muted Successfully"];
} else {
[self logMessage:@"Error occurred muting Call"];
isMutedState = NO;
isProgramaticMute = NO;
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"An error occurred"];
}
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}];
} else {
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"No active call to mute"];
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:@"No active call to mute"];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
}
Expand All @@ -385,18 +382,16 @@ - (void)unmute:(CDVInvokedUrlCommand*)command
[self.callController requestTransaction:transaction completion:^(NSError * _Nullable error) {
if (error == nil) {
isMutedState = NO;
isProgramaticMute = YES;
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:@"Unmuted Successfully"];
} else {
[self logMessage:@"Error occurred unmuting Call"];
isMutedState = YES;
isProgramaticMute = NO;
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"An error occurred"];
}
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}];
} else {
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"No active call to unmute"];
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:@"No active call to unmute"];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
}
Expand Down Expand Up @@ -637,12 +632,6 @@ - (void)provider:(CXProvider *)provider performSetMutedCallAction:(CXSetMutedCal
BOOL isMuted = action.muted;
[self logMessage:[NSString stringWithFormat:@"Callkit UI received %@ event, currently %@", isMuted ? @"mute" : @"unmute", isMutedState ? @"muted" : @"unmuted"]];
[action fulfill];
// Ignore programatic mute/unmute events
if (isProgramaticMute) {
[self logMessage:@"Ignoring programatic mute/unmute event."];
isProgramaticMute = NO;
return;
}

// Ignore the duplicate mute/unmute events, somehow 2 events get sent for every action
if (isMutedState == isMuted) {
Expand Down