mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 10:33:45 +00:00
Fixes #2179 - Open direct chat directly from the room member details screen
This commit is contained in:
committed by
Stefan Ceriu
parent
742a924037
commit
e4788e615f
+15
-3
@@ -24,7 +24,9 @@ struct RoomMemberDetailsScreenCoordinatorParameters {
|
||||
let userIndicatorController: UserIndicatorControllerProtocol
|
||||
}
|
||||
|
||||
enum RoomMemberDetailsScreenCoordinatorAction { }
|
||||
enum RoomMemberDetailsScreenCoordinatorAction {
|
||||
case openDirectChat
|
||||
}
|
||||
|
||||
final class RoomMemberDetailsScreenCoordinator: CoordinatorProtocol {
|
||||
private let parameters: RoomMemberDetailsScreenCoordinatorParameters
|
||||
@@ -45,8 +47,18 @@ final class RoomMemberDetailsScreenCoordinator: CoordinatorProtocol {
|
||||
mediaProvider: parameters.mediaProvider,
|
||||
userIndicatorController: parameters.userIndicatorController)
|
||||
}
|
||||
|
||||
func start() { }
|
||||
|
||||
func start() {
|
||||
viewModel.actions.sink { [weak self] action in
|
||||
guard let self else { return }
|
||||
|
||||
switch action {
|
||||
case .openDirectChat:
|
||||
actionsSubject.send(.openDirectChat)
|
||||
}
|
||||
}
|
||||
.store(in: &cancellables)
|
||||
}
|
||||
|
||||
func stop() { viewModel.stop() }
|
||||
|
||||
|
||||
+4
-1
@@ -16,7 +16,9 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
enum RoomMemberDetailsScreenViewModelAction { }
|
||||
enum RoomMemberDetailsScreenViewModelAction {
|
||||
case openDirectChat
|
||||
}
|
||||
|
||||
struct RoomMemberDetailsScreenViewState: BindableState {
|
||||
var details: RoomMemberDetails
|
||||
@@ -77,6 +79,7 @@ enum RoomMemberDetailsScreenViewAction {
|
||||
case ignoreConfirmed
|
||||
case unignoreConfirmed
|
||||
case displayAvatar
|
||||
case openDirectChat
|
||||
}
|
||||
|
||||
enum RoomMemberDetailsScreenError: Hashable {
|
||||
|
||||
+2
@@ -65,6 +65,8 @@ class RoomMemberDetailsScreenViewModel: RoomMemberDetailsScreenViewModelType, Ro
|
||||
Task { await unignoreUser() }
|
||||
case .displayAvatar:
|
||||
displayFullScreenAvatar()
|
||||
case .openDirectChat:
|
||||
actionsSubject.send(.openDirectChat)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ struct RoomMemberDetailsScreen: View {
|
||||
headerSection
|
||||
|
||||
if !context.viewState.details.isAccountOwner {
|
||||
directChatSection
|
||||
blockUserSection
|
||||
}
|
||||
}
|
||||
@@ -58,6 +59,17 @@ struct RoomMemberDetailsScreen: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private var directChatSection: some View {
|
||||
Section {
|
||||
ListRow(label: .default(title: L10n.commonDirectChat,
|
||||
icon: \.chat),
|
||||
kind: .button {
|
||||
context.send(viewAction: .openDirectChat)
|
||||
})
|
||||
.accessibilityIdentifier(A11yIdentifiers.roomMemberDetailsScreen.directChat)
|
||||
}
|
||||
}
|
||||
|
||||
private var blockUserSection: some View {
|
||||
Section {
|
||||
|
||||
Reference in New Issue
Block a user