@@ -16,7 +16,7 @@ class LocationCoordinator: Coordinator, Presentable, Presenting {
16
16
private let tunnelManager : TunnelManager
17
17
private let relayCacheTracker : RelayCacheTracker
18
18
private let customListRepository : CustomListRepositoryProtocol
19
- private var cachedRelays : CachedRelays ?
19
+ private var cachedRelays : LocationRelays ?
20
20
21
21
let navigationController : UINavigationController
22
22
@@ -57,7 +57,8 @@ class LocationCoordinator: Coordinator, Presentable, Presenting {
57
57
let locationViewControllerWrapper = LocationViewControllerWrapper (
58
58
customListRepository: customListRepository,
59
59
constraints: tunnelManager. settings. relayConstraints,
60
- multihopEnabled: tunnelManager. settings. tunnelMultihopState == . on
60
+ multihopEnabled: tunnelManager. settings. tunnelMultihopState == . on,
61
+ daitaEnabled: tunnelManager. settings. daita. state == . on
61
62
)
62
63
locationViewControllerWrapper. delegate = self
63
64
@@ -69,8 +70,13 @@ class LocationCoordinator: Coordinator, Presentable, Presenting {
69
70
relayCacheTracker. addObserver ( self )
70
71
71
72
if let cachedRelays = try ? relayCacheTracker. getCachedRelays ( ) {
72
- self . cachedRelays = cachedRelays
73
- locationViewControllerWrapper. setCachedRelays ( cachedRelays, filter: relayFilter)
73
+ let locationRelays = LocationRelays (
74
+ relays: cachedRelays. relays. wireguard. relays,
75
+ locations: cachedRelays. relays. locations
76
+ )
77
+ self . cachedRelays = locationRelays
78
+
79
+ locationViewControllerWrapper. setCachedRelays ( locationRelays, filter: relayFilter)
74
80
}
75
81
76
82
navigationController. pushViewController ( locationViewControllerWrapper, animated: false )
@@ -87,7 +93,11 @@ class LocationCoordinator: Coordinator, Presentable, Presenting {
87
93
)
88
94
89
95
relayFilterCoordinator. didFinish = { [ weak self] coordinator, filter in
90
- if let cachedRelays = self ? . cachedRelays, let filter {
96
+ if var cachedRelays = self ? . cachedRelays, let filter {
97
+ cachedRelays. relays = cachedRelays. relays. filter { relay in
98
+ RelaySelector . relayMatchesFilter ( relay, filter: filter)
99
+ }
100
+
91
101
self ? . locationViewControllerWrapper? . setCachedRelays ( cachedRelays, filter: filter)
92
102
}
93
103
@@ -148,9 +158,13 @@ extension LocationCoordinator: RelayCacheTrackerObserver {
148
158
_ tracker: RelayCacheTracker ,
149
159
didUpdateCachedRelays cachedRelays: CachedRelays
150
160
) {
151
- self . cachedRelays = cachedRelays
161
+ let locationRelays = LocationRelays (
162
+ relays: cachedRelays. relays. wireguard. relays,
163
+ locations: cachedRelays. relays. locations
164
+ )
165
+ self . cachedRelays = locationRelays
152
166
153
- locationViewControllerWrapper? . setCachedRelays ( cachedRelays , filter: relayFilter)
167
+ locationViewControllerWrapper? . setCachedRelays ( locationRelays , filter: relayFilter)
154
168
}
155
169
}
156
170
@@ -178,6 +192,10 @@ extension LocationCoordinator: LocationViewControllerWrapperDelegate {
178
192
relayConstraints. filter = . only( filter)
179
193
180
194
tunnelManager. updateSettings ( [ . relayConstraints( relayConstraints) ] )
195
+
196
+ if let cachedRelays {
197
+ locationViewControllerWrapper? . setCachedRelays ( cachedRelays, filter: filter)
198
+ }
181
199
}
182
200
183
201
func navigateToFilter( ) {
0 commit comments