UI updates

This commit is contained in:
ismailgulek 2020-09-15 14:09:57 +03:00
parent d232105a1d
commit 311de13e0b
3 changed files with 13 additions and 10 deletions

View file

@ -91,7 +91,7 @@
<constraint firstItem="goJ-ND-Jsk" firstAttribute="top" secondItem="M84-br-bHM" secondAttribute="top" constant="20" id="ykL-gN-QoL"/> <constraint firstItem="goJ-ND-Jsk" firstAttribute="top" secondItem="M84-br-bHM" secondAttribute="top" constant="20" id="ykL-gN-QoL"/>
</constraints> </constraints>
</view> </view>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="co7-sG-zRv" customClass="AutosizedTableView" customModule="Riot" customModuleProvider="target"> <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" contentInsetAdjustmentBehavior="never" dataMode="prototypes" style="plain" separatorStyle="none" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="1" sectionFooterHeight="1" translatesAutoresizingMaskIntoConstraints="NO" id="co7-sG-zRv" customClass="AutosizedTableView" customModule="Riot" customModuleProvider="target">
<rect key="frame" x="0.0" y="80" width="414" height="762"/> <rect key="frame" x="0.0" y="80" width="414" height="762"/>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/> <color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<connections> <connections>

View file

@ -112,9 +112,7 @@ final class RoomCreationEventsModalViewController: UIViewController {
} }
private func setupViews() { private func setupViews() {
mainTableView.separatorStyle = .none mainTableView.contentInset = UIEdgeInsets(top: 16, left: 0, bottom: 36, right: 0)
mainTableView.tableFooterView = UIView()
mainTableView.contentInset = UIEdgeInsets(top: 10, left: 0, bottom: 20, right: 0)
mainTableView.register(cellType: TextViewTableViewCell.self) mainTableView.register(cellType: TextViewTableViewCell.self)
} }

View file

@ -44,7 +44,15 @@ final class RoomCreationEventsModalViewModel: RoomCreationEventsModalViewModelTy
func rowViewModel(at indexPath: IndexPath) -> RoomCreationEventRowViewModel? { func rowViewModel(at indexPath: IndexPath) -> RoomCreationEventRowViewModel? {
let event = events[indexPath.row] let event = events[indexPath.row]
let formatterError = UnsafeMutablePointer<MXKEventFormatterError>.allocate(capacity: 1) let formatterError = UnsafeMutablePointer<MXKEventFormatterError>.allocate(capacity: 1)
return RoomCreationEventRowViewModel(title: eventFormatter.attributedString(from: event, with: roomState, error: formatterError)) if let string = eventFormatter.attributedString(from: event, with: roomState, error: formatterError) {
if string.string.hasPrefix("·") {
return RoomCreationEventRowViewModel(title: string)
}
let mutableString = NSMutableAttributedString(attributedString: string)
mutableString.insert(NSAttributedString(string: "· "), at: 0)
return RoomCreationEventRowViewModel(title: mutableString)
}
return RoomCreationEventRowViewModel(title: nil)
} }
var roomName: String? { var roomName: String? {
if let name = roomState.name, name.count > 0 { if let name = roomState.name, name.count > 0 {
@ -92,13 +100,10 @@ final class RoomCreationEventsModalViewModel: RoomCreationEventsModalViewModelTy
return return
} }
if (summary.isEncrypted) if summary.isEncrypted {
{
imageView.isHidden = false imageView.isHidden = false
imageView.image = EncryptionTrustLevelBadgeImageHelper.roomBadgeImage(for: summary.roomEncryptionTrustLevel()) imageView.image = EncryptionTrustLevelBadgeImageHelper.roomBadgeImage(for: summary.roomEncryptionTrustLevel())
} } else {
else
{
imageView.isHidden = true imageView.isHidden = true
} }
} }