From ecddc6b8f8be36504052e3ff8778152085165384 Mon Sep 17 00:00:00 2001 From: ismailgulek Date: Fri, 12 Aug 2022 15:50:15 +0300 Subject: [PATCH 1/6] Fix `UITableViewAlertForVisibleCellsAccessDuringUpdate` errors --- Riot/Modules/Room/RoomViewController.m | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Riot/Modules/Room/RoomViewController.m b/Riot/Modules/Room/RoomViewController.m index 99eff65aa6..e287353c5c 100644 --- a/Riot/Modules/Room/RoomViewController.m +++ b/Riot/Modules/Room/RoomViewController.m @@ -4938,7 +4938,9 @@ - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)ce { readMarkerTableViewCell = roomBubbleTableViewCell; - [self checkReadMarkerVisibility]; + dispatch_async(dispatch_get_main_queue(), ^{ + [self checkReadMarkerVisibility]; + }); } } } From 71b2252cded02af729b7ed3a173add6da63698be Mon Sep 17 00:00:00 2001 From: ismailgulek Date: Fri, 12 Aug 2022 15:50:55 +0300 Subject: [PATCH 2/6] Add changelog --- changelog.d/5932.bugfix | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/5932.bugfix diff --git a/changelog.d/5932.bugfix b/changelog.d/5932.bugfix new file mode 100644 index 0000000000..967a872aa7 --- /dev/null +++ b/changelog.d/5932.bugfix @@ -0,0 +1 @@ +RoomViewController: Wait for table view updates before checing read marker visibility. From 34d09cd0f9abac7294652cb877c9aca226c8ee87 Mon Sep 17 00:00:00 2001 From: ismailgulek Date: Fri, 12 Aug 2022 17:46:17 +0300 Subject: [PATCH 3/6] Fix `UITableViewAlertForLayoutOutsideViewHierarchy` errors --- Riot/Modules/Room/MXKRoomViewController.m | 4 ++- Riot/Modules/Room/RoomViewController.m | 41 +++++++++++++---------- 2 files changed, 26 insertions(+), 19 deletions(-) diff --git a/Riot/Modules/Room/MXKRoomViewController.m b/Riot/Modules/Room/MXKRoomViewController.m index a3ec8d280b..ffb91024bb 100644 --- a/Riot/Modules/Room/MXKRoomViewController.m +++ b/Riot/Modules/Room/MXKRoomViewController.m @@ -308,7 +308,9 @@ - (void)viewWillAppear:(BOOL)animated } // Finalize view controller appearance - [self updateViewControllerAppearanceOnRoomDataSourceState]; + dispatch_async(dispatch_get_main_queue(), ^{ + [self updateViewControllerAppearanceOnRoomDataSourceState]; + }); // no need to reload the tableview at this stage // IOS is going to load it after calling this method diff --git a/Riot/Modules/Room/RoomViewController.m b/Riot/Modules/Room/RoomViewController.m index e287353c5c..1c9114ab12 100644 --- a/Riot/Modules/Room/RoomViewController.m +++ b/Riot/Modules/Room/RoomViewController.m @@ -353,7 +353,9 @@ - (void)viewDidLoad // Replace the default input toolbar view. // Note: this operation will force the layout of subviews. That is why cell view classes must be registered before. - [self updateRoomInputToolbarViewClassIfNeeded]; + dispatch_async(dispatch_get_main_queue(), ^{ + [self updateRoomInputToolbarViewClassIfNeeded]; + }); // set extra area [self setRoomActivitiesViewClass:RoomActivitiesView.class]; @@ -5680,25 +5682,28 @@ - (void)goBackToLive continueBlock(threadDataSource, YES); }]; } - else if (self.isContextPreview) - { - [RoomPreviewDataSource loadRoomDataSourceWithRoomId:self.roomDataSource.roomId - andMatrixSession:self.mainSession - onComplete:^(RoomPreviewDataSource *roomDataSource) - { - continueBlock(roomDataSource, YES); - }]; - } - else + else if (self.roomDataSource.roomId) { - // Switch back to the room live timeline managed by MXKRoomDataSourceManager - MXKRoomDataSourceManager *roomDataSourceManager = [MXKRoomDataSourceManager sharedManagerForMatrixSession:self.mainSession]; + if (self.isContextPreview) + { + [RoomPreviewDataSource loadRoomDataSourceWithRoomId:self.roomDataSource.roomId + andMatrixSession:self.mainSession + onComplete:^(RoomPreviewDataSource *roomDataSource) + { + continueBlock(roomDataSource, YES); + }]; + } + else + { + // Switch back to the room live timeline managed by MXKRoomDataSourceManager + MXKRoomDataSourceManager *roomDataSourceManager = [MXKRoomDataSourceManager sharedManagerForMatrixSession:self.mainSession]; - [roomDataSourceManager roomDataSourceForRoom:self.roomDataSource.roomId - create:YES - onComplete:^(MXKRoomDataSource *roomDataSource) { - continueBlock(roomDataSource, NO); - }]; + [roomDataSourceManager roomDataSourceForRoom:self.roomDataSource.roomId + create:YES + onComplete:^(MXKRoomDataSource *roomDataSource) { + continueBlock(roomDataSource, NO); + }]; + } } } } From 98338fd946e5d64e09f38c805a9a65935148c94f Mon Sep 17 00:00:00 2001 From: ismailgulek Date: Fri, 12 Aug 2022 17:46:44 +0300 Subject: [PATCH 4/6] Remove unnecessary inputAccessoryView from room input toolbar --- Riot/Modules/Room/Views/InputToolbar/RoomInputToolbarView.m | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Riot/Modules/Room/Views/InputToolbar/RoomInputToolbarView.m b/Riot/Modules/Room/Views/InputToolbar/RoomInputToolbarView.m index 106fa3bb3a..40f177fe21 100644 --- a/Riot/Modules/Room/Views/InputToolbar/RoomInputToolbarView.m +++ b/Riot/Modules/Room/Views/InputToolbar/RoomInputToolbarView.m @@ -80,10 +80,6 @@ - (void)awakeFromNib [self updateUIWithAttributedTextMessage:nil animated:NO]; self.textView.toolbarDelegate = self; - - // Add an accessory view to the text view in order to retrieve keyboard view. - inputAccessoryView = [[UIView alloc] initWithFrame:CGRectZero]; - self.textView.inputAccessoryView = inputAccessoryView; } - (void)setVoiceMessageToolbarView:(UIView *)voiceMessageToolbarView From e0f1e4dcad6287ff180364cebdcdf54eb20ebe50 Mon Sep 17 00:00:00 2001 From: ismailgulek Date: Mon, 15 Aug 2022 14:49:24 +0300 Subject: [PATCH 5/6] Revert the fix for keyboard stickiness, rename inputAccessoryView --- .../Views/RoomInputToolbar/MXKRoomInputToolbarView.h | 4 ++-- .../Views/RoomInputToolbar/MXKRoomInputToolbarView.m | 4 ++-- .../MXKRoomInputToolbarViewWithSimpleTextView.m | 4 ++-- Riot/Modules/Room/MXKRoomViewController.m | 2 +- Riot/Modules/Room/Views/InputToolbar/RoomInputToolbarView.m | 3 +++ 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/Riot/Modules/MatrixKit/Views/RoomInputToolbar/MXKRoomInputToolbarView.h b/Riot/Modules/MatrixKit/Views/RoomInputToolbar/MXKRoomInputToolbarView.h index 4282c505dd..503441a523 100644 --- a/Riot/Modules/MatrixKit/Views/RoomInputToolbar/MXKRoomInputToolbarView.h +++ b/Riot/Modules/MatrixKit/Views/RoomInputToolbar/MXKRoomInputToolbarView.h @@ -205,7 +205,7 @@ typedef enum : NSUInteger UIView *messageComposerContainer; @protected - UIView *inputAccessoryView; + UIView *inputAccessoryViewForKeyboard; } /** @@ -333,7 +333,7 @@ typedef enum : NSUInteger actually used to retrieve the keyboard view. Indeed the keyboard view is the superview of the accessory view when the message composer become the first responder. */ -@property (readonly) UIView *inputAccessoryView; +@property (readonly) UIView *inputAccessoryViewForKeyboard; /** Display the keyboard. diff --git a/Riot/Modules/MatrixKit/Views/RoomInputToolbar/MXKRoomInputToolbarView.m b/Riot/Modules/MatrixKit/Views/RoomInputToolbar/MXKRoomInputToolbarView.m index 40d0d5356d..61933d8d9a 100644 --- a/Riot/Modules/MatrixKit/Views/RoomInputToolbar/MXKRoomInputToolbarView.m +++ b/Riot/Modules/MatrixKit/Views/RoomInputToolbar/MXKRoomInputToolbarView.m @@ -61,7 +61,7 @@ Array of validation views (MXKImageView instances) @end @implementation MXKRoomInputToolbarView -@synthesize messageComposerContainer, inputAccessoryView; +@synthesize messageComposerContainer, inputAccessoryViewForKeyboard; + (UINib *)nib { @@ -103,7 +103,7 @@ - (void)awakeFromNib - (void)dealloc { - inputAccessoryView = nil; + inputAccessoryViewForKeyboard = nil; [self destroy]; } diff --git a/Riot/Modules/MatrixKit/Views/RoomInputToolbar/MXKRoomInputToolbarViewWithSimpleTextView.m b/Riot/Modules/MatrixKit/Views/RoomInputToolbar/MXKRoomInputToolbarViewWithSimpleTextView.m index 3cdb38eda7..c48bfda5a2 100644 --- a/Riot/Modules/MatrixKit/Views/RoomInputToolbar/MXKRoomInputToolbarViewWithSimpleTextView.m +++ b/Riot/Modules/MatrixKit/Views/RoomInputToolbar/MXKRoomInputToolbarViewWithSimpleTextView.m @@ -30,8 +30,8 @@ - (void)awakeFromNib [super awakeFromNib]; // Add an accessory view to the text view in order to retrieve keyboard view. - inputAccessoryView = [[UIView alloc] initWithFrame:CGRectZero]; - self.messageComposerTextView.inputAccessoryView = self.inputAccessoryView; + inputAccessoryViewForKeyboard = [[UIView alloc] initWithFrame:CGRectZero]; + self.messageComposerTextView.inputAccessoryView = inputAccessoryViewForKeyboard; } -(void)customizeViewRendering diff --git a/Riot/Modules/Room/MXKRoomViewController.m b/Riot/Modules/Room/MXKRoomViewController.m index ffb91024bb..2002d73444 100644 --- a/Riot/Modules/Room/MXKRoomViewController.m +++ b/Riot/Modules/Room/MXKRoomViewController.m @@ -495,7 +495,7 @@ - (void)onKeyboardShowAnimationComplete if (!keyboardView) { // Check whether the first responder is the input tool bar text composer - keyboardView = inputToolbarView.inputAccessoryView.superview; + keyboardView = inputToolbarView.inputAccessoryViewForKeyboard.superview; } // Report the keyboard view in order to track keyboard frame changes diff --git a/Riot/Modules/Room/Views/InputToolbar/RoomInputToolbarView.m b/Riot/Modules/Room/Views/InputToolbar/RoomInputToolbarView.m index 40f177fe21..cd57bd0edd 100644 --- a/Riot/Modules/Room/Views/InputToolbar/RoomInputToolbarView.m +++ b/Riot/Modules/Room/Views/InputToolbar/RoomInputToolbarView.m @@ -80,6 +80,9 @@ - (void)awakeFromNib [self updateUIWithAttributedTextMessage:nil animated:NO]; self.textView.toolbarDelegate = self; + + inputAccessoryViewForKeyboard = [[UIView alloc] initWithFrame:CGRectZero]; + self.textView.inputAccessoryView = inputAccessoryViewForKeyboard; } - (void)setVoiceMessageToolbarView:(UIView *)voiceMessageToolbarView From ca895a25f01bde4c085fbeae4cecb91ddd7769d6 Mon Sep 17 00:00:00 2001 From: ismailgulek Date: Mon, 15 Aug 2022 14:49:55 +0300 Subject: [PATCH 6/6] Fix table view height constraints in the room screen --- Riot/Modules/Room/RoomViewController.xib | 35 ++++++++---------------- 1 file changed, 12 insertions(+), 23 deletions(-) diff --git a/Riot/Modules/Room/RoomViewController.xib b/Riot/Modules/Room/RoomViewController.xib index 783146c292..aac9ed79aa 100644 --- a/Riot/Modules/Room/RoomViewController.xib +++ b/Riot/Modules/Room/RoomViewController.xib @@ -1,9 +1,9 @@ - + - + @@ -41,25 +41,14 @@ - - - - - - - - - - + + + + + - - + + @@ -160,8 +149,8 @@ -