SwiftUI NavigationController and UserNotificationControllers (#309)

* Fixes #286 - Adopted the new SwiftUI NavigationStack based NavigationController throughout the application
* Fixes #315 - Implemented new user notification components on top of SwiftUI and the new navigation flows
* Add home screen fade animation between skeletons and real rooms
* Bump the danger-swift version used on the CI and swiftlint with it
* Renamed Splash to Onboarding, Empty to Splash
This commit is contained in:
Stefan Ceriu
2022-11-16 15:37:34 +02:00
committed by GitHub
parent af85c770da
commit 2fd0491a18
108 changed files with 1627 additions and 3720 deletions
@@ -25,42 +25,22 @@ enum TemplateCoordinatorAction {
case cancel
}
final class TemplateCoordinator: Coordinator, Presentable {
// MARK: - Properties
// MARK: Private
final class TemplateCoordinator: CoordinatorProtocol {
private let parameters: TemplateCoordinatorParameters
private let templateHostingController: UIViewController
private var templateViewModel: TemplateViewModelProtocol
private var viewModel: TemplateViewModelProtocol
private var indicatorPresenter: UserIndicatorTypePresenterProtocol
private var activityIndicator: UserIndicator?
// MARK: Public
// Must be used only internally
var childCoordinators: [Coordinator] = []
var callback: ((TemplateCoordinatorAction) -> Void)?
// MARK: - Setup
init(parameters: TemplateCoordinatorParameters) {
self.parameters = parameters
let viewModel = TemplateViewModel(promptType: parameters.promptType)
let view = TemplateScreen(context: viewModel.context)
templateViewModel = viewModel
templateHostingController = UIHostingController(rootView: view)
indicatorPresenter = UserIndicatorTypePresenter(presentingViewController: templateHostingController)
viewModel = TemplateViewModel(promptType: parameters.promptType)
}
// MARK: - Public
func start() {
MXLog.debug("Did start.")
templateViewModel.callback = { [weak self] action in
viewModel.callback = { [weak self] action in
guard let self else { return }
MXLog.debug("TemplateViewModel did complete with result: \(action).")
switch action {
@@ -71,27 +51,8 @@ final class TemplateCoordinator: Coordinator, Presentable {
}
}
}
func toPresentable() -> UIViewController {
templateHostingController
}
func stop() {
stopLoading()
}
// MARK: - Private
/// Show an activity indicator whilst loading.
/// - Parameters:
/// - label: The label to show on the indicator.
/// - isInteractionBlocking: Whether the indicator should block any user interaction.
private func startLoading(label: String = ElementL10n.loading, isInteractionBlocking: Bool = true) {
activityIndicator = indicatorPresenter.present(.loading(label: label, isInteractionBlocking: isInteractionBlocking))
}
/// Hide the currently displayed activity indicator.
private func stopLoading() {
activityIndicator = nil
func toPresentable() -> AnyView {
AnyView(TemplateScreen(context: viewModel.context))
}
}