diff --git a/Riot/Categories/MXKRoomBubbleTableViewCell+Riot.h b/Riot/Categories/MXKRoomBubbleTableViewCell+Riot.h index 6bc374644..639728352 100644 --- a/Riot/Categories/MXKRoomBubbleTableViewCell+Riot.h +++ b/Riot/Categories/MXKRoomBubbleTableViewCell+Riot.h @@ -65,6 +65,20 @@ extern NSString *const kMXKRoomBubbleCellKeyVerificationIncomingRequestDeclinePr */ extern NSString *const kMXKRoomBubbleCellCallBackButtonPressed; +/** + Action identifier used when the user pressed "Decline" button for an incoming call. + + The `userInfo` dictionary contains an `MXEvent` object under the `kMXKRoomBubbleCellEventKey` key, representing the invite event of the call. + */ +extern NSString *const kMXKRoomBubbleCellCallDeclineButtonPressed; + +/** + Action identifier used when the user pressed "Answer" button for an incoming call. + + The `userInfo` dictionary contains an `MXEvent` object under the `kMXKRoomBubbleCellEventKey` key, representing the invite event of the call. + */ +extern NSString *const kMXKRoomBubbleCellCallAnswerButtonPressed; + /** Define a `MXKRoomBubbleTableViewCell` category at Riot level to handle bubble customisation. */ diff --git a/Riot/Categories/MXKRoomBubbleTableViewCell+Riot.m b/Riot/Categories/MXKRoomBubbleTableViewCell+Riot.m index b1fa86843..589bf9e5f 100644 --- a/Riot/Categories/MXKRoomBubbleTableViewCell+Riot.m +++ b/Riot/Categories/MXKRoomBubbleTableViewCell+Riot.m @@ -34,6 +34,8 @@ NSString *const kMXKRoomBubbleCellEventIdKey = @"kMXKRoomBubbleCellEventIdKey"; NSString *const kMXKRoomBubbleCellKeyVerificationIncomingRequestAcceptPressed = @"kMXKRoomBubbleCellKeyVerificationAcceptPressed"; NSString *const kMXKRoomBubbleCellKeyVerificationIncomingRequestDeclinePressed = @"kMXKRoomBubbleCellKeyVerificationDeclinePressed"; NSString *const kMXKRoomBubbleCellCallBackButtonPressed = @"kMXKRoomBubbleCellCallBackButtonPressed"; +NSString *const kMXKRoomBubbleCellCallDeclineButtonPressed = @"kMXKRoomBubbleCellCallDeclineButtonPressed"; +NSString *const kMXKRoomBubbleCellCallAnswerButtonPressed = @"kMXKRoomBubbleCellCallAnswerButtonPressed"; @implementation MXKRoomBubbleTableViewCell (Riot) diff --git a/Riot/Modules/Room/RoomViewController.m b/Riot/Modules/Room/RoomViewController.m index 611a64390..171c67fd5 100644 --- a/Riot/Modules/Room/RoomViewController.m +++ b/Riot/Modules/Room/RoomViewController.m @@ -2390,6 +2390,22 @@ NSNotificationName const RoomCallTileTappedNotification = @"RoomCallTileTappedNo [self roomInputToolbarView:self.inputToolbarView placeCallWithVideo2:eventContent.isVideoCall]; } + else if ([actionIdentifier isEqualToString:kMXKRoomBubbleCellCallDeclineButtonPressed]) + { + MXEvent *callInviteEvent = userInfo[kMXKRoomBubbleCellEventKey]; + MXCallInviteEventContent *eventContent = [MXCallInviteEventContent modelFromJSON:callInviteEvent.content]; + + MXCall *call = [self.mainSession.callManager callWithCallId:eventContent.callId]; + [call hangup]; + } + else if ([actionIdentifier isEqualToString:kMXKRoomBubbleCellCallAnswerButtonPressed]) + { + MXEvent *callInviteEvent = userInfo[kMXKRoomBubbleCellEventKey]; + MXCallInviteEventContent *eventContent = [MXCallInviteEventContent modelFromJSON:callInviteEvent.content]; + + MXCall *call = [self.mainSession.callManager callWithCallId:eventContent.callId]; + [call answer]; + } else if ([actionIdentifier isEqualToString:RoomCreationIntroCell.tapOnAvatarView]) { [self showRoomAvatarChange];