MESSENGER-4209 fix only one user can be selected when creating dm

This commit is contained in:
JanNiklas Grabowski
2023-03-28 11:21:49 +00:00
committed by Frank Rotermund
parent 89bff2aa64
commit 16deef8c28
@@ -322,12 +322,8 @@
}
// hide the search bar if a participant is already invited by email
BOOL hideSearchBar = [self participantsAlreadyContainAnEmail];
self.searchBarHeader.alpha = hideSearchBar ? 0.0f : 1.0f;
self.searchBarHeaderHeightConstraint.constant = hideSearchBar ? 0.0f : 50.0f;
[UIView animateWithDuration:0.2f animations:^{
[self.view layoutIfNeeded];
}];
[self hideSearchBar: [self participantsAlreadyContainAnEmail]];
}
- (BOOL)participantsAlreadyContainAnEmail
@@ -363,7 +359,8 @@
}
// if it is not a matrix contact, nor a local contact with a MatrixID, and if there is already at least one participant, another participant cannot be added.
if ((contact.matrixIdentifiers.count == 0 && ![MXTools isMatrixUserIdentifier:contact.displayName]) && participants.count > 0)
// bwi: dms can only be created with one participant
if ((contact.matrixIdentifiers.count == 0 && ![MXTools isMatrixUserIdentifier:contact.displayName]) || participants.count > 0)
{
return NO;
}
@@ -938,6 +935,11 @@
// Refresh display by leaving search session
[self searchBarCancelButtonClicked:_searchBarView];
// bwi: if there is already at least one participant, the search bar should be hidden
if (participants.count > 0) {
[self hideSearchBar:true];
}
}
}
@@ -949,4 +951,15 @@
[self showInviteFriendsFromSourceView:button];
}
#pragma mark - bwi: hideSearchBar
- (void)hideSearchBar:(BOOL)shouldHide
{
self.searchBarHeader.alpha = shouldHide ? 0.0f : 1.0f;
self.searchBarHeaderHeightConstraint.constant = shouldHide ? 0.0f : 50.0f;
[UIView animateWithDuration:0.2f animations:^{
[self.view layoutIfNeeded];
}];
}
@end