From a528389a2066a78f087dca38a62a2ef2c5e7ff1d Mon Sep 17 00:00:00 2001 From: gmc Date: Mon, 12 Aug 2024 17:47:04 +0200 Subject: [PATCH] TF-1625] fix --- TwoFAS/Data/Interactors/ViewPathInteractor.swift | 1 + .../AppleWatch/Flow/AppleWatchFlowController.swift | 14 ++++++++++++++ .../AppleWatch/View/AppleWatchViewController.swift | 1 - .../Menu/Presenter/SettingsMenuPresenter.swift | 4 +++- .../Settings/Flow/SettingsFlowController.swift | 6 +++++- 5 files changed, 23 insertions(+), 3 deletions(-) diff --git a/TwoFAS/Data/Interactors/ViewPathInteractor.swift b/TwoFAS/Data/Interactors/ViewPathInteractor.swift index 5f1cb6af..d248eeac 100644 --- a/TwoFAS/Data/Interactors/ViewPathInteractor.swift +++ b/TwoFAS/Data/Interactors/ViewPathInteractor.swift @@ -29,6 +29,7 @@ public enum ViewPath: Equatable, Codable { case trash case about case appearance + case appleWatch } case main diff --git a/TwoFAS/TwoFAS/Root/Modules/Settings/AppleWatch/Flow/AppleWatchFlowController.swift b/TwoFAS/TwoFAS/Root/Modules/Settings/AppleWatch/Flow/AppleWatchFlowController.swift index eaf70283..2864b880 100644 --- a/TwoFAS/TwoFAS/Root/Modules/Settings/AppleWatch/Flow/AppleWatchFlowController.swift +++ b/TwoFAS/TwoFAS/Root/Modules/Settings/AppleWatch/Flow/AppleWatchFlowController.swift @@ -32,6 +32,20 @@ final class AppleWatchFlowController: FlowController { private weak var parent: AppleWatchFlowControllerParent? private weak var navigationController: UINavigationController? + static func showAsRoot( + in navigationController: UINavigationController, + parent: AppleWatchFlowControllerParent + ) { + let viewController = AppleWatchViewController() + let flowController = AppleWatchFlowController(viewController: viewController) + flowController.parent = parent + flowController.navigationController = navigationController + let presenter = AppleWatchPresenter(flowController: flowController) + viewController.presenter = presenter + + navigationController.setViewControllers([viewController], animated: false) + } + static func push( in navigationController: UINavigationController, parent: AppleWatchFlowControllerParent diff --git a/TwoFAS/TwoFAS/Root/Modules/Settings/AppleWatch/View/AppleWatchViewController.swift b/TwoFAS/TwoFAS/Root/Modules/Settings/AppleWatch/View/AppleWatchViewController.swift index 57945caf..0c154826 100644 --- a/TwoFAS/TwoFAS/Root/Modules/Settings/AppleWatch/View/AppleWatchViewController.swift +++ b/TwoFAS/TwoFAS/Root/Modules/Settings/AppleWatch/View/AppleWatchViewController.swift @@ -34,5 +34,4 @@ final class AppleWatchViewController: UIViewController { hostingController.view.pinToParent() hostingController.didMove(toParent: self) } - } diff --git a/TwoFAS/TwoFAS/Root/Modules/Settings/Menu/Presenter/SettingsMenuPresenter.swift b/TwoFAS/TwoFAS/Root/Modules/Settings/Menu/Presenter/SettingsMenuPresenter.swift index 82b2a1b4..311ca7fe 100644 --- a/TwoFAS/TwoFAS/Root/Modules/Settings/Menu/Presenter/SettingsMenuPresenter.swift +++ b/TwoFAS/TwoFAS/Root/Modules/Settings/Menu/Presenter/SettingsMenuPresenter.swift @@ -50,7 +50,8 @@ extension SettingsMenuPresenter { case .about: return .about case .externalImport: return .externalImport case .appearance: return .appearance - default: return nil + case .appleWatch: return .appleWatch + case .faq, .donate: return nil } } @@ -164,6 +165,7 @@ extension SettingsMenuPresenter { case .about: navigate(to: .about) case .externalImport: navigate(to: .externalImport) case .appearance: navigate(to: .appearance) + case .appleWatch: navigate(to: .appleWatch) } } } diff --git a/TwoFAS/TwoFAS/Root/Modules/Settings/Settings/Flow/SettingsFlowController.swift b/TwoFAS/TwoFAS/Root/Modules/Settings/Settings/Flow/SettingsFlowController.swift index cf54404f..df1d5eb3 100644 --- a/TwoFAS/TwoFAS/Root/Modules/Settings/Settings/Flow/SettingsFlowController.swift +++ b/TwoFAS/TwoFAS/Root/Modules/Settings/Settings/Flow/SettingsFlowController.swift @@ -216,7 +216,11 @@ extension SettingsFlowController: SettingsMenuFlowControllerParent { } func toAppleWatch() { - AppleWatchFlowController.push(in: viewController.navigationNavi, parent: self) + if isCollapsed { + AppleWatchFlowController.push(in: viewController.navigationNavi, parent: self) + } else { + AppleWatchFlowController.showAsRoot(in: viewController.contentNavi, parent: self) + } } } extension SettingsFlowController: BackupMenuFlowControllerParent {