* feat: Start voice call from DM * rename voiceCall:bool to isVoiceCall * review: Fix a typo * review: use one displayCall(bool) instead of 2 actions * review: Add a new specific preview for DM calls * combine startCall and startVoiceCall in single enum with isVoiceCall * review: add isVoiceCall to presentCallScreen action * review: Use proper a11y for voice vs video * add voice/video options to UserProfile Screen * fixup: move config params to the roomInfo object * review: Revert changes on preview as the toolbar cannot be snapshot'd * review: Extract call controls in specific file * oups: Add voice call option in room details screen * Update room details screenshots * Update user profile screenshots * Update room member details screenshots * fixup: remove dead code
71 lines
2.5 KiB
Swift
71 lines
2.5 KiB
Swift
//
|
|
// Copyright 2025 Element Creations Ltd.
|
|
// Copyright 2022-2025 New Vector Ltd.
|
|
//
|
|
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial.
|
|
// Please see LICENSE files in the repository root for full details.
|
|
//
|
|
|
|
import Combine
|
|
import SwiftUI
|
|
|
|
struct RoomMemberDetailsScreenCoordinatorParameters {
|
|
let userID: String
|
|
let roomProxy: JoinedRoomProxyProtocol
|
|
let userSession: UserSessionProtocol
|
|
let userIndicatorController: UserIndicatorControllerProtocol
|
|
let analytics: AnalyticsService
|
|
}
|
|
|
|
enum RoomMemberDetailsScreenCoordinatorAction {
|
|
case openUserProfile
|
|
case openDirectChat(roomID: String)
|
|
case startCall(roomProxy: JoinedRoomProxyProtocol, isVoiceCall: Bool)
|
|
case verifyUser(userID: String)
|
|
}
|
|
|
|
final class RoomMemberDetailsScreenCoordinator: CoordinatorProtocol {
|
|
private var viewModel: RoomMemberDetailsScreenViewModelProtocol
|
|
|
|
private let actionsSubject: PassthroughSubject<RoomMemberDetailsScreenCoordinatorAction, Never> = .init()
|
|
private var cancellables = Set<AnyCancellable>()
|
|
|
|
var actions: AnyPublisher<RoomMemberDetailsScreenCoordinatorAction, Never> {
|
|
actionsSubject.eraseToAnyPublisher()
|
|
}
|
|
|
|
init(parameters: RoomMemberDetailsScreenCoordinatorParameters) {
|
|
viewModel = RoomMemberDetailsScreenViewModel(userID: parameters.userID,
|
|
roomProxy: parameters.roomProxy,
|
|
userSession: parameters.userSession,
|
|
userIndicatorController: parameters.userIndicatorController,
|
|
analytics: parameters.analytics)
|
|
}
|
|
|
|
func start() {
|
|
viewModel.actions.sink { [weak self] action in
|
|
guard let self else { return }
|
|
|
|
switch action {
|
|
case .openUserProfile:
|
|
actionsSubject.send(.openUserProfile)
|
|
case .openDirectChat(let roomID):
|
|
actionsSubject.send(.openDirectChat(roomID: roomID))
|
|
case .startCall(let roomProxy, let isVoiceCall):
|
|
actionsSubject.send(.startCall(roomProxy: roomProxy, isVoiceCall: isVoiceCall))
|
|
case .verifyUser(let userID):
|
|
actionsSubject.send(.verifyUser(userID: userID))
|
|
}
|
|
}
|
|
.store(in: &cancellables)
|
|
}
|
|
|
|
func stop() {
|
|
viewModel.stop()
|
|
}
|
|
|
|
func toPresentable() -> AnyView {
|
|
AnyView(RoomMemberDetailsScreen(context: viewModel.context))
|
|
}
|
|
}
|