Skip to content

Commit

Permalink
Prevent location view from being updated on every settings update
Browse files Browse the repository at this point in the history
  • Loading branch information
rablador committed Nov 6, 2024
1 parent 82f31fb commit 3e50ed4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion ios/MullvadVPN/Coordinators/LocationCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class LocationCoordinator: Coordinator, Presentable, Presenting {
private let relayCacheTracker: RelayCacheTracker
private let customListRepository: CustomListRepositoryProtocol
private var locationRelays: LocationRelays?
private var daitaSettings: DAITASettings

let navigationController: UINavigationController

Expand Down Expand Up @@ -52,6 +53,8 @@ class LocationCoordinator: Coordinator, Presentable, Presenting {
self.tunnelManager = tunnelManager
self.relayCacheTracker = relayCacheTracker
self.customListRepository = customListRepository

daitaSettings = tunnelManager.settings.daita
}

func start() {
Expand Down Expand Up @@ -99,7 +102,9 @@ class LocationCoordinator: Coordinator, Presentable, Presenting {
let tunnelObserver =
TunnelBlockObserver(
didUpdateTunnelSettings: { [weak self] _, settings in
guard let self, let locationRelays else { return }
guard let self, let locationRelays, settings.daita != daitaSettings else { return }
daitaSettings = settings.daita

locationViewControllerWrapper?.onDaitaSettingsUpdate(
settings.daita,
relaysWithLocation: locationRelays,
Expand Down

0 comments on commit 3e50ed4

Please sign in to comment.