Skip to content

Commit

Permalink
Space panel overflow journeys & rough edge warnings #5227
Browse files Browse the repository at this point in the history
- space menu additions according to new requirements
  • Loading branch information
gileluard committed Dec 10, 2021
1 parent bf642c1 commit badba94
Show file tree
Hide file tree
Showing 13 changed files with 91 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"images" : [
{
"filename" : "space_menu_plus_icon.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "template"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions Riot/Assets/en.lproj/Vector.strings
Original file line number Diff line number Diff line change
Expand Up @@ -1747,6 +1747,7 @@ Tap the + to start adding people.";
"space_public_join_rule" = "Public space";
"spaces_invite_people" = "Invite people";
"spaces_add_room" = "Add room";
"spaces_add_space" = "Add space";

// Mark: Avatar

Expand Down
1 change: 1 addition & 0 deletions Riot/Generated/Images.swift
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ internal enum Asset {
internal static let spaceMenuClose = ImageAsset(name: "space_menu_close")
internal static let spaceMenuLeave = ImageAsset(name: "space_menu_leave")
internal static let spaceMenuMembers = ImageAsset(name: "space_menu_members")
internal static let spaceMenuPlusIcon = ImageAsset(name: "space_menu_plus_icon")
internal static let spaceMenuRooms = ImageAsset(name: "space_menu_rooms")
internal static let spacePrivateIcon = ImageAsset(name: "space_private_icon")
internal static let spaceRoomIcon = ImageAsset(name: "space_room_icon")
Expand Down
4 changes: 4 additions & 0 deletions Riot/Generated/Strings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4999,6 +4999,10 @@ public class VectorL10n: NSObject {
public static var spacesAddRoomsComingSoonTitle: String {
return VectorL10n.tr("Vector", "spaces_add_rooms_coming_soon_title")
}
/// Add space
public static var spacesAddSpace: String {
return VectorL10n.tr("Vector", "spaces_add_space")
}
/// This feature hasn’t been implemented here, but it’s on the way. For now, you can do that with Element on your computer.
public static var spacesComingSoonDetail: String {
return VectorL10n.tr("Vector", "spaces_coming_soon_detail")
Expand Down
6 changes: 6 additions & 0 deletions Riot/Modules/SideMenu/SideMenuCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,12 @@ extension SideMenuCoordinator: SpaceMenuPresenterDelegate {
self.showExploreRooms(spaceId: spaceId, session: session)
case .exploreMembers:
self.showMembers(spaceId: spaceId, session: session)
case .addRoom:
AppDelegate.theDelegate().showAlert(withTitle: VectorL10n.spacesAddRoom, message: VectorL10n.spacesComingSoonDetail)
case .addSpace:
AppDelegate.theDelegate().showAlert(withTitle: VectorL10n.spacesAddSpace, message: VectorL10n.spacesComingSoonDetail)
case .settings:
AppDelegate.theDelegate().showAlert(withTitle: VectorL10n.sideMenuActionSettings, message: VectorL10n.spacesComingSoonDetail)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ enum SpaceMenuListItemAction {
case showAllRoomsInHomeSpace
case exploreSpaceMembers
case exploreSpaceRooms
case addRoom
case addSpace
case settings
case leaveSpace
}

Expand All @@ -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 {
Expand All @@ -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
}
}
9 changes: 9 additions & 0 deletions Riot/Modules/Spaces/SpaceMenu/SpaceMenuListViewCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand All @@ -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
}
}
28 changes: 25 additions & 3 deletions Riot/Modules/Spaces/SpaceMenu/SpaceMenuListViewCell.xib
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -42,17 +60,21 @@
<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"/>
</constraints>
</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"/>
Expand Down
9 changes: 9 additions & 0 deletions Riot/Modules/Spaces/SpaceMenu/SpaceMenuPresenter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ class SpaceMenuPresenter: NSObject {
enum Actions {
case exploreRooms
case exploreMembers
case addRoom
case addSpace
case settings
}

// MARK: - Properties
Expand Down Expand Up @@ -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)")
}
Expand Down
3 changes: 3 additions & 0 deletions Riot/Modules/Spaces/SpaceMenu/SpaceMenuViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
]

Expand Down

0 comments on commit badba94

Please sign in to comment.