Room: When a call is active, turn the call button into a hangup button

This commit is contained in:
manuroe
2016-08-09 12:24:58 +02:00
parent 505a2fc7d8
commit 0118ddca72
8 changed files with 97 additions and 2 deletions
@@ -300,6 +300,7 @@
if ([call.room.roomId isEqualToString:customizedRoomDataSource.roomId])
{
[self refreshActivitiesViewDisplay];
[self refreshRoomInputToolbar];
}
}];
kMXCallManagerConferenceStartedObserver = [[NSNotificationCenter defaultCenter] addObserverForName:kMXCallManagerConferenceStarted object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *notif) {
@@ -316,6 +317,7 @@
if ([roomId isEqualToString:customizedRoomDataSource.roomId])
{
[self refreshActivitiesViewDisplay];
[self refreshRoomInputToolbar];
}
}];
}
@@ -894,6 +896,17 @@
[userPictureView.layer setCornerRadius:userPictureView.frame.size.width / 2];
userPictureView.clipsToBounds = YES;
}
// Show the hangup button if there is an active call
MXCall *callInRoom = [self.roomDataSource.mxSession.callManager callInRoom:self.roomDataSource.roomId];
if (callInRoom && callInRoom.state != MXCallStateEnded)
{
roomInputToolbarView.activeCall = YES;
}
else
{
roomInputToolbarView.activeCall = NO;
}
}
}
@@ -1906,6 +1919,24 @@
}];
}
- (void)roomInputToolbarViewHangupCall:(MXKRoomInputToolbarView *)toolbarView
{
RoomInputToolbarView *roomInputToolbarView = (RoomInputToolbarView*)toolbarView;
MXCall *callInRoom = [self.roomDataSource.mxSession.callManager callInRoom:self.roomDataSource.roomId];
if (callInRoom)
{
// Go back to the call screen.
// It will correctly manage the hide of the "back to call" banner
[[AppDelegate theDelegate] returnToCallView];
dispatch_async(dispatch_get_main_queue(), ^{
[callInRoom hangup];
roomInputToolbarView.activeCall = NO;
});
}
}
- (void)roomInputToolbarView:(MXKRoomInputToolbarView*)toolbarView heightDidChanged:(CGFloat)height completion:(void (^)(BOOL finished))completion
{
if (self.roomInputToolbarContainerHeightConstraint.constant != height)