-
Notifications
You must be signed in to change notification settings - Fork 503
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Spaces] M10.8 Browsing users in a space #4682
- Added navigation to member detail page
- Loading branch information
Showing
24 changed files
with
710 additions
and
210 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
96 changes: 96 additions & 0 deletions
96
Riot/Modules/Spaces/SpaceMembers/MemberDetail/ShowSpaceMemberDetailCoordinator.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
// File created from ScreenTemplate | ||
// $ createScreen.sh Spaces/SpaceMembers/MemberDetail ShowSpaceMemberDetail | ||
/* | ||
Copyright 2021 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 | ||
import UIKit | ||
|
||
final class ShowSpaceMemberDetailCoordinator: NSObject, ShowSpaceMemberDetailCoordinatorType { | ||
|
||
// MARK: - Properties | ||
|
||
// MARK: Private | ||
|
||
private let session: MXSession | ||
private let member: MXRoomMember | ||
private let spaceId: String | ||
|
||
private var showSpaceMemberDetailViewModel: ShowSpaceMemberDetailViewModelType | ||
private let showSpaceMemberDetailViewController: ShowSpaceMemberDetailViewController | ||
|
||
// MARK: Public | ||
|
||
// Must be used only internally | ||
var childCoordinators: [Coordinator] = [] | ||
|
||
weak var delegate: ShowSpaceMemberDetailCoordinatorDelegate? | ||
|
||
// MARK: - Setup | ||
|
||
init(session: MXSession, member: MXRoomMember, spaceId: String) { | ||
self.session = session | ||
self.member = member | ||
self.spaceId = spaceId | ||
|
||
let showSpaceMemberDetailViewModel = ShowSpaceMemberDetailViewModel(session: self.session, member: self.member) | ||
let showSpaceMemberDetailViewController = ShowSpaceMemberDetailViewController.instantiate(with: showSpaceMemberDetailViewModel) | ||
showSpaceMemberDetailViewController.enableMention = true | ||
showSpaceMemberDetailViewController.enableVoipCall = false | ||
showSpaceMemberDetailViewController.enableLeave = false | ||
|
||
self.showSpaceMemberDetailViewModel = showSpaceMemberDetailViewModel | ||
self.showSpaceMemberDetailViewController = showSpaceMemberDetailViewController | ||
} | ||
|
||
// MARK: - Public methods | ||
|
||
func start() { | ||
self.showSpaceMemberDetailViewModel.coordinatorDelegate = self | ||
if let space = self.session.spaceService.getSpace(withId: spaceId) { | ||
// Set delegate to handle action on member (start chat, mention) | ||
self.showSpaceMemberDetailViewController.delegate = self | ||
self.showSpaceMemberDetailViewController.display(self.member, withMatrixRoom: space.room) | ||
} | ||
} | ||
|
||
func toPresentable() -> UIViewController { | ||
return self.showSpaceMemberDetailViewController | ||
} | ||
} | ||
|
||
// MARK: - ShowSpaceMemberDetailViewModelCoordinatorDelegate | ||
extension ShowSpaceMemberDetailCoordinator: ShowSpaceMemberDetailViewModelCoordinatorDelegate { | ||
|
||
func showSpaceMemberDetailViewModel(_ viewModel: ShowSpaceMemberDetailViewModelType, showRoomWithId roomId: String) { | ||
self.delegate?.showSpaceMemberDetailCoordinator(self, showRoomWithId: roomId) | ||
} | ||
|
||
func showSpaceMemberDetailViewModelDidCancel(_ viewModel: ShowSpaceMemberDetailViewModelType) { | ||
self.delegate?.showSpaceMemberDetailCoordinatorDidCancel(self) | ||
} | ||
|
||
} | ||
|
||
// MARK: - MXKRoomMemberDetailsViewControllerDelegate | ||
extension ShowSpaceMemberDetailCoordinator: MXKRoomMemberDetailsViewControllerDelegate { | ||
|
||
func roomMemberDetailsViewController(_ roomMemberDetailsViewController: MXKRoomMemberDetailsViewController!, startChatWithMemberId memberId: String!, completion: (() -> Void)!) { | ||
completion() | ||
self.showSpaceMemberDetailViewModel.process(viewAction: .createRoom(memberId)) | ||
} | ||
|
||
} |
29 changes: 29 additions & 0 deletions
29
Riot/Modules/Spaces/SpaceMembers/MemberDetail/ShowSpaceMemberDetailCoordinatorType.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// File created from ScreenTemplate | ||
// $ createScreen.sh Spaces/SpaceMembers/MemberDetail ShowSpaceMemberDetail | ||
/* | ||
Copyright 2021 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 | ||
|
||
protocol ShowSpaceMemberDetailCoordinatorDelegate: AnyObject { | ||
func showSpaceMemberDetailCoordinator(_ coordinator: ShowSpaceMemberDetailCoordinatorType, showRoomWithId roomId: String) | ||
func showSpaceMemberDetailCoordinatorDidCancel(_ coordinator: ShowSpaceMemberDetailCoordinatorType) | ||
} | ||
|
||
/// `ShowSpaceMemberDetailCoordinatorType` is a protocol describing a Coordinator that handle key backup setup passphrase navigation flow. | ||
protocol ShowSpaceMemberDetailCoordinatorType: Coordinator, Presentable { | ||
var delegate: ShowSpaceMemberDetailCoordinatorDelegate? { get } | ||
} |
26 changes: 26 additions & 0 deletions
26
Riot/Modules/Spaces/SpaceMembers/MemberDetail/ShowSpaceMemberDetailViewAction.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// File created from ScreenTemplate | ||
// $ createScreen.sh Spaces/SpaceMembers/MemberDetail ShowSpaceMemberDetail | ||
/* | ||
Copyright 2021 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 | ||
|
||
/// ShowSpaceMemberDetailViewController view actions exposed to view model | ||
enum ShowSpaceMemberDetailViewAction { | ||
case openRoom(_ roomId: String) | ||
case createRoom(_ memberId: String) | ||
case cancel | ||
} |
Oops, something went wrong.