Merge pull request #137 from twofas/bugfix/TF-1625

TF-1625] Save view path to AppleWatch
This commit is contained in:
gmachnio 2024-08-12 23:43:59 +02:00 committed by GitHub
commit 4eacc1a1a8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 23 additions and 3 deletions

View File

@ -29,6 +29,7 @@ public enum ViewPath: Equatable, Codable {
case trash case trash
case about case about
case appearance case appearance
case appleWatch
} }
case main case main

View File

@ -32,6 +32,20 @@ final class AppleWatchFlowController: FlowController {
private weak var parent: AppleWatchFlowControllerParent? private weak var parent: AppleWatchFlowControllerParent?
private weak var navigationController: UINavigationController? 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( static func push(
in navigationController: UINavigationController, in navigationController: UINavigationController,
parent: AppleWatchFlowControllerParent parent: AppleWatchFlowControllerParent

View File

@ -34,5 +34,4 @@ final class AppleWatchViewController: UIViewController {
hostingController.view.pinToParent() hostingController.view.pinToParent()
hostingController.didMove(toParent: self) hostingController.didMove(toParent: self)
} }
} }

View File

@ -50,7 +50,8 @@ extension SettingsMenuPresenter {
case .about: return .about case .about: return .about
case .externalImport: return .externalImport case .externalImport: return .externalImport
case .appearance: return .appearance 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 .about: navigate(to: .about)
case .externalImport: navigate(to: .externalImport) case .externalImport: navigate(to: .externalImport)
case .appearance: navigate(to: .appearance) case .appearance: navigate(to: .appearance)
case .appleWatch: navigate(to: .appleWatch)
} }
} }
} }

View File

@ -216,7 +216,11 @@ extension SettingsFlowController: SettingsMenuFlowControllerParent {
} }
func toAppleWatch() { 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 { extension SettingsFlowController: BackupMenuFlowControllerParent {