Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Thread title view fixes #6083

Merged
merged 3 commits into from
May 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Riot/Modules/Room/Views/Title/Thread/ThreadRoomTitleView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ enum ThreadRoomTitleViewMode {

@objcMembers
class ThreadRoomTitleView: RoomTitleView {

private enum Constants {
static let roomNameLeadingMarginForEncryptedRoom: CGFloat = 10
static let roomNameLeadingMarginForPlainRoom: CGFloat = 4
}

var mode: ThreadRoomTitleViewMode = .allThreads {
didSet {
Expand All @@ -35,6 +40,7 @@ class ThreadRoomTitleView: RoomTitleView {
@IBOutlet private weak var roomAvatarView: RoomAvatarView!
@IBOutlet private weak var roomEncryptionBadgeView: UIImageView!
@IBOutlet private weak var roomNameLabel: UILabel!
@IBOutlet private weak var roomNameLeadingConstraint: NSLayoutConstraint!

// MARK: - Methods

Expand All @@ -45,6 +51,11 @@ class ThreadRoomTitleView: RoomTitleView {
roomAvatarView.avatarImageView.image = nil
}
roomEncryptionBadgeView.image = model.roomEncryptionBadge
if roomEncryptionBadgeView.image == nil {
roomNameLeadingConstraint.constant = Constants.roomNameLeadingMarginForPlainRoom
} else {
roomNameLeadingConstraint.constant = Constants.roomNameLeadingMarginForEncryptedRoom
}
roomEncryptionBadgeView.isHidden = model.roomEncryptionBadge == nil
roomNameLabel.text = model.roomDisplayName
}
Expand Down
21 changes: 11 additions & 10 deletions Riot/Modules/Room/Views/Title/Thread/ThreadRoomTitleView.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="retina6_1" 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 @@ -33,33 +33,33 @@
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ABf-Vz-jLY">
<rect key="frame" x="0.0" y="22.5" width="181" height="2"/>
<rect key="frame" x="0.0" y="22.5" width="181" height="0.0"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="height" constant="2" id="kec-7k-q3g"/>
<constraint firstAttribute="height" id="kec-7k-q3g"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="5Ww-tc-6by">
<rect key="frame" x="0.0" y="25.5" width="181" height="17.5"/>
<rect key="frame" x="0.0" y="23.5" width="181" height="19.5"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="FJB-2F-rrQ" customClass="RoomAvatarView" customModule="Riot" customModuleProvider="target">
<rect key="frame" x="0.0" y="1" width="16" height="16"/>
<rect key="frame" x="0.0" y="0.0" width="16" height="16"/>
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="width" constant="16" id="Fg7-y5-fEC"/>
<constraint firstAttribute="height" constant="16" id="Qxm-RC-uC5"/>
</constraints>
</view>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="Mli-PC-WUh">
<rect key="frame" x="10" y="6" width="12" height="12"/>
<rect key="frame" x="10" y="5" width="12" height="12"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="width" secondItem="Mli-PC-WUh" secondAttribute="height" multiplier="1:1" id="Ohw-dy-qg0"/>
<constraint firstAttribute="width" constant="12" id="nKB-SN-cO0"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Room name" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="8lk-sN-3IP">
<rect key="frame" x="26" y="1.5" width="155" height="14.5"/>
<rect key="frame" x="26" y="0.5" width="155" height="14.5"/>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
Expand All @@ -68,9 +68,9 @@
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="Mli-PC-WUh" firstAttribute="bottom" secondItem="FJB-2F-rrQ" secondAttribute="bottom" constant="1" id="1SB-L0-yS4"/>
<constraint firstItem="8lk-sN-3IP" firstAttribute="centerY" secondItem="5Ww-tc-6by" secondAttribute="centerY" id="GFB-ot-8b1"/>
<constraint firstItem="8lk-sN-3IP" firstAttribute="centerY" secondItem="5Ww-tc-6by" secondAttribute="centerY" constant="-2" id="GFB-ot-8b1"/>
<constraint firstAttribute="trailing" secondItem="8lk-sN-3IP" secondAttribute="trailing" id="HCl-gK-Xhs"/>
<constraint firstItem="FJB-2F-rrQ" firstAttribute="centerY" secondItem="5Ww-tc-6by" secondAttribute="centerY" id="NiB-In-y7x"/>
<constraint firstItem="FJB-2F-rrQ" firstAttribute="centerY" secondItem="5Ww-tc-6by" secondAttribute="centerY" constant="-2" id="NiB-In-y7x"/>
<constraint firstItem="FJB-2F-rrQ" firstAttribute="leading" secondItem="5Ww-tc-6by" secondAttribute="leading" id="Smn-wx-c0n"/>
<constraint firstItem="8lk-sN-3IP" firstAttribute="leading" secondItem="FJB-2F-rrQ" secondAttribute="trailing" constant="10" id="Y1z-dr-Y0X"/>
<constraint firstItem="Mli-PC-WUh" firstAttribute="leading" secondItem="5Ww-tc-6by" secondAttribute="leading" constant="10" id="zH1-h4-JAC"/>
Expand Down Expand Up @@ -102,6 +102,7 @@
<outlet property="roomAvatarView" destination="FJB-2F-rrQ" id="SUd-p8-VCH"/>
<outlet property="roomEncryptionBadgeView" destination="Mli-PC-WUh" id="MuX-Qw-DfQ"/>
<outlet property="roomNameLabel" destination="8lk-sN-3IP" id="wFm-R4-fBo"/>
<outlet property="roomNameLeadingConstraint" destination="Y1z-dr-Y0X" id="dWJ-U0-inJ"/>
<outlet property="titleLabel" destination="BnG-NU-7Mg" id="gDw-Pr-oR8"/>
</connections>
<point key="canvasLocation" x="10.869565217391305" y="-256.47321428571428"/>
Expand Down
1 change: 1 addition & 0 deletions changelog.d/5878.change
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ThreadRoomTitleView: Reduce spaces between title and room avatar & room name.