Beam/ElementX/Sources/Screens/KnockRequestsListScreen/KnockRequestsListScreenCoordinator.swift
Mauro e315451448
Knock Requests List Screen (#3533)
* created the basic navigation and files

* updated the logic

so that the buttons that do not have permissions won't show

* added the empty state

* progress in making the list UI

* update tests

* UI improvements

* fixed an issue with media provider

* update button style

* fixed a navigation bug

* pr suggestions

* pr suggestions
2024-11-21 19:14:05 +00:00

46 lines
1.5 KiB
Swift

//
// Copyright 2022-2024 New Vector Ltd.
//
// SPDX-License-Identifier: AGPL-3.0-only
// Please see LICENSE in the repository root for full details.
//
// periphery:ignore:all - this is just a knockRequestsList remove this comment once generating the final file
import Combine
import SwiftUI
struct KnockRequestsListScreenCoordinatorParameters {
let roomProxy: JoinedRoomProxyProtocol
let mediaProvider: MediaProviderProtocol
}
enum KnockRequestsListScreenCoordinatorAction { }
final class KnockRequestsListScreenCoordinator: CoordinatorProtocol {
private let viewModel: KnockRequestsListScreenViewModelProtocol
private var cancellables = Set<AnyCancellable>()
private let actionsSubject: PassthroughSubject<KnockRequestsListScreenCoordinatorAction, Never> = .init()
var actionsPublisher: AnyPublisher<KnockRequestsListScreenCoordinatorAction, Never> {
actionsSubject.eraseToAnyPublisher()
}
init(parameters: KnockRequestsListScreenCoordinatorParameters) {
viewModel = KnockRequestsListScreenViewModel(roomProxy: parameters.roomProxy,
mediaProvider: parameters.mediaProvider)
}
func start() {
viewModel.actionsPublisher.sink { [weak self] action in
MXLog.info("Coordinator: received view model action: \(action)")
}
.store(in: &cancellables)
}
func toPresentable() -> AnyView {
AnyView(KnockRequestsListScreen(context: viewModel.context))
}
}