-
Notifications
You must be signed in to change notification settings - Fork 384
/
Copy pathVPNSettingsCoordinator.swift
56 lines (47 loc) · 1.66 KB
/
VPNSettingsCoordinator.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
//
// VPNSettingsCoordinator.swift
// MullvadVPN
//
// Created by Jon Petersson on 2024-03-18.
// Copyright © 2024 Mullvad VPN AB. All rights reserved.
//
import MullvadSettings
import MullvadTypes
import Routing
import UIKit
class VPNSettingsCoordinator: Coordinator, Presenting, SettingsChildCoordinator {
private let navigationController: UINavigationController
private let interactorFactory: SettingsInteractorFactory
private let ipOverrideRepository: IPOverrideRepositoryProtocol
var presentationContext: UIViewController {
navigationController
}
init(
navigationController: UINavigationController,
interactorFactory: SettingsInteractorFactory,
ipOverrideRepository: IPOverrideRepositoryProtocol
) {
self.navigationController = navigationController
self.interactorFactory = interactorFactory
self.ipOverrideRepository = ipOverrideRepository
}
func start(animated: Bool) {
let controller = VPNSettingsViewController(
interactor: interactorFactory.makeVPNSettingsInteractor(),
alertPresenter: AlertPresenter(context: self)
)
controller.delegate = self
navigationController.pushViewController(controller, animated: animated)
}
}
extension VPNSettingsCoordinator: VPNSettingsViewControllerDelegate {
func showIPOverrides() {
let coordinator = IPOverrideCoordinator(
navigationController: navigationController,
repository: ipOverrideRepository,
tunnelManager: interactorFactory.tunnelManager
)
addChild(coordinator)
coordinator.start(animated: true)
}
}