Fix composer resizing animations

This commit is contained in:
aringenbach
2022-10-07 11:41:33 +02:00
committed by aringenbach
parent 19eaff0e97
commit c0f58a3938
3 changed files with 33 additions and 26 deletions
+26 -25
View File
@@ -3360,33 +3360,34 @@
- (void)roomInputToolbarView:(MXKRoomInputToolbarView*)toolbarView heightDidChanged:(CGFloat)height completion:(void (^)(BOOL finished))completion
{
NSLog(@"%@", [NSThread currentThread]);
_roomInputToolbarContainerHeightConstraint.constant = height;
dispatch_async(dispatch_get_main_queue(), ^{
// Update layout with animation
[UIView animateWithDuration:self.resizeComposerAnimationDuration delay:0 options:UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationOptionCurveEaseIn
animations:^{
// We will scroll to bottom if the bottom of the table is currently visible
BOOL shouldScrollToBottom = [self isBubblesTableScrollViewAtTheBottom];
CGFloat bubblesTableViewBottomConst = self->_roomInputToolbarContainerBottomConstraint.constant + self->_roomInputToolbarContainerHeightConstraint.constant + self->_roomActivitiesContainerHeightConstraint.constant;
self->_bubblesTableViewBottomConstraint.constant = bubblesTableViewBottomConst;
// Force to render the view
[self.view layoutIfNeeded];
if (shouldScrollToBottom)
{
[self scrollBubblesTableViewToBottomAnimated:NO];
}
}
completion:^(BOOL finished){
if (completion)
{
completion(finished);
}
}];
// Update layout with animation
[UIView animateWithDuration:self.resizeComposerAnimationDuration delay:0 options:UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationOptionCurveEaseIn
animations:^{
// We will scroll to bottom if the bottom of the table is currently visible
BOOL shouldScrollToBottom = [self isBubblesTableScrollViewAtTheBottom];
self->_roomInputToolbarContainerHeightConstraint.constant = height;
CGFloat bubblesTableViewBottomConst = self->_roomInputToolbarContainerBottomConstraint.constant + self->_roomInputToolbarContainerHeightConstraint.constant + self->_roomActivitiesContainerHeightConstraint.constant;
self->_bubblesTableViewBottomConstraint.constant = bubblesTableViewBottomConst;
// Force to render the view
[self.view layoutIfNeeded];
if (shouldScrollToBottom)
{
[self scrollBubblesTableViewToBottomAnimated:NO];
}
}
completion:^(BOOL finished){
if (completion)
{
completion(finished);
}
}];
});
}