Skip to content

Commit

Permalink
Merge branch 'bugfix/privacy-overlay' into beta-2.12.4
Browse files Browse the repository at this point in the history
  • Loading branch information
jurajhilje committed Sep 11, 2024
2 parents ca60f28 + f7ad688 commit 288ae47
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
13 changes: 2 additions & 11 deletions IVPNClient/Managers/ConnectionManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,6 @@ class ConnectionManager {
self.updateOpenVPNLogFile()
self.updateWireGuardLogFile()
self.reconnectAutomatically = false
if self.actionType == .connect {
self.evaluateCloseApp()
}
}
DispatchQueue.delay(2.5) {
if UserDefaults.shared.isV2ray && !V2RayCore.shared.reconnectWithV2ray {
Expand Down Expand Up @@ -128,10 +125,6 @@ class ConnectionManager {
}
}
}

if status == .disconnected && self.actionType == .disconnect {
self.evaluateCloseApp()
}

completion(status)
}
Expand Down Expand Up @@ -575,12 +568,10 @@ class ConnectionManager {
}
}

private func evaluateCloseApp() {
func evaluateCloseApp() {
if closeApp {
closeApp = false
DispatchQueue.delay(1.5) {
UIControl().sendAction(#selector(NSXPCConnection.suspend), to: UIApplication.shared, for: nil)
}
UIControl().sendAction(#selector(NSXPCConnection.suspend), to: UIApplication.shared, for: nil)
}
}

Expand Down
5 changes: 5 additions & 0 deletions IVPNClient/Scenes/MainScreen/MainViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,9 @@ class MainViewController: UIViewController {
if !model.isIvpnServer {
Application.shared.geoLookup = model
}

WidgetCenter.shared.reloadTimelines(ofKind: "IVPNWidget")
Application.shared.connectionManager.evaluateCloseApp()
case .failure:
controlPanel.controlPanelView.ipv4ViewModel = ProofsViewModel(displayMode: .error)
mainView.infoAlertViewModel.infoAlert = .connectionInfoFailure
Expand All @@ -180,6 +183,8 @@ class MainViewController: UIViewController {
case .success(let model):
controlPanel.controlPanelView.ipv6ViewModel = ProofsViewModel(model: model, displayMode: .content)
mainView.ipv6ViewModel = ProofsViewModel(model: model)
WidgetCenter.shared.reloadTimelines(ofKind: "IVPNWidget")
Application.shared.connectionManager.evaluateCloseApp()
case .failure:
controlPanel.controlPanelView.ipv6ViewModel = ProofsViewModel(displayMode: .error)
mainView.ipv6ViewModel = ProofsViewModel(displayMode: .error)
Expand Down

0 comments on commit 288ae47

Please sign in to comment.