Merge pull request #6604 from vector-im/gil/6600-Room_invites_in_the_all_chats

New App Layout: added suppport for room invites in the all chats screen
This commit is contained in:
Gil Eluard
2022-08-22 16:40:19 +02:00
committed by GitHub
14 changed files with 535 additions and 60 deletions
+28 -1
View File
@@ -503,9 +503,36 @@
</objects>
<point key="canvasLocation" x="-153" y="-419"/>
</scene>
<!--Room Invites View Controller-->
<scene sceneID="ied-3I-huo">
<objects>
<viewController storyboardIdentifier="RoomInvitesViewController" extendedLayoutIncludesOpaqueBars="YES" id="BYq-qZ-orN" customClass="RoomInvitesViewController" customModule="Element" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="NpE-qA-EJG"/>
<viewControllerLayoutGuide type="bottom" id="N2q-zt-KdC"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="Ln5-wB-A9e">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</view>
<tabBarItem key="tabBarItem" title="" image="tab_home" id="vSs-0M-T3r">
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="accessibilityIdentifier" value="TabBarItemHome"/>
</userDefinedRuntimeAttributes>
</tabBarItem>
<navigationItem key="navigationItem" id="FIq-cg-lge"/>
<connections>
<segue destination="WDS-Ip-RQ9" kind="presentation" identifier="presentStartChat" id="rok-Xg-Mhx"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="r4V-Xa-ZoW" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="2734" y="-2050"/>
</scene>
</scenes>
<inferredMetricsTieBreakers>
<segue reference="y6u-0X-urR"/>
<segue reference="rok-Xg-Mhx"/>
</inferredMetricsTieBreakers>
<resources>
<image name="launch_screen_logo" width="240" height="240"/>
@@ -35,6 +35,7 @@ typedef NS_ENUM(NSInteger, RecentsDataSourceMode)
RecentsDataSourceModeFavourites,
RecentsDataSourceModePeople,
RecentsDataSourceModeRooms,
RecentsDataSourceModeRoomInvites,
RecentsDataSourceModeAllChats
};
@@ -174,6 +174,12 @@ NSString *const kRecentsDataSourceTapOnDirectoryServerChange = @"kRecentsDataSou
- (RecentsDataSourceSections *)makeDataSourceSections
{
NSMutableArray *types = [NSMutableArray array];
if (self.recentsDataSourceMode == RecentsDataSourceModeRoomInvites)
{
[types addObject:@(RecentsDataSourceSectionTypeInvites)];
return [[RecentsDataSourceSections alloc] initWithSectionTypes:types.copy];
}
if (self.crossSigningBannerDisplay != CrossSigningBannerDisplayNone)
{
[types addObject:@(RecentsDataSourceSectionTypeCrossSigningBanner)];
@@ -183,7 +189,7 @@ NSString *const kRecentsDataSourceTapOnDirectoryServerChange = @"kRecentsDataSou
[types addObject:@(RecentsDataSourceSectionTypeSecureBackupBanner)];
}
if (!BuildSettings.newAppLayoutEnabled && self.invitesCellDataArray.count > 0)
if (self.invitesCellDataArray.count > 0)
{
[types addObject:@(RecentsDataSourceSectionTypeInvites)];
}
@@ -229,11 +235,6 @@ NSString *const kRecentsDataSourceTapOnDirectoryServerChange = @"kRecentsDataSou
[types addObject:@(RecentsDataSourceSectionTypeAllChats)];
}
if (self.currentSpace == nil && BuildSettings.newAppLayoutEnabled && self.invitesCellDataArray.count > 0)
{
[types addObject:@(RecentsDataSourceSectionTypeInvites)];
}
if (self.currentSpace != nil && self.suggestedRoomCellDataArray.count > 0)
{
[types addObject:@(RecentsDataSourceSectionTypeSuggestedRooms)];
@@ -625,7 +626,13 @@ NSString *const kRecentsDataSourceTapOnDirectoryServerChange = @"kRecentsDataSou
}
else if (sectionType == RecentsDataSourceSectionTypeInvites && !(shrinkedSectionsBitMask & RECENTSDATASOURCE_SECTION_INVITES))
{
count = self.invitesCellDataArray.count;
if (self.recentsDataSourceMode == RecentsDataSourceModeAllChats)
{
count = 1;
}
else {
count = self.invitesCellDataArray.count;
}
}
else if (sectionType == RecentsDataSourceSectionTypeSuggestedRooms && !(shrinkedSectionsBitMask & RECENTSDATASOURCE_SECTION_SUGGESTED))
{
@@ -660,6 +667,7 @@ NSString *const kRecentsDataSourceTapOnDirectoryServerChange = @"kRecentsDataSou
if (sectionType == RecentsDataSourceSectionTypeSecureBackupBanner ||
sectionType == RecentsDataSourceSectionTypeCrossSigningBanner ||
sectionType == RecentsDataSourceSectionTypeBreadcrumbs ||
(sectionType == RecentsDataSourceSectionTypeInvites && self.recentsDataSourceMode == RecentsDataSourceModeAllChats) ||
(sectionType == RecentsDataSourceSectionTypeAllChats && !self.allChatsFilterOptions.optionsCount))
{
return 0.0;
@@ -859,6 +867,7 @@ NSString *const kRecentsDataSourceTapOnDirectoryServerChange = @"kRecentsDataSou
if (sectionType == RecentsDataSourceSectionTypeSecureBackupBanner ||
sectionType == RecentsDataSourceSectionTypeCrossSigningBanner ||
sectionType == RecentsDataSourceSectionTypeBreadcrumbs ||
(sectionType == RecentsDataSourceSectionTypeInvites && self.recentsDataSourceMode == RecentsDataSourceModeRoomInvites) ||
(sectionType == RecentsDataSourceSectionTypeAllChats && !self.allChatsFilterOptions.optionsCount))
{
return nil;
@@ -1088,6 +1097,14 @@ NSString *const kRecentsDataSourceTapOnDirectoryServerChange = @"kRecentsDataSou
return tableViewCell;
}
else if (sectionType == RecentsDataSourceSectionTypeInvites && self.recentsDataSourceMode == RecentsDataSourceModeAllChats)
{
RecentsInvitesTableViewCell *tableViewCell = [tableView dequeueReusableCellWithIdentifier:[RecentsInvitesTableViewCell defaultReuseIdentifier]];
tableViewCell.invitesCount = self.recentsListService.invitedRoomListData.counts.numberOfRooms;
return tableViewCell;
}
return [super tableView:tableView cellForRowAtIndexPath:indexPath];
}
@@ -1199,6 +1216,10 @@ NSString *const kRecentsDataSourceTapOnDirectoryServerChange = @"kRecentsDataSou
if (sectionType == RecentsDataSourceSectionTypeAllChats && !self.allChatsRoomCellDataArray.count) {
return 300.0;
}
if (sectionType == RecentsDataSourceSectionTypeInvites && self.recentsDataSourceMode == RecentsDataSourceModeAllChats)
{
return 32.0;
}
// Override this method here to use our own cellDataAtIndexPath
id<MXKRecentCellDataStoring> cellData = [self cellDataAtIndexPath:indexPath];
@@ -1509,7 +1530,7 @@ NSString *const kRecentsDataSourceTapOnDirectoryServerChange = @"kRecentsDataSou
- (BOOL)isDraggableCellAt:(NSIndexPath*)path
{
if (_recentsDataSourceMode == RecentsDataSourceModePeople || _recentsDataSourceMode == RecentsDataSourceModeRooms)
if (_recentsDataSourceMode == RecentsDataSourceModePeople || _recentsDataSourceMode == RecentsDataSourceModeRooms || _recentsDataSourceMode == RecentsDataSourceModeRoomInvites)
{
return NO;
}
@@ -35,7 +35,7 @@ public class RecentsListService: NSObject, RecentsListServiceProtocol {
private var invitedRoomListDataFetcher: MXRoomListDataFetcher? {
switch mode {
case .home, .allChats:
case .home, .allChats, .roomInvites:
return invitedRoomListDataFetcherForHome
case .people:
return invitedRoomListDataFetcherForPeople
@@ -87,6 +87,7 @@ public class RecentsListService: NSObject, RecentsListServiceProtocol {
.favourites: [.favorited],
.people: [.invited, .directPeople],
.rooms: [.invited, .conversationRooms, .suggested],
.roomInvites: [.invited],
.allChats: [.breadcrumbs, .favorited, .directHome, .invited, .allChats, .lowPriority, .serverNotice, .suggested]
]
@@ -0,0 +1,71 @@
//
// Copyright 2022 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
import UIKit
import Reusable
/// `RecentsInvitesTableViewCell` can be used as a placeholder to show invites number
class RecentsInvitesTableViewCell: UITableViewCell, NibReusable, Themable {
// MARK: - Outlet
@IBOutlet weak private var badgeLabel: BadgeLabel!
@IBOutlet weak private var titleLabel: UILabel!
// MARK: - Properties
@objc var invitesCount: Int = 0 {
didSet {
badgeLabel.text = "\(invitesCount)"
}
}
// MARK: - NibReusable
@objc static func defaultReuseIdentifier() -> String {
return reuseIdentifier
}
// MARK: - Life cycle
override func awakeFromNib() {
super.awakeFromNib()
setupView()
update(theme: ThemeService.shared().theme)
}
// MARK: - Themable
func update(theme: Theme) {
self.backgroundColor = theme.colors.background
badgeLabel.badgeColor = theme.colors.alert
badgeLabel.textColor = theme.colors.background
badgeLabel.font = theme.fonts.footnoteSB
titleLabel.textColor = theme.colors.accent
}
// MARK: - Private
private func setupView() {
self.selectionStyle = .none
titleLabel.text = VectorL10n.roomRecentsInvitesSection.capitalized
update(theme: ThemeService.shared().theme)
}
}
@@ -0,0 +1,58 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="20037" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="20020"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" rowHeight="44" id="L2L-l5-wPx" customClass="RecentsInvitesTableViewCell" customModule="Element" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="403" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="L2L-l5-wPx" id="aXz-IR-jj5">
<rect key="frame" x="0.0" y="0.0" width="403" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="14" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="v7o-A4-W0T" customClass="BadgeLabel" customModule="Element" customModuleProvider="target">
<rect key="frame" x="369" y="12" width="18" height="20.5"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="size" keyPath="padding">
<size key="value" width="13" height="2"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Invites" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="eXI-UE-lYe">
<rect key="frame" x="311" y="12" width="50" height="20.5"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstItem="v7o-A4-W0T" firstAttribute="centerY" secondItem="aXz-IR-jj5" secondAttribute="centerY" id="8up-Mj-fMw"/>
<constraint firstItem="v7o-A4-W0T" firstAttribute="leading" secondItem="eXI-UE-lYe" secondAttribute="trailing" constant="8" id="UoH-jb-QUq"/>
<constraint firstAttribute="trailing" secondItem="v7o-A4-W0T" secondAttribute="trailing" constant="16" id="cbs-0p-bQh"/>
<constraint firstItem="eXI-UE-lYe" firstAttribute="centerY" secondItem="aXz-IR-jj5" secondAttribute="centerY" id="pdw-2c-vG6"/>
</constraints>
</tableViewCellContentView>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<accessibility key="accessibilityConfiguration" identifier="RecentTableViewCell"/>
<connections>
<outlet property="badgeLabel" destination="v7o-A4-W0T" id="O6d-wK-nKA"/>
<outlet property="titleLabel" destination="eXI-UE-lYe" id="w0P-0Z-dd8"/>
</connections>
<point key="canvasLocation" x="-324" y="-71.964017991004496"/>
</tableViewCell>
</objects>
<designables>
<designable name="v7o-A4-W0T">
<size key="intrinsicContentSize" width="18" height="20.5"/>
</designable>
</designables>
</document>
@@ -56,7 +56,8 @@ class AllChatsViewController: HomeViewController {
recentsTableView.tag = RecentsDataSourceMode.allChats.rawValue
recentsTableView.clipsToBounds = false
recentsTableView.register(RecentEmptySectionTableViewCell.nib, forCellReuseIdentifier: RecentEmptySectionTableViewCell.reuseIdentifier)
recentsTableView.register(RecentsInvitesTableViewCell.nib, forCellReuseIdentifier: RecentsInvitesTableViewCell.reuseIdentifier)
updateUI()
vc_setLargeTitleDisplayMode(.automatic)
@@ -127,6 +128,51 @@ class AllChatsViewController: HomeViewController {
self.spaceSelectorBridgePresenter = spaceSelectorBridgePresenter
}
// MARK: - UITableViewDataSource
private func sectionType(forSectionAt index: Int) -> RecentsDataSourceSectionType? {
guard let recentsDataSource = dataSource as? RecentsDataSource else {
return nil
}
return recentsDataSource.sections.sectionType(forSectionIndex: index)
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
guard let sectionType = sectionType(forSectionAt: section), sectionType == .invites else {
return super.tableView(tableView, numberOfRowsInSection: section)
}
return dataSource.tableView(tableView, numberOfRowsInSection: section)
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
guard let sectionType = sectionType(forSectionAt: indexPath.section), sectionType == .invites else {
return super.tableView(tableView, cellForRowAt: indexPath)
}
return dataSource.tableView(tableView, cellForRowAt: indexPath)
}
// MARK: - UITableViewDelegate
override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
guard let sectionType = sectionType(forSectionAt: indexPath.section), sectionType == .invites else {
return super.tableView(tableView, heightForRowAt: indexPath)
}
return dataSource.cellHeight(at: indexPath)
}
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
guard let sectionType = sectionType(forSectionAt: indexPath.section), sectionType == .invites else {
super.tableView(tableView, didSelectRowAt: indexPath)
return
}
showRoomInviteList()
}
// MARK: - Toolbar animation
private var lastScrollPosition: Double = 0
@@ -385,6 +431,16 @@ class AllChatsViewController: HomeViewController {
}
present(coordinator.toPresentable(), animated: true)
}
private func showRoomInviteList() {
let invitesViewController = RoomInvitesViewController.instantiate()
invitesViewController.userIndicatorStore = self.userIndicatorStore
// invitesViewController.displayList(self.dataSource)
let recentsListService = RecentsListService(withSession: mainSession)
let recentsDataSource = RecentsDataSource(matrixSession: mainSession, recentsListService: recentsListService)
invitesViewController.displayList(recentsDataSource)
self.navigationController?.pushViewController(invitesViewController, animated: true)
}
}
// MARK: - SpaceSelectorBottomSheetCoordinatorBridgePresenterDelegate
@@ -0,0 +1,127 @@
//
// Copyright 2022 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
import Foundation
class RoomInvitesViewController: RecentsViewController {
// MARK: - Class methods
static override func nib() -> UINib! {
return UINib(nibName: String(describing: self), bundle: Bundle(for: self.classForCoder()))
}
static func instantiate() -> Self {
let storyboard = UIStoryboard(name: "Main", bundle: .main)
guard let viewController = storyboard.instantiateViewController(withIdentifier: "RoomInvitesViewController") as? Self else {
fatalError("No view controller of type \(self) in the main storyboard")
}
return viewController
}
// MARK: - Private
private var recentsDataSource: RecentsDataSource?
private var tableViewPaginationThrottler: MXThrottler!
// MARK: - Lifecycle
override func awakeFromNib() {
super.awakeFromNib()
self.enableSearchBar = false
}
override func viewDidLoad() {
super.viewDidLoad()
self.recentsTableView.clipsToBounds = false
self.recentsTableView.tag = RecentsDataSourceMode.roomInvites.rawValue
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
guard let recentsDataSource = self.dataSource as? RecentsDataSource else {
return
}
self.recentsDataSource = recentsDataSource
if recentsDataSource.recentsDataSourceMode != .roomInvites {
recentsDataSource.setDelegate(self, andRecentsDataSourceMode: .roomInvites)
recentsDataSource.search(withPatterns: nil)
recentsSearchBar?.text = nil
}
}
// MARK: - RecentsViewController
override func finalizeInit() {
super.finalizeInit()
title = VectorL10n.roomRecentsInvitesSection.capitalized
// TODO: add right screen tracker
// self.screenTracker = AnalyticsScreenTracker(screen: .rooms)
tableViewPaginationThrottler = MXThrottler(minimumDelay: 0.1)
}
override func refreshCurrentSelectedCell(_ forceVisible: Bool) {
// Check whether the recents data source is correctly configured.
guard self.recentsDataSource?.recentsDataSourceMode == .roomInvites else {
return
}
super.refreshCurrentSelectedCell(forceVisible)
}
// MARK: - UITableViewDelegate
override func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
return 0
}
override func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
super.tableView(tableView, willDisplay: cell, forRowAt: indexPath)
tableViewPaginationThrottler .throttle { [weak self] in
guard let self = self, tableView.numberOfSections > indexPath.section else {
return
}
let numberOfRowsInSection = tableView.numberOfRows(inSection: indexPath.section)
if indexPath.row == numberOfRowsInSection - 1 {
self.recentsDataSource?.paginate(inSection: indexPath.section)
}
}
}
// MARK: - Empty view management
override func updateEmptyView() {
emptyView?.fill(with: self.emptyViewArtwork,
title: VectorL10n.roomsEmptyViewTitle,
informationText: VectorL10n.roomsEmptyViewInformation)
}
private var emptyViewArtwork: UIImage {
if ThemeService.shared().isCurrentThemeDark() {
return Asset.Images.roomsEmptyScreenArtworkDark.image
} else {
return Asset.Images.roomsEmptyScreenArtwork.image
}
}
}
@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="UTF-8"?>
<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="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="20020"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="RoomInvitesViewController" customModule="Element" customModuleProvider="target">
<connections>
<outlet property="recentsTableView" destination="orV-HH-88x" id="lgA-2k-pXJ"/>
<outlet property="stickyHeadersBottomContainer" destination="EXH-mK-0eB" id="95Y-KP-bwF"/>
<outlet property="stickyHeadersBottomContainerHeightConstraint" destination="SNq-Js-N7s" id="vom-iM-s6W"/>
<outlet property="stickyHeadersTopContainer" destination="JJC-Bw-6sa" id="JIy-sf-4Ya"/>
<outlet property="stickyHeadersTopContainerHeightConstraint" destination="xT1-rL-nCC" id="VaK-0W-2Mi"/>
<outlet property="view" destination="iN0-l3-epB" id="NUQ-LI-M61"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="iN0-l3-epB">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" keyboardDismissMode="onDrag" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" translatesAutoresizingMaskIntoConstraints="NO" id="orV-HH-88x">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</tableView>
<view clipsSubviews="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="JJC-Bw-6sa">
<rect key="frame" x="0.0" y="0.0" width="375" height="0.0"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<accessibility key="accessibilityConfiguration" identifier="RecentsVCStickyHeadersTopContainer"/>
<constraints>
<constraint firstAttribute="height" id="xT1-rL-nCC"/>
</constraints>
</view>
<view clipsSubviews="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="EXH-mK-0eB">
<rect key="frame" x="0.0" y="667" width="375" height="0.0"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<accessibility key="accessibilityConfiguration" identifier="RecentsVCStickyHeadersBottomContainer"/>
<constraints>
<constraint firstAttribute="height" id="SNq-Js-N7s"/>
</constraints>
</view>
</subviews>
<viewLayoutGuide key="safeArea" id="4qf-KS-Fc9"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="orV-HH-88x" secondAttribute="trailing" id="3Np-64-AUe"/>
<constraint firstItem="4qf-KS-Fc9" firstAttribute="bottom" secondItem="orV-HH-88x" secondAttribute="bottom" id="Bka-Zz-CEr"/>
<constraint firstItem="orV-HH-88x" firstAttribute="top" secondItem="JJC-Bw-6sa" secondAttribute="bottom" id="IMR-dV-gUS"/>
<constraint firstItem="EXH-mK-0eB" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="bottom" id="Kmg-aC-GOO"/>
<constraint firstItem="JJC-Bw-6sa" firstAttribute="top" secondItem="4qf-KS-Fc9" secondAttribute="top" id="OBu-sH-mqE"/>
<constraint firstItem="EXH-mK-0eB" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="S3i-DW-PUB"/>
<constraint firstAttribute="trailing" secondItem="EXH-mK-0eB" secondAttribute="trailing" id="bPP-yu-FTa"/>
<constraint firstItem="orV-HH-88x" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="dTn-zC-Axs"/>
<constraint firstItem="JJC-Bw-6sa" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="l5C-zt-Env"/>
<constraint firstAttribute="trailing" secondItem="JJC-Bw-6sa" secondAttribute="trailing" id="trw-3x-yjO"/>
</constraints>
<point key="canvasLocation" x="140" y="137.18140929535232"/>
</view>
</objects>
</document>
@@ -221,5 +221,15 @@ typedef enum : NSUInteger {
*/
- (BOOL)dataSource:(MXKDataSource*)dataSource shouldDoAction:(NSString *)actionIdentifier inCell:(id<MXKCellRendering>)cell userInfo:(NSDictionary *)userInfo defaultValue:(BOOL)defaultValue;
/**
Notify the delegate that invites count did change
@see `MXKCellRenderingDelegate` for more details.
@param dataSource the involved data source.
@param invitesCount number of rooms in the invites section.
*/
- (void)dataSource:(MXKDataSource*)dataSource didUpdateInvitesCount:(NSUInteger)invitesCount;
@end
@@ -40,12 +40,12 @@ NSString *const kInviteRecentTableViewCellRoomKey = @"kInviteRecentTableViewCell
{
[super awakeFromNib];
[self.leftButton.layer setCornerRadius:5];
[self.leftButton.layer setCornerRadius:8];
self.leftButton.clipsToBounds = YES;
[self.leftButton setTitle:[VectorL10n decline] forState:UIControlStateNormal];
[self.leftButton addTarget:self action:@selector(onDeclinePressed:) forControlEvents:UIControlEventTouchUpInside];
[self.rightButton.layer setCornerRadius:5];
[self.rightButton.layer setCornerRadius:8];
self.rightButton.clipsToBounds = YES;
[self.rightButton setTitle:[VectorL10n accept] forState:UIControlStateNormal];
[self.rightButton addTarget:self action:@selector(onRightButtonPressed:) forControlEvents:UIControlEventTouchUpInside];
@@ -57,8 +57,14 @@ NSString *const kInviteRecentTableViewCellRoomKey = @"kInviteRecentTableViewCell
{
[super customizeTableViewCellRendering];
self.leftButton.backgroundColor = ThemeService.shared.theme.tintColor;
self.leftButton.backgroundColor = UIColor.clearColor;
self.leftButton.layer.borderWidth = 1;
self.leftButton.layer.borderColor = ThemeService.shared.theme.colors.alert.CGColor;
self.leftButton.titleLabel.font = ThemeService.shared.theme.fonts.body;
[self.leftButton setTitleColor:ThemeService.shared.theme.colors.alert forState:UIControlStateNormal];
self.rightButton.backgroundColor = ThemeService.shared.theme.tintColor;
self.rightButton.titleLabel.font = ThemeService.shared.theme.fonts.body;
}
- (void)prepareForReuse
@@ -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" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="20037" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" 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="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
@@ -45,50 +45,68 @@
<color key="textColor" red="0.66666666666666663" green="0.66666666666666663" blue="0.66666666666666663" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="tjf-WP-vTl" userLabel="buttonsContainer">
<rect key="frame" x="68" y="65" width="478" height="30"/>
<stackView opaque="NO" contentMode="scaleToFill" distribution="fillEqually" spacing="12" translatesAutoresizingMaskIntoConstraints="NO" id="DAj-sJ-hVs">
<rect key="frame" x="68" y="65" width="492" height="30"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Fc3-Id-aaG" userLabel="Left Button">
<rect key="frame" x="0.0" y="0.0" width="229.5" height="30"/>
<color key="backgroundColor" red="0.028153735480000001" green="0.82494870580000002" blue="0.051896891280000003" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<accessibility key="accessibilityConfiguration" identifier="LeftButton"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="16"/>
<state key="normal" title="Left button">
<color key="titleColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="lGf-lB-FsE" userLabel="Right Button">
<rect key="frame" x="248.5" y="0.0" width="229.5" height="30"/>
<color key="backgroundColor" red="0.028153735480000001" green="0.82494870580000002" blue="0.051896891280000003" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<accessibility key="accessibilityConfiguration" identifier="RightButton"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="16"/>
<state key="normal" title="Right Button">
<color key="titleColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
</button>
<activityIndicatorView opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" hidesWhenStopped="YES" style="medium" translatesAutoresizingMaskIntoConstraints="NO" id="CzJ-mZ-Ryu">
<rect key="frame" x="104.5" y="5" width="20" height="20"/>
</activityIndicatorView>
<activityIndicatorView opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" hidesWhenStopped="YES" style="medium" translatesAutoresizingMaskIntoConstraints="NO" id="f3G-yI-qc9">
<rect key="frame" x="353.5" y="5" width="20" height="20"/>
</activityIndicatorView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="PeP-hh-VcH">
<rect key="frame" x="0.0" y="0.0" width="240" height="30"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Fc3-Id-aaG" userLabel="Left Button">
<rect key="frame" x="0.0" y="0.0" width="240" height="30"/>
<color key="backgroundColor" red="0.028153735480000001" green="0.82494870580000002" blue="0.051896891280000003" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<accessibility key="accessibilityConfiguration" identifier="LeftButton"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="16"/>
<inset key="contentEdgeInsets" minX="12" minY="0.0" maxX="12" maxY="0.0"/>
<state key="normal" title="Left button">
<color key="titleColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
</button>
<activityIndicatorView opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" hidesWhenStopped="YES" style="medium" translatesAutoresizingMaskIntoConstraints="NO" id="CzJ-mZ-Ryu">
<rect key="frame" x="110" y="5" width="20" height="20"/>
</activityIndicatorView>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="bottom" secondItem="Fc3-Id-aaG" secondAttribute="bottom" id="903-h6-cZB"/>
<constraint firstAttribute="trailing" secondItem="Fc3-Id-aaG" secondAttribute="trailing" id="9II-Un-fXK"/>
<constraint firstItem="CzJ-mZ-Ryu" firstAttribute="centerY" secondItem="PeP-hh-VcH" secondAttribute="centerY" id="Loc-9i-5vw"/>
<constraint firstItem="Fc3-Id-aaG" firstAttribute="leading" secondItem="PeP-hh-VcH" secondAttribute="leading" id="ccf-Lk-blr"/>
<constraint firstItem="CzJ-mZ-Ryu" firstAttribute="centerX" secondItem="PeP-hh-VcH" secondAttribute="centerX" id="hHh-5M-t3r"/>
<constraint firstItem="Fc3-Id-aaG" firstAttribute="top" secondItem="PeP-hh-VcH" secondAttribute="top" id="scu-Q8-xtY"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="V61-yT-51L">
<rect key="frame" x="252" y="0.0" width="240" height="30"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="lGf-lB-FsE" userLabel="Right Button">
<rect key="frame" x="0.0" y="0.0" width="240" height="30"/>
<color key="backgroundColor" red="0.028153735480000001" green="0.82494870580000002" blue="0.051896891280000003" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<accessibility key="accessibilityConfiguration" identifier="RightButton"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="16"/>
<inset key="contentEdgeInsets" minX="12" minY="0.0" maxX="12" maxY="0.0"/>
<state key="normal" title="Right Button">
<color key="titleColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
</button>
<activityIndicatorView opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" hidesWhenStopped="YES" style="medium" translatesAutoresizingMaskIntoConstraints="NO" id="f3G-yI-qc9">
<rect key="frame" x="110" y="5" width="20" height="20"/>
</activityIndicatorView>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="lGf-lB-FsE" secondAttribute="trailing" id="H0D-ua-BSD"/>
<constraint firstItem="lGf-lB-FsE" firstAttribute="leading" secondItem="V61-yT-51L" secondAttribute="leading" id="Tgi-On-PAj"/>
<constraint firstAttribute="bottom" secondItem="lGf-lB-FsE" secondAttribute="bottom" id="j39-do-JK6"/>
<constraint firstItem="f3G-yI-qc9" firstAttribute="centerY" secondItem="V61-yT-51L" secondAttribute="centerY" id="j3A-oc-NXn"/>
<constraint firstItem="f3G-yI-qc9" firstAttribute="centerX" secondItem="V61-yT-51L" secondAttribute="centerX" id="yjf-us-r9C"/>
<constraint firstItem="lGf-lB-FsE" firstAttribute="top" secondItem="V61-yT-51L" secondAttribute="top" id="zqd-hT-tvh"/>
</constraints>
</view>
</subviews>
<constraints>
<constraint firstItem="lGf-lB-FsE" firstAttribute="width" secondItem="tjf-WP-vTl" secondAttribute="width" multiplier="0.48" id="5fb-f6-oS3"/>
<constraint firstItem="Fc3-Id-aaG" firstAttribute="leading" secondItem="tjf-WP-vTl" secondAttribute="leading" id="5x7-DE-zYg"/>
<constraint firstItem="f3G-yI-qc9" firstAttribute="centerY" secondItem="lGf-lB-FsE" secondAttribute="centerY" id="9Yy-DW-vZP"/>
<constraint firstItem="lGf-lB-FsE" firstAttribute="height" secondItem="tjf-WP-vTl" secondAttribute="height" id="QaA-wP-PHx"/>
<constraint firstAttribute="trailing" secondItem="lGf-lB-FsE" secondAttribute="trailing" id="S8h-oW-Egj"/>
<constraint firstItem="Fc3-Id-aaG" firstAttribute="height" secondItem="tjf-WP-vTl" secondAttribute="height" id="T0D-Z8-Iap"/>
<constraint firstItem="CzJ-mZ-Ryu" firstAttribute="centerY" secondItem="Fc3-Id-aaG" secondAttribute="centerY" id="Yjd-zv-BcY"/>
<constraint firstItem="lGf-lB-FsE" firstAttribute="top" secondItem="tjf-WP-vTl" secondAttribute="top" id="Zst-Zf-1kd"/>
<constraint firstItem="Fc3-Id-aaG" firstAttribute="width" secondItem="tjf-WP-vTl" secondAttribute="width" multiplier="0.48" id="b8E-xg-a44"/>
<constraint firstItem="CzJ-mZ-Ryu" firstAttribute="centerX" secondItem="Fc3-Id-aaG" secondAttribute="centerX" id="cAm-MG-goF"/>
<constraint firstAttribute="height" constant="30" id="lTf-u3-Z4R"/>
<constraint firstItem="f3G-yI-qc9" firstAttribute="centerX" secondItem="lGf-lB-FsE" secondAttribute="centerX" id="oa9-ji-H4n"/>
<constraint firstItem="Fc3-Id-aaG" firstAttribute="top" secondItem="tjf-WP-vTl" secondAttribute="top" id="rLo-t4-61H"/>
<constraint firstAttribute="height" constant="30" id="gRr-vT-aCi"/>
</constraints>
</view>
</stackView>
<imageView hidden="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="e2e_verified" translatesAutoresizingMaskIntoConstraints="NO" id="hVY-f3-80Y">
<rect key="frame" x="50" y="42.5" width="11" height="13"/>
<accessibility key="accessibilityConfiguration" identifier="EncryptedRoomIcon"/>
@@ -101,20 +119,19 @@
<constraints>
<constraint firstItem="dQt-mN-T6b" firstAttribute="top" secondItem="Lg1-xQ-AGn" secondAttribute="bottom" constant="4" id="1ka-cr-uZP"/>
<constraint firstItem="RX5-eD-c3c" firstAttribute="leading" secondItem="aXz-IR-jj5" secondAttribute="leading" constant="13" id="3EJ-qT-J8r"/>
<constraint firstItem="DAj-sJ-hVs" firstAttribute="leading" secondItem="RX5-eD-c3c" secondAttribute="trailing" constant="13" id="87t-Fh-3XD"/>
<constraint firstAttribute="bottom" secondItem="DAj-sJ-hVs" secondAttribute="bottom" constant="10" id="8LP-CN-krZ"/>
<constraint firstItem="Lg1-xQ-AGn" firstAttribute="leading" secondItem="RX5-eD-c3c" secondAttribute="trailing" constant="14" id="Pgp-JM-oQd"/>
<constraint firstItem="hVY-f3-80Y" firstAttribute="centerY" secondItem="dQt-mN-T6b" secondAttribute="centerY" id="RM0-3J-ihk"/>
<constraint firstItem="dQt-mN-T6b" firstAttribute="leading" secondItem="RX5-eD-c3c" secondAttribute="trailing" constant="14" id="XFM-LG-4uJ"/>
<constraint firstAttribute="trailing" secondItem="tjf-WP-vTl" secondAttribute="trailing" constant="54" id="kFW-Fa-ibz"/>
<constraint firstItem="hVY-f3-80Y" firstAttribute="leading" secondItem="aXz-IR-jj5" secondAttribute="leading" constant="50" id="prx-bM-qUg"/>
<constraint firstAttribute="trailing" secondItem="dQt-mN-T6b" secondAttribute="trailing" id="t2m-pb-5zd"/>
<constraint firstItem="Lg1-xQ-AGn" firstAttribute="top" secondItem="aXz-IR-jj5" secondAttribute="top" constant="14" id="tY3-6V-A3B"/>
<constraint firstItem="tjf-WP-vTl" firstAttribute="leading" secondItem="RX5-eD-c3c" secondAttribute="trailing" constant="13" id="wEB-VM-vz8"/>
</constraints>
</tableViewCellContentView>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<accessibility key="accessibilityConfiguration" identifier="InviteRecentTableViewCell"/>
<constraints>
<constraint firstAttribute="bottom" secondItem="tjf-WP-vTl" secondAttribute="bottom" constant="10" id="NTY-0b-Ylt"/>
<constraint firstItem="RX5-eD-c3c" firstAttribute="top" secondItem="L2L-l5-wPx" secondAttribute="top" constant="15" id="uLf-cg-Vge"/>
</constraints>
<connections>
@@ -37,7 +37,7 @@ struct SpaceSelectorBottomSheetCoordinatorParameters {
}
}
final class SpaceSelectorBottomSheetCoordinator: Coordinator, Presentable {
final class SpaceSelectorBottomSheetCoordinator: NSObject, Coordinator, Presentable {
// MARK: - Properties
@@ -62,6 +62,9 @@ final class SpaceSelectorBottomSheetCoordinator: Coordinator, Presentable {
self.parameters = parameters
self.navigationRouter = navigationRouter
self.spaceIdStack = []
super.init()
self.setupNavigationRouter()
}
@@ -89,6 +92,8 @@ final class SpaceSelectorBottomSheetCoordinator: Coordinator, Presentable {
sheetController.prefersGrabberVisible = true
sheetController.selectedDetentIdentifier = .medium
sheetController.prefersScrollingExpandsWhenScrolledToEdge = true
self.navigationRouter.toPresentable().presentationController?.delegate = self
}
private func createSpaceSelectorCoordinator(parentSpaceId: String?) -> SpaceSelectorCoordinator {
@@ -151,3 +156,13 @@ final class SpaceSelectorBottomSheetCoordinator: Coordinator, Presentable {
Analytics.shared.trackInteraction(.spacePanelSwitchSpace)
}
}
// MARK: - UIAdaptivePresentationControllerDelegate
extension SpaceSelectorBottomSheetCoordinator: UIAdaptivePresentationControllerDelegate {
func presentationControllerDidDismiss(_ presentationController: UIPresentationController) {
completion?(.cancel)
}
}
+1
View File
@@ -0,0 +1 @@
New App Layout: added suppport for room invites in the all chats screen