Chat Screen: Expand header on new created room.

https://github.com/vector-im/vector-ios/issues/229
This commit is contained in:
giomfo 2016-04-18 16:56:44 +02:00
parent 61cae5404a
commit 861119edb2
3 changed files with 29 additions and 5 deletions

View file

@ -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;

View file

@ -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.

View file

@ -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;
}
}