Skip to content

Commit

Permalink
Merge pull request #6565 from vector-im/ismail/5932_blank_room_screen
Browse files Browse the repository at this point in the history
  • Loading branch information
ismailgulek authored Aug 17, 2022
2 parents edd1ec9 + ca895a2 commit adfe56b
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 54 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ typedef enum : NSUInteger
UIView *messageComposerContainer;

@protected
UIView *inputAccessoryView;
UIView *inputAccessoryViewForKeyboard;
}

/**
Expand Down Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Array of validation views (MXKImageView instances)
@end

@implementation MXKRoomInputToolbarView
@synthesize messageComposerContainer, inputAccessoryView;
@synthesize messageComposerContainer, inputAccessoryViewForKeyboard;

+ (UINib *)nib
{
Expand Down Expand Up @@ -103,7 +103,7 @@ - (void)awakeFromNib

- (void)dealloc
{
inputAccessoryView = nil;
inputAccessoryViewForKeyboard = nil;

[self destroy];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions Riot/Modules/Room/MXKRoomViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -493,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
Expand Down
45 changes: 26 additions & 19 deletions Riot/Modules/Room/RoomViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -4938,7 +4940,9 @@ - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)ce
{
readMarkerTableViewCell = roomBubbleTableViewCell;

[self checkReadMarkerVisibility];
dispatch_async(dispatch_get_main_queue(), ^{
[self checkReadMarkerVisibility];
});
}
}
}
Expand Down Expand Up @@ -5678,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);
}];
}
}
}
}
Expand Down
35 changes: 12 additions & 23 deletions Riot/Modules/Room/RoomViewController.xib
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="19529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="20037" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19519"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="20020"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
Expand Down Expand Up @@ -41,25 +41,14 @@
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" ambiguous="YES" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="3z2-8P-wlg">
<rect key="frame" x="0.0" y="0.0" width="375" height="20.5"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="hIS-uE-jlE">
<rect key="frame" x="0.0" y="0.0" width="375" height="20.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<variation key="default">
<mask key="subviews">
<exclude reference="hIS-uE-jlE"/>
</mask>
</variation>
<stackView opaque="NO" contentMode="scaleToFill" verticalHuggingPriority="251" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="3z2-8P-wlg" userLabel="Top Banners Stack View">
<rect key="frame" x="0.0" y="0.0" width="375" height="0.0"/>
<constraints>
<constraint firstAttribute="height" priority="250" id="Y9P-Ek-wjg"/>
</constraints>
</stackView>
<tableView contentMode="scaleToFill" ambiguous="YES" alwaysBounceVertical="YES" keyboardDismissMode="interactive" style="plain" separatorStyle="none" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" translatesAutoresizingMaskIntoConstraints="NO" id="BGD-sd-SQR">
<rect key="frame" x="0.0" y="20.5" width="375" height="605.5"/>
<tableView contentMode="scaleToFill" alwaysBounceVertical="YES" keyboardDismissMode="interactive" style="plain" separatorStyle="none" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" translatesAutoresizingMaskIntoConstraints="NO" id="BGD-sd-SQR">
<rect key="frame" x="0.0" y="0.0" width="375" height="626"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="accessibilityIdentifier" value="RoomVCBubblesTableView"/>
Expand Down Expand Up @@ -160,8 +149,8 @@
<action selector="scrollToBottomAction:" destination="-1" eventType="touchUpInside" id="TOf-aY-J6a"/>
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" alpha="0.0" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="0" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="QHs-rM-UU8" userLabel="scroll badge" customClass="BadgeLabel" customModule="Riot" customModuleProvider="target">
<rect key="frame" x="336.5" y="557.5" width="7.5" height="13.5"/>
<label opaque="NO" userInteractionEnabled="NO" alpha="0.0" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="0" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="QHs-rM-UU8" userLabel="scroll badge" customClass="BadgeLabel" customModule="Element" customModuleProvider="target">
<rect key="frame" x="331.5" y="556" width="17.5" height="16.5"/>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="11"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
Expand Down Expand Up @@ -244,7 +233,7 @@
</objects>
<designables>
<designable name="QHs-rM-UU8">
<size key="intrinsicContentSize" width="7.5" height="13.5"/>
<size key="intrinsicContentSize" width="17.5" height="16.5"/>
</designable>
</designables>
<resources>
Expand Down
7 changes: 3 additions & 4 deletions Riot/Modules/Room/Views/InputToolbar/RoomInputToolbarView.m
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,9 @@ - (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;

inputAccessoryViewForKeyboard = [[UIView alloc] initWithFrame:CGRectZero];
self.textView.inputAccessoryView = inputAccessoryViewForKeyboard;
}

- (void)setVoiceMessageToolbarView:(UIView *)voiceMessageToolbarView
Expand Down
1 change: 1 addition & 0 deletions changelog.d/5932.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
RoomViewController: Wait for table view updates before checing read marker visibility.

0 comments on commit adfe56b

Please sign in to comment.