Space panel overflow journeys & rough edge warnings #5227

- space menu additions according to new requirements
This commit is contained in:
Gil Eluard
2021-12-10 18:01:56 +01:00
parent 5b16c541fa
commit 2c7f8709fd
13 changed files with 91 additions and 4 deletions
@@ -21,6 +21,9 @@ enum SpaceMenuListItemAction {
case showAllRoomsInHomeSpace
case exploreSpaceMembers
case exploreSpaceRooms
case addRoom
case addSpace
case settings
case leaveSpace
}
@@ -42,6 +45,8 @@ class SpaceMenuListItemViewData {
let style: SpaceMenuListItemStyle
let title: String?
let icon: UIImage?
let isBeta: Bool
/// Any value related to the type of data (e.g. `Bool` for `boolean` style, `nil` for `normal` and `destructive` style)
var value: Any? {
didSet {
@@ -50,11 +55,12 @@ class SpaceMenuListItemViewData {
}
weak var delegate: SpaceMenuListItemViewDataDelegate?
init(action: SpaceMenuListItemAction, style: SpaceMenuListItemStyle, title: String?, icon: UIImage?, value: Any?) {
init(action: SpaceMenuListItemAction, style: SpaceMenuListItemStyle, title: String?, icon: UIImage?, value: Any?, isBeta: Bool = false) {
self.action = action
self.style = style
self.title = title
self.icon = icon
self.value = value
self.isBeta = isBeta
}
}
@@ -23,6 +23,8 @@ class SpaceMenuListViewCell: UITableViewCell, SpaceMenuCell, NibReusable {
@IBOutlet private weak var iconView: UIImageView!
@IBOutlet private weak var titleLabel: UILabel!
@IBOutlet private weak var betaView: UIView!
@IBOutlet private weak var betaLabel: UILabel!
@IBOutlet private weak var selectionView: UIView!
// MARK: - Private
@@ -64,6 +66,10 @@ class SpaceMenuListViewCell: UITableViewCell, SpaceMenuCell, NibReusable {
self.titleLabel.textColor = theme.colors.primaryContent
self.iconView.tintColor = theme.colors.secondaryContent
}
self.betaView.layer.masksToBounds = true
self.betaView.layer.cornerRadius = 4
self.betaView.isHidden = !viewData.isBeta
}
func update(theme: Theme) {
@@ -73,5 +79,8 @@ class SpaceMenuListViewCell: UITableViewCell, SpaceMenuCell, NibReusable {
self.titleLabel.textColor = theme.colors.primaryContent
self.titleLabel.font = theme.fonts.body
self.selectionView.backgroundColor = theme.colors.separator
self.betaLabel.font = theme.fonts.caption2SB
self.betaLabel.textColor = theme.colors.secondaryContent
self.betaView.backgroundColor = theme.colors.quinaryContent
}
}
@@ -25,12 +25,30 @@
<constraint firstAttribute="height" constant="48" id="f1L-gQ-B6g"/>
</constraints>
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="SSn-E2-PZK">
<rect key="frame" x="54" y="21.5" width="250" height="21"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="SSn-E2-PZK">
<rect key="frame" x="54" y="21.5" width="193" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="geg-4t-FiC">
<rect key="frame" x="255" y="19.5" width="49" height="25"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="BETA" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dzE-nd-zEE">
<rect key="frame" x="4" y="2" width="41" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstItem="dzE-nd-zEE" firstAttribute="leading" secondItem="geg-4t-FiC" secondAttribute="leading" constant="4" id="G6W-P8-1qV"/>
<constraint firstAttribute="trailing" secondItem="dzE-nd-zEE" secondAttribute="trailing" constant="4" id="Ka7-Y4-F62"/>
<constraint firstAttribute="bottom" secondItem="dzE-nd-zEE" secondAttribute="bottom" constant="2" id="awT-GP-Omf"/>
<constraint firstItem="dzE-nd-zEE" firstAttribute="top" secondItem="geg-4t-FiC" secondAttribute="top" constant="2" id="fte-cV-0l2"/>
</constraints>
</view>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="lGB-4z-4VR">
<rect key="frame" x="16" y="21" width="22" height="22"/>
<constraints>
@@ -42,10 +60,12 @@
<constraints>
<constraint firstItem="YQF-X2-MAf" firstAttribute="top" secondItem="kRV-oW-j2b" secondAttribute="top" constant="8" id="0nO-xV-wrC"/>
<constraint firstAttribute="trailing" secondItem="YQF-X2-MAf" secondAttribute="trailing" constant="8" id="4pu-1l-NUB"/>
<constraint firstAttribute="trailing" secondItem="SSn-E2-PZK" secondAttribute="trailing" constant="16" id="9Ql-U0-iqV"/>
<constraint firstItem="lGB-4z-4VR" firstAttribute="leading" secondItem="kRV-oW-j2b" secondAttribute="leading" constant="16" id="9mJ-4Y-VXF"/>
<constraint firstItem="YQF-X2-MAf" firstAttribute="leading" secondItem="kRV-oW-j2b" secondAttribute="leading" constant="8" id="Dlx-2U-0pd"/>
<constraint firstAttribute="trailing" secondItem="geg-4t-FiC" secondAttribute="trailing" constant="16" id="MCa-Cr-Ytx"/>
<constraint firstItem="geg-4t-FiC" firstAttribute="centerY" secondItem="SSn-E2-PZK" secondAttribute="centerY" id="ccE-qZ-Nj3"/>
<constraint firstAttribute="bottom" secondItem="YQF-X2-MAf" secondAttribute="bottom" constant="8" id="fTw-ef-WYp"/>
<constraint firstItem="geg-4t-FiC" firstAttribute="leading" secondItem="SSn-E2-PZK" secondAttribute="trailing" constant="8" id="jOq-4W-byc"/>
<constraint firstItem="SSn-E2-PZK" firstAttribute="centerY" secondItem="kRV-oW-j2b" secondAttribute="centerY" id="jwX-PQ-zct"/>
<constraint firstItem="lGB-4z-4VR" firstAttribute="centerY" secondItem="kRV-oW-j2b" secondAttribute="centerY" id="rCq-Wx-cnB"/>
<constraint firstItem="SSn-E2-PZK" firstAttribute="leading" secondItem="lGB-4z-4VR" secondAttribute="trailing" constant="16" id="u3q-k9-r0F"/>
@@ -53,6 +73,8 @@
</tableViewCellContentView>
<viewLayoutGuide key="safeArea" id="0Tk-ek-Uxc"/>
<connections>
<outlet property="betaLabel" destination="dzE-nd-zEE" id="j1O-pO-ym6"/>
<outlet property="betaView" destination="geg-4t-FiC" id="c7b-Hw-TZ8"/>
<outlet property="iconView" destination="lGB-4z-4VR" id="tEM-vI-I3c"/>
<outlet property="selectionView" destination="YQF-X2-MAf" id="Y3z-Ug-Lrc"/>
<outlet property="titleLabel" destination="SSn-E2-PZK" id="bS7-F2-Tfb"/>
@@ -24,6 +24,9 @@ class SpaceMenuPresenter: NSObject {
enum Actions {
case exploreRooms
case exploreMembers
case addRoom
case addSpace
case settings
}
// MARK: - Properties
@@ -108,6 +111,12 @@ extension SpaceMenuPresenter: SpaceMenuModelViewModelCoordinatorDelegate {
self.delegate?.spaceMenuPresenter(self, didCompleteWith: .exploreMembers, forSpaceWithId: self.spaceId, with: self.session)
case .exploreSpaceRooms:
self.delegate?.spaceMenuPresenter(self, didCompleteWith: .exploreRooms, forSpaceWithId: self.spaceId, with: self.session)
case .addRoom:
self.delegate?.spaceMenuPresenter(self, didCompleteWith: .addRoom, forSpaceWithId: self.spaceId, with: self.session)
case .addSpace:
self.delegate?.spaceMenuPresenter(self, didCompleteWith: .addSpace, forSpaceWithId: self.spaceId, with: self.session)
case .settings:
self.delegate?.spaceMenuPresenter(self, didCompleteWith: .settings, forSpaceWithId: self.spaceId, with: self.session)
default:
MXLog.error("[SpaceMenuPresenter] spaceListViewModel didSelectItem: invalid action \(action)")
}
@@ -27,6 +27,9 @@ class SpaceMenuViewModel: SpaceMenuViewModelType {
private let spaceMenuItems: [SpaceMenuListItemViewData] = [
SpaceMenuListItemViewData(action: .exploreSpaceMembers, style: .normal, title: VectorL10n.roomDetailsPeople, icon: Asset.Images.spaceMenuMembers.image, value: nil),
SpaceMenuListItemViewData(action: .exploreSpaceRooms, style: .normal, title: VectorL10n.spacesExploreRooms, icon: Asset.Images.spaceMenuRooms.image, value: nil),
SpaceMenuListItemViewData(action: .addRoom, style: .normal, title: VectorL10n.spacesAddRoom, icon: Asset.Images.spaceMenuPlusIcon.image, value: nil),
SpaceMenuListItemViewData(action: .addSpace, style: .normal, title: VectorL10n.spacesAddSpace, icon: Asset.Images.spaceMenuPlusIcon.image, value: nil, isBeta: true),
SpaceMenuListItemViewData(action: .settings, style: .normal, title: VectorL10n.sideMenuActionSettings, icon: Asset.Images.sideMenuActionIconSettings.image, value: nil),
SpaceMenuListItemViewData(action: .leaveSpace, style: .destructive, title: VectorL10n.leave, icon: Asset.Images.spaceMenuLeave.image, value: nil)
]