mirror of
https://github.com/twofas/2fas-ios.git
synced 2024-11-22 02:10:19 +01:00
Merge pull request #137 from twofas/bugfix/TF-1625
TF-1625] Save view path to AppleWatch
This commit is contained in:
commit
4eacc1a1a8
@ -29,6 +29,7 @@ public enum ViewPath: Equatable, Codable {
|
||||
case trash
|
||||
case about
|
||||
case appearance
|
||||
case appleWatch
|
||||
}
|
||||
|
||||
case main
|
||||
|
@ -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
|
||||
|
@ -34,5 +34,4 @@ final class AppleWatchViewController: UIViewController {
|
||||
hostingController.view.pinToParent()
|
||||
hostingController.didMove(toParent: self)
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user