Skip to content

Commit

Permalink
Close/show chat before/after room switch.
Browse files Browse the repository at this point in the history
Signed-off-by: Ivan Sein <ivan@nextcloud.com>
  • Loading branch information
Ivansss committed Feb 1, 2023
1 parent 4f2fd4b commit a364ebd
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions NextcloudTalk/CallViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ @interface CallViewController () <NCCallControllerDelegate, UICollectionViewDele
BOOL _pushToTalkActive;
BOOL _isHandRaised;
BOOL _proximityState;
BOOL _showChatAfterRoomSwitch;
UIImpactFeedbackGenerator *_buttonFeedbackGenerator;
CGPoint _localVideoDragStartingPosition;
CGPoint _localVideoOriginPosition;
Expand Down Expand Up @@ -1559,6 +1560,12 @@ -(void)collectionView:(UICollectionView *)collectionView willDisplayCell:(UIColl
- (void)callControllerDidJoinCall:(NCCallController *)callController
{
[self setCallState:CallStateWaitingParticipants];

// Show chat if it was visible before room switch
if (_showChatAfterRoomSwitch && !_chatViewController) {
_showChatAfterRoomSwitch = NO;
[self toggleChatView];
}
}

- (void)callControllerDidFailedJoiningCall:(NCCallController *)callController statusCode:(NSNumber *)statusCode errorReason:(NSString *) errorReason
Expand Down Expand Up @@ -1736,6 +1743,12 @@ - (void)callController:(NCCallController *)callController isSwitchingToCall:(NSS
{
[self setCallState:CallStateSwitchingToAnotherRoom];

// Close chat before switching to another room
if (_chatViewController) {
_showChatAfterRoomSwitch = YES;
[self toggleChatView];
}

// Connect to new call
TalkAccount *activeAccount = [[NCDatabaseManager sharedInstance] activeAccount];
[[NCAPIController sharedInstance] getRoomForAccount:activeAccount withToken:token withCompletionBlock:^(NSDictionary *roomDict, NSError *error) {
Expand Down

0 comments on commit a364ebd

Please sign in to comment.