Composer Update - Typing and sending a message

This commit is contained in:
Gil Eluard
2021-03-15 14:27:59 +01:00
parent aa3aafb0b0
commit eefe1e2157
39 changed files with 1103 additions and 1210 deletions
@@ -86,8 +86,13 @@ final class RoomInfoCoordinator: NSObject, RoomInfoCoordinatorType {
// MARK: - Setup
init(parameters: RoomInfoCoordinatorParameters) {
self.navigationRouter = NavigationRouter(navigationController: RiotNavigationController())
init(parameters: RoomInfoCoordinatorParameters, navigationRouter: NavigationRouterType? = nil) {
if let navigationRouter = navigationRouter {
self.navigationRouter = navigationRouter
} else {
self.navigationRouter = NavigationRouter(navigationController: RiotNavigationController())
}
self.session = parameters.session
self.room = parameters.room
self.initialSection = parameters.initialSection
@@ -102,8 +107,12 @@ final class RoomInfoCoordinator: NSObject, RoomInfoCoordinatorType {
self.add(childCoordinator: rootCoordinator)
self.navigationRouter.setRootModule(rootCoordinator)
if self.navigationRouter.modules.isEmpty == false {
self.navigationRouter.push(rootCoordinator.toPresentable(), animated: true, popCompletion: nil)
} else {
self.navigationRouter.setRootModule(rootCoordinator)
}
switch initialSection {
case .addParticipants:
self.showRoomDetails(with: .members, animated: false)
@@ -129,13 +138,29 @@ final class RoomInfoCoordinator: NSObject, RoomInfoCoordinatorType {
}
private func showRoomDetails(with target: RoomInfoListTarget, animated: Bool) {
segmentedViewController.selectedIndex = target.tabIndex
if case .settings(let roomSettingsField) = target {
roomSettingsViewController?.selectedRoomSettingsField = roomSettingsField
switch target {
case .integrations:
if let modularVC = IntegrationManagerViewController(for: session, inRoom: room.roomId, screen: kIntegrationManagerMainScreen, widgetId: nil) {
navigationRouter.present(modularVC, animated: true)
}
case .search:
MXKRoomDataSourceManager.sharedManager(forMatrixSession: session)?.roomDataSource(forRoom: self.room.roomId, create: false, onComplete: { (roomDataSource) in
guard let dataSource = roomDataSource else { return }
let storyboard = UIStoryboard(name: "Main", bundle: nil)
if let search = storyboard.instantiateViewController(withIdentifier: "RoomSearch") as? RoomSearchViewController {
search.roomDataSource = dataSource
self.navigationRouter.push(search, animated: animated, popCompletion: nil)
}
})
default:
segmentedViewController.selectedIndex = target.tabIndex
if case .settings(let roomSettingsField) = target {
roomSettingsViewController?.selectedRoomSettingsField = roomSettingsField
}
navigationRouter.push(segmentedViewController, animated: animated, popCompletion: nil)
}
navigationRouter.push(segmentedViewController, animated: animated, popCompletion: nil)
}
}
@@ -63,6 +63,16 @@ final class RoomInfoCoordinatorBridgePresenter: NSObject {
self.coordinator = roomInfoCoordinator
}
func push(from navigationController: UINavigationController, animated: Bool) {
let navigationRouter = NavigationRouter(navigationController: navigationController)
let roomInfoCoordinator = RoomInfoCoordinator(parameters: self.coordinatorParameters, navigationRouter: navigationRouter)
roomInfoCoordinator.delegate = self
roomInfoCoordinator.start()
self.coordinator = roomInfoCoordinator
}
func dismiss(animated: Bool, completion: (() -> Void)?) {
guard let coordinator = self.coordinator else {
return
@@ -18,11 +18,13 @@
import Foundation
enum RoomInfoListTarget {
enum RoomInfoListTarget: Equatable {
case settings(_ field: RoomSettingsViewControllerField = RoomSettingsViewControllerFieldNone)
case members
case uploads
case integrations
case search
var tabIndex: UInt {
let tabIndex: UInt
@@ -33,6 +35,10 @@ enum RoomInfoListTarget {
tabIndex = 1
case .settings:
tabIndex = 2
case .integrations:
tabIndex = 3
case .search:
tabIndex = 4
}
return tabIndex
@@ -157,11 +157,19 @@ final class RoomInfoListViewController: UIViewController {
let rowUploads = Row(type: .default, icon: Asset.Images.scrollup.image, text: VectorL10n.roomDetailsFiles, accessoryType: .disclosureIndicator) {
self.viewModel.process(viewAction: .navigate(target: .uploads))
}
let rowSearch = Row(type: .default, icon: Asset.Images.searchIcon.image, text: VectorL10n.roomDetailsSearch, accessoryType: .disclosureIndicator) {
self.viewModel.process(viewAction: .navigate(target: .search))
}
let rowIntegrations = Row(type: .default, icon: Asset.Images.integrationsIcon.image, text: VectorL10n.roomDetailsIntegrations, accessoryType: .disclosureIndicator) {
self.viewModel.process(viewAction: .navigate(target: .integrations))
}
let sectionSettings = Section(header: VectorL10n.roomInfoListSectionOther,
rows: [rowSettings,
rowIntegrations,
rowMembers,
rowUploads],
rowUploads,
rowSearch],
footer: nil)
let leaveTitle = viewData.basicInfoViewData.isDirect ?
@@ -205,7 +213,9 @@ final class RoomInfoListViewController: UIViewController {
}
private func setupViews() {
self.navigationItem.rightBarButtonItem = MXKBarButtonItem(customView: closeButton)
if navigationController?.viewControllers.count ?? 0 <= 1 {
self.navigationItem.rightBarButtonItem = MXKBarButtonItem(customView: closeButton)
}
self.title = ""