From ce73cc7e986033c94735bc146f26f1ef5373ee15 Mon Sep 17 00:00:00 2001 From: ryanzhao Date: Thu, 29 Sep 2022 14:50:44 +1000 Subject: [PATCH] fix home screen conversation cell UI --- Session/Meta/AppDelegate.swift | 2 +- Session/Meta/Session-Info.plist | 1 - Session/Shared/FullConversationCell.swift | 14 ++++---------- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/Session/Meta/AppDelegate.swift b/Session/Meta/AppDelegate.swift index 0db20fced..e4523d53a 100644 --- a/Session/Meta/AppDelegate.swift +++ b/Session/Meta/AppDelegate.swift @@ -194,7 +194,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask { if UIDevice.current.isIPad { - return .all + return .allButUpsideDown } return .portrait diff --git a/Session/Meta/Session-Info.plist b/Session/Meta/Session-Info.plist index 1c8e77c13..e186b98c9 100644 --- a/Session/Meta/Session-Info.plist +++ b/Session/Meta/Session-Info.plist @@ -149,7 +149,6 @@ UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait - UIInterfaceOrientationPortraitUpsideDown UIViewControllerBasedStatusBarAppearance diff --git a/Session/Shared/FullConversationCell.swift b/Session/Shared/FullConversationCell.swift index 8739de5c5..f98a612be 100644 --- a/Session/Shared/FullConversationCell.swift +++ b/Session/Shared/FullConversationCell.swift @@ -191,7 +191,7 @@ public final class FullConversationCell: UITableViewCell { let labelContainerView = UIStackView(arrangedSubviews: [ topLabelStackView, bottomLabelStackView ]) labelContainerView.axis = .vertical - labelContainerView.alignment = .leading + labelContainerView.alignment = .fill labelContainerView.spacing = 6 labelContainerView.isUserInteractionEnabled = false @@ -207,12 +207,10 @@ public final class FullConversationCell: UITableViewCell { accentLineView.pin(.bottom, to: .bottom, of: contentView) timestampLabel.setContentCompressionResistancePriority(.required, for: NSLayoutConstraint.Axis.horizontal) - // HACK: The six lines below are part of a workaround for a weird layout bug - topLabelStackView.set(.width, to: UIScreen.main.bounds.width - Values.accentLineThickness - profilePictureViewSize - 3 * Values.mediumSpacing) + // HACK: The 4 lines below are part of a workaround for a weird layout bug topLabelStackView.set(.height, to: 20) topLabelSpacer.set(.height, to: 20) - bottomLabelStackView.set(.width, to: UIScreen.main.bounds.width - Values.accentLineThickness - profilePictureViewSize - 3 * Values.mediumSpacing) bottomLabelStackView.set(.height, to: 18) bottomLabelSpacer.set(.height, to: 18) @@ -224,12 +222,8 @@ public final class FullConversationCell: UITableViewCell { typingIndicatorView.pin(.leading, to: .leading, of: snippetLabelContainer) typingIndicatorView.centerYAnchor.constraint(equalTo: snippetLabel.centerYAnchor).isActive = true - stackView.pin(.leading, to: .leading, of: contentView) - stackView.pin(.top, to: .top, of: contentView) - - // HACK: The two lines below are part of a workaround for a weird layout bug - stackView.set(.width, to: UIScreen.main.bounds.width - Values.mediumSpacing) - stackView.set(.height, to: cellHeight) + stackView.pin([ UIView.VerticalEdge.bottom, UIView.VerticalEdge.top, UIView.HorizontalEdge.leading ], to: contentView) + stackView.pin(.trailing, to: .trailing, of: contentView, withInset: -Values.mediumSpacing) } // MARK: - Content