Merge branch 'develop' into doug/fix_warnings

# Conflicts:
#	Riot/Modules/Room/RoomInfo/RoomInfoList/RoomInfoListViewController.swift
This commit is contained in:
Doug
2021-07-12 17:54:34 +01:00
72 changed files with 1920 additions and 116 deletions
@@ -137,6 +137,12 @@ final class RoomInfoCoordinator: NSObject, RoomInfoCoordinatorType {
return coordinator
}
private func createRoomNotificationSettingsCoordinator() -> RoomNotificationSettingsCoordinator {
let coordinator = RoomNotificationSettingsCoordinator(room: room, showAvatar: false)
coordinator.delegate = self
return coordinator
}
private func showRoomDetails(with target: RoomInfoListTarget, animated: Bool) {
switch target {
case .integrations:
@@ -152,8 +158,16 @@ final class RoomInfoCoordinator: NSObject, RoomInfoCoordinatorType {
self.navigationRouter.push(search, animated: animated, popCompletion: nil)
}
})
case .notifications:
let coordinator = createRoomNotificationSettingsCoordinator()
coordinator.start()
self.add(childCoordinator: coordinator)
self.navigationRouter.push(coordinator, animated: true, popCompletion: nil)
default:
segmentedViewController.selectedIndex = target.tabIndex
guard let tabIndex = target.tabIndex else {
fatalError("No settings tab index for this target.")
}
segmentedViewController.selectedIndex = tabIndex
if case .settings(let roomSettingsField) = target {
roomSettingsViewController?.selectedRoomSettingsField = roomSettingsField
@@ -184,3 +198,14 @@ extension RoomInfoCoordinator: RoomParticipantsViewControllerDelegate {
}
}
extension RoomInfoCoordinator: RoomNotificationSettingsCoordinatorDelegate {
func roomNotificationSettingsCoordinatorDidComplete(_ coordinator: RoomNotificationSettingsCoordinatorType) {
self.navigationRouter.popModule(animated: true)
}
func roomNotificationSettingsCoordinatorDidCancel(_ coordinator: RoomNotificationSettingsCoordinatorType) {
}
}
@@ -24,25 +24,21 @@ enum RoomInfoListTarget: Equatable {
case uploads
case integrations
case search
var tabIndex: UInt {
let tabIndex: UInt
case notifications
var tabIndex: UInt? {
switch self {
case .members:
tabIndex = 0
return 0
case .uploads:
tabIndex = 1
return 1
case .settings:
tabIndex = 2
case .integrations:
tabIndex = 3
case .search:
tabIndex = 4
return 2
default:
return nil
}
return tabIndex
}
}
/// RoomInfoListViewController view actions exposed to view model
@@ -150,6 +150,9 @@ final class RoomInfoListViewController: UIViewController {
let rowSettings = Row(type: .default, icon: Asset.Images.settingsIcon.image, text: VectorL10n.roomDetailsSettings, accessoryType: .disclosureIndicator) {
self.viewModel.process(viewAction: .navigate(target: .settings()))
}
let roomNotifications = Row(type: .default, icon: Asset.Images.notifications.image, text: VectorL10n.roomDetailsNotifs, accessoryType: .disclosureIndicator) {
self.viewModel.process(viewAction: .navigate(target: .notifications))
}
let text = viewData.numberOfMembers == 1 ? VectorL10n.roomInfoListOneMember : VectorL10n.roomInfoListSeveralMembers(String(viewData.numberOfMembers))
let rowMembers = Row(type: .default, icon: Asset.Images.userIcon.image, text: text, accessoryType: .disclosureIndicator) {
self.viewModel.process(viewAction: .navigate(target: .members))
@@ -165,6 +168,10 @@ final class RoomInfoListViewController: UIViewController {
}
var rows = [rowSettings]
if BuildSettings.roomSettingsScreenShowNotificationsV2 {
rows.append(roomNotifications)
}
if RiotSettings.shared.roomInfoScreenShowIntegrations {
rows.append(rowIntegrations)
}