Skip to content

Commit

Permalink
Update All chats screen with latest design #6407
Browse files Browse the repository at this point in the history
- Update after code review
  • Loading branch information
gileluard committed Aug 2, 2022
1 parent e0856fb commit b778131
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 29 deletions.
6 changes: 4 additions & 2 deletions Riot/Generated/Storyboards.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import UIKit

// MARK: - Storyboard Scenes

// swiftlint:disable explicit_type_interface identifier_name line_length type_body_length type_name
// swiftlint:disable explicit_type_interface identifier_name line_length prefer_self_in_static_references
// swiftlint:disable type_body_length type_name
internal enum StoryboardScene {
internal enum CallTransferMainViewController: StoryboardType {
internal static let storyboardName = "CallTransferMainViewController"
Expand Down Expand Up @@ -325,7 +326,8 @@ internal enum StoryboardScene {
internal static let initialScene = InitialSceneType<Riot.WidgetPermissionViewController>(storyboard: WidgetPermissionViewController.self)
}
}
// swiftlint:enable explicit_type_interface identifier_name line_length type_body_length type_name
// swiftlint:enable explicit_type_interface identifier_name line_length prefer_self_in_static_references
// swiftlint:enable type_body_length type_name

// MARK: - Implementation Details

Expand Down
16 changes: 8 additions & 8 deletions Riot/Modules/Common/Recents/DataSources/RecentsDataSource.m
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,9 @@ - (void)dealloc
{
return self.recentsListService.suggestedRoomListData.rooms;
}
- (NSArray<id<MXRoomSummaryProtocol>> *)recentRoomCellDataArray
- (NSArray<id<MXRoomSummaryProtocol>> *)breadcrumbsRoomCellDataArray
{
return self.recentsListService.recentRoomListData.rooms;
return self.recentsListService.breadcrumbsRoomListData.rooms;
}
- (NSArray<id<MXRoomSummaryProtocol>> *)allChatsRoomCellDataArray
{
Expand Down Expand Up @@ -188,7 +188,7 @@ - (RecentsDataSourceSections *)makeDataSourceSections
[types addObject:@(RecentsDataSourceSectionTypeInvites)];
}

if (self.recentRoomCellDataArray.count > 0 && _recentsDataSourceMode == RecentsDataSourceModeAllChats)
if (self.breadcrumbsRoomCellDataArray.count > 0 && _recentsDataSourceMode == RecentsDataSourceModeAllChats)
{
AllChatsLayoutSettings *settings = AllChatsLayoutSettingsManager.shared.allChatLayoutSettings;
if ((settings.sections & AllChatsLayoutSectionTypeRecents) == AllChatsLayoutSectionTypeRecents)
Expand Down Expand Up @@ -628,7 +628,7 @@ - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger
}
else if (sectionType == RecentsDataSourceSectionTypeBreadcrumbs && !(shrinkedSectionsBitMask & RECENTSDATASOURCE_SECTION_BREADCRUMBS))
{
count = self.recentRoomCellDataArray.count;
count = self.breadcrumbsRoomCellDataArray.count;
}
else if (sectionType == RecentsDataSourceSectionTypeAllChats && !(shrinkedSectionsBitMask & RECENTSDATASOURCE_SECTION_ALL_CHATS))
{
Expand Down Expand Up @@ -735,7 +735,7 @@ - (NSAttributedString *)attributedStringForHeaderTitleInSection:(NSInteger)secti
}
else if (sectionType == RecentsDataSourceSectionTypeBreadcrumbs)
{
count = self.recentsListService.recentRoomListData.counts.total.numberOfRooms;
count = self.recentsListService.breadcrumbsRoomListData.counts.total.numberOfRooms;
title = [VectorL10n roomRecentsRecentlyViewedSection];
}
else if (sectionType == RecentsDataSourceSectionTypeAllChats)
Expand Down Expand Up @@ -1143,9 +1143,9 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
}
else if (sectionType == RecentsDataSourceSectionTypeBreadcrumbs)
{
if (cellDataIndex < self.recentRoomCellDataArray.count)
if (cellDataIndex < self.breadcrumbsRoomCellDataArray.count)
{
summary = self.recentRoomCellDataArray[cellDataIndex];
summary = self.breadcrumbsRoomCellDataArray[cellDataIndex];
}
}
else if (sectionType == RecentsDataSourceSectionTypeAllChats)
Expand Down Expand Up @@ -1338,7 +1338,7 @@ - (NSIndexPath*)cellIndexPathWithRoomId:(NSString*)roomId andMatrixSession:(MXSe

if (!indexPath && ([self.sections contains:RecentsDataSourceSectionTypeBreadcrumbs]))
{
index = [self cellIndexPosWithRoomId:roomId andMatrixSession:matrixSession within:self.recentRoomCellDataArray];
index = [self cellIndexPosWithRoomId:roomId andMatrixSession:matrixSession within:self.breadcrumbsRoomCellDataArray];

if (index != NSNotFound)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public class RecentsListService: NSObject, RecentsListServiceProtocol {
private var lowPriorityRoomListDataFetcher: MXRoomListDataFetcher?
private var serverNoticeRoomListDataFetcher: MXRoomListDataFetcher?
private var suggestedRoomListDataFetcher: MXRoomListDataFetcher?
private var recentRoomListDataFetcher: MXRoomListDataFetcher?
private var breadcrumbsRoomListDataFetcher: MXRoomListDataFetcher?
private var allChatsRoomListDataFetcher: MXRoomListDataFetcher?

private var conversationRoomListDataFetcherForHome: MXRoomListDataFetcher?
Expand All @@ -87,7 +87,7 @@ public class RecentsListService: NSObject, RecentsListServiceProtocol {
.favourites: [.favorited],
.people: [.invited, .directPeople],
.rooms: [.invited, .conversationRooms, .suggested],
.allChats: [.recents, .favorited, .invited, .allChats, .lowPriority, .serverNotice, .suggested]
.allChats: [.breadcrumbs, .favorited, .invited, .allChats, .lowPriority, .serverNotice, .suggested]
]

private var allFetchers: [MXRoomListDataFetcher] {
Expand All @@ -103,7 +103,7 @@ public class RecentsListService: NSObject, RecentsListServiceProtocol {
lowPriorityRoomListDataFetcher,
serverNoticeRoomListDataFetcher,
suggestedRoomListDataFetcher,
recentRoomListDataFetcher,
breadcrumbsRoomListDataFetcher,
allChatsRoomListDataFetcher
].compactMap({ $0 })
}
Expand Down Expand Up @@ -140,7 +140,7 @@ public class RecentsListService: NSObject, RecentsListServiceProtocol {
if space != nil, let fetcher = suggestedRoomListDataFetcher, fetcherTypes.contains(.suggested) {
result.append(fetcher)
}
if let fetcher = recentRoomListDataFetcher, fetcherTypes.contains(.recents) {
if let fetcher = breadcrumbsRoomListDataFetcher, fetcherTypes.contains(.breadcrumbs) {
result.append(fetcher)
}
if let fetcher = allChatsRoomListDataFetcher, fetcherTypes.contains(.allChats) {
Expand Down Expand Up @@ -274,9 +274,9 @@ public class RecentsListService: NSObject, RecentsListServiceProtocol {
guard shouldShowSuggested else { return nil }
return suggestedRoomListDataFetcher?.data
}
public var recentRoomListData: MXRoomListData? {
guard shouldShowRecents else { return nil }
return recentRoomListDataFetcher?.data
public var breadcrumbsRoomListData: MXRoomListData? {
guard shouldShowBreadcrumbs else { return nil }
return breadcrumbsRoomListDataFetcher?.data
}
public var allChatsRoomListData: MXRoomListData? {
guard shouldShowAllChats else { return nil }
Expand Down Expand Up @@ -373,7 +373,7 @@ public class RecentsListService: NSObject, RecentsListServiceProtocol {
lowPriorityRoomListDataFetcher = nil
serverNoticeRoomListDataFetcher = nil
suggestedRoomListDataFetcher = nil
recentRoomListDataFetcher = nil
breadcrumbsRoomListDataFetcher = nil
allChatsRoomListDataFetcher = nil
}

Expand Down Expand Up @@ -492,8 +492,8 @@ public class RecentsListService: NSObject, RecentsListServiceProtocol {
return fetcherTypesForMode[mode]?.contains(.suggested) ?? false
}

private var shouldShowRecents: Bool {
return fetcherTypesForMode[mode]?.contains(.recents) ?? false
private var shouldShowBreadcrumbs: Bool {
return fetcherTypesForMode[mode]?.contains(.breadcrumbs) ?? false
}

private var shouldShowAllChats: Bool {
Expand All @@ -517,7 +517,7 @@ public class RecentsListService: NSObject, RecentsListServiceProtocol {
case .suggested:
return suggestedRoomListDataFetcher
case .breadcrumbs:
return recentRoomListDataFetcher
return breadcrumbsRoomListDataFetcher
case .allChats:
return allChatsRoomListDataFetcher
}
Expand All @@ -538,7 +538,7 @@ public class RecentsListService: NSObject, RecentsListServiceProtocol {
return .serverNotice
} else if fetcher === suggestedRoomListDataFetcher {
return .suggested
} else if fetcher === recentRoomListDataFetcher {
} else if fetcher === breadcrumbsRoomListDataFetcher {
return .breadcrumbs
} else if fetcher === allChatsRoomListDataFetcher {
return .allChats
Expand Down Expand Up @@ -653,7 +653,7 @@ public class RecentsListService: NSObject, RecentsListServiceProtocol {
lowPriorityRoomListDataFetcher = createCommonRoomListDataFetcher(withDataTypes: [.lowPriority])
serverNoticeRoomListDataFetcher = createCommonRoomListDataFetcher(withDataTypes: [.serverNotice])
suggestedRoomListDataFetcher = createCommonRoomListDataFetcher(onlySuggested: true)
recentRoomListDataFetcher = createCommonRoomListDataFetcher(onlyRecents: true)
breadcrumbsRoomListDataFetcher = createCommonRoomListDataFetcher(onlyRecents: true)
allChatsRoomListDataFetcher = createConversationRoomListDataFetcherForAllChats()

fetchersCreated = true
Expand Down Expand Up @@ -794,10 +794,10 @@ private struct FetcherTypes: OptionSet {
static let lowPriority = FetcherTypes(rawValue: 1 << 6)
static let serverNotice = FetcherTypes(rawValue: 1 << 7)
static let suggested = FetcherTypes(rawValue: 1 << 8)
static let recents = FetcherTypes(rawValue: 1 << 9)
static let breadcrumbs = FetcherTypes(rawValue: 1 << 9)
static let allChats = FetcherTypes(rawValue: 1 << 10)

static let none: FetcherTypes = []
static let all: FetcherTypes = [
.invited, .favorited, .directHome, .directPeople, .conversationHome, .conversationRooms, .lowPriority, .serverNotice, .suggested, .recents, .allChats]
.invited, .favorited, .directHome, .directPeople, .conversationHome, .conversationRooms, .lowPriority, .serverNotice, .suggested, .breadcrumbs, .allChats]
}
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public class MockRecentsListService: NSObject, RecentsListServiceProtocol {

public var suggestedRoomListData: MXRoomListData?

public var recentRoomListData: MXRoomListData?
public var breadcrumbsRoomListData: MXRoomListData?

public var allChatsRoomListData: MXRoomListData?

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public protocol RecentsListServiceProtocol {
var suggestedRoomListData: MXRoomListData? { get }

/// Breadcrumbs
var recentRoomListData: MXRoomListData? { get }
var breadcrumbsRoomListData: MXRoomListData? { get }

/// All Chats room for current mode
var allChatsRoomListData: MXRoomListData? { get }
Expand Down
4 changes: 2 additions & 2 deletions Riot/Modules/Home/AllChats/AllChatsViewController.xib
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@
<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="7eM-ZH-m1e" firstAttribute="leading" secondItem="4qf-KS-Fc9" secondAttribute="leading" id="Dfw-Ep-vIx"/>
<constraint firstItem="7eM-ZH-m1e" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="Dfw-Ep-vIx"/>
<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="7eM-ZH-m1e" firstAttribute="trailing" secondItem="4qf-KS-Fc9" secondAttribute="trailing" id="NG9-KI-4ZF"/>
<constraint firstItem="7eM-ZH-m1e" firstAttribute="trailing" secondItem="iN0-l3-epB" secondAttribute="trailing" id="NG9-KI-4ZF"/>
<constraint firstItem="JJC-Bw-6sa" firstAttribute="top" secondItem="4qf-KS-Fc9" secondAttribute="top" id="OBu-sH-mqE"/>
<constraint firstItem="4qf-KS-Fc9" firstAttribute="bottom" secondItem="7eM-ZH-m1e" secondAttribute="bottom" id="Ord-4E-Pvk"/>
<constraint firstItem="EXH-mK-0eB" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="S3i-DW-PUB"/>
Expand Down
1 change: 1 addition & 0 deletions Riot/Modules/Home/Views/TableViewCellWithCollectionView.m
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ - (void)customizeTableViewCellRendering
{
[super customizeTableViewCellRendering];

self.collectionView.backgroundColor = ThemeService.shared.theme.backgroundColor;
self.editionView.backgroundColor = ThemeService.shared.theme.headerBackgroundColor;
}

Expand Down

0 comments on commit b778131

Please sign in to comment.