mirror of
https://github.com/vector-im/element-ios.git
synced 2024-09-30 00:02:47 +00:00
Merge pull request #230 from vector-im/229
Chat Screen: Expand header on new created room.
This commit is contained in:
commit
85022d1f11
3 changed files with 29 additions and 5 deletions
|
@ -651,6 +651,9 @@
|
|||
|
||||
[self selectRoomWithId:room.state.roomId andEventId:nil inMatrixSession:self.mainSession];
|
||||
|
||||
// Force the expanded header
|
||||
self.currentRoomViewController.showExpandedHeader = YES;
|
||||
|
||||
} failure:^(NSError *error) {
|
||||
|
||||
roomCreationRequest = nil;
|
||||
|
|
|
@ -33,10 +33,12 @@
|
|||
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *previewHeaderContainerHeightConstraint;
|
||||
|
||||
/**
|
||||
Show/Hide the expanded header.
|
||||
By default this header is hidden on new instantiated RoomViewController object.
|
||||
Force the display of the expanded header.
|
||||
The default value is NO: this expanded header is hidden on new instantiated RoomViewController object.
|
||||
|
||||
When this property is YES, the expanded header is forced each time the view controller appears.
|
||||
*/
|
||||
- (void)showExpandedHeader:(BOOL)isVisible;
|
||||
@property (nonatomic) BOOL showExpandedHeader;
|
||||
|
||||
/**
|
||||
Display the preview of a room that is unknown for the user.
|
||||
|
|
|
@ -263,6 +263,11 @@
|
|||
}
|
||||
|
||||
[self listenTypingNotifications];
|
||||
|
||||
if (self.showExpandedHeader)
|
||||
{
|
||||
[self showExpandedHeader:YES];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)viewWillDisappear:(BOOL)animated
|
||||
|
@ -340,6 +345,12 @@
|
|||
UIEdgeInsets contentInset = self.bubblesTableView.contentInset;
|
||||
contentInset.bottom = self.bottomLayoutGuide.length;
|
||||
self.bubblesTableView.contentInset = contentInset;
|
||||
|
||||
if (self.expandedHeaderContainer.isHidden == NO)
|
||||
{
|
||||
// Adjust the top constraint of the bubbles table
|
||||
self.bubblesTableViewTopConstraint.constant = self.expandedHeaderContainerHeightConstraint.constant - self.bubblesTableView.contentInset.top;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id <UIViewControllerTransitionCoordinator>)coordinator
|
||||
|
@ -516,6 +527,14 @@
|
|||
[super destroy];
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
||||
- (void)setShowExpandedHeader:(BOOL)showExpandedHeader
|
||||
{
|
||||
_showExpandedHeader = showExpandedHeader;
|
||||
[self showExpandedHeader:showExpandedHeader];
|
||||
}
|
||||
|
||||
#pragma mark - Internals
|
||||
|
||||
- (BOOL)isRoomPreview
|
||||
|
@ -1392,10 +1411,10 @@
|
|||
{
|
||||
[super scrollViewWillEndDragging:scrollView withVelocity:velocity targetContentOffset:targetContentOffset];
|
||||
|
||||
// Hide expanded header on scroll down
|
||||
// Hide the expanded header on scroll down by reseting the property 'showExpandedHeader'. Then the header is not expanded automatically on viewWillAppear.
|
||||
if (storedContentOffset < scrollView.contentOffset.y)
|
||||
{
|
||||
[self showExpandedHeader:NO];
|
||||
self.showExpandedHeader = NO;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue