mirror of
https://github.com/vector-im/element-ios.git
synced 2024-09-29 07:42:40 +00:00
BF: Cannot join from a room preview for room with a long topic (#1645)
Update the room preview header height according to the screen height
This commit is contained in:
parent
c5aab876ad
commit
3df7e196eb
1 changed files with 27 additions and 1 deletions
|
@ -1605,7 +1605,33 @@
|
|||
{
|
||||
previewHeader.mainHeaderContainer.hidden = NO;
|
||||
previewHeader.mainHeaderBackgroundHeightConstraint.constant = previewHeader.mainHeaderContainer.frame.size.height;
|
||||
|
||||
|
||||
if ([previewHeader isKindOfClass:PreviewRoomTitleView.class])
|
||||
{
|
||||
// In case of preview, update the header height so that we can
|
||||
// display as much as possible the room topic in this header.
|
||||
// Note: the header height is the previewHeader.mainHeaderBackgroundHeightConstraint
|
||||
// just computed
|
||||
PreviewRoomTitleView *previewRoomTitleView = (PreviewRoomTitleView *)previewHeader;
|
||||
|
||||
// Compute the height required to display all the room topic
|
||||
CGSize sizeThatFitsTextView = [previewRoomTitleView.roomTopic sizeThatFits:CGSizeMake(previewRoomTitleView.roomTopic.frame.size.width, MAXFLOAT)];
|
||||
|
||||
// Increase the preview header height according to the room topic height
|
||||
// but limit it in order to let room for room messages at the screen bottom.
|
||||
// This free space depends on the device.
|
||||
// On an iphone 5 screen, the room topic height cannot be more than 50px.
|
||||
// Then, on larger screen, we can allow it a bit more height but we
|
||||
// apply a factor to give more priority to the display of more messages.
|
||||
CGFloat screenHeight = [[UIScreen mainScreen] bounds].size.height;
|
||||
CGFloat maxRoomTopicHeight = 50 + (screenHeight - 568) / 3;
|
||||
|
||||
CGFloat additionalHeight = MIN(maxRoomTopicHeight, sizeThatFitsTextView.height)
|
||||
- previewRoomTitleView.roomTopic.frame.size.height;
|
||||
|
||||
previewHeader.mainHeaderBackgroundHeightConstraint.constant += additionalHeight;
|
||||
}
|
||||
|
||||
[self setRoomTitleViewClass:RoomAvatarTitleView.class];
|
||||
// Note the avatar title view does not define tap gesture.
|
||||
|
||||
|
|
Loading…
Reference in a new issue