Skip to content

Commit

Permalink
Merge branch 'bugfix/ios18-shortcuts' into beta-2.12.4
Browse files Browse the repository at this point in the history
  • Loading branch information
jurajhilje committed Sep 4, 2024
2 parents 7c8c03c + 9bc236e commit 94a80b5
Show file tree
Hide file tree
Showing 12 changed files with 223 additions and 230 deletions.
16 changes: 8 additions & 8 deletions IVPNClient.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
8206BAFF29ED6FFF00F916B7 /* ConnectionInfoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8206BAFE29ED6FFF00F916B7 /* ConnectionInfoView.swift */; };
8206BB0129ED7BEE00F916B7 /* ConnectionInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8206BB0029ED7BEE00F916B7 /* ConnectionInfo.swift */; };
8206BB0329ED7C3700F916B7 /* ConnectionInfoViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8206BB0229ED7C3700F916B7 /* ConnectionInfoViewModel.swift */; };
8206E5D022967E37003119AF /* UserActivityType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8206E5CF22967E37003119AF /* UserActivityType.swift */; };
8206E5D222967EAF003119AF /* UserActivityTitle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8206E5D122967EAF003119AF /* UserActivityTitle.swift */; };
8206F32124347A8F0056B465 /* MainView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8206F32024347A8F0056B465 /* MainView.swift */; };
8206F32324367A240056B465 /* VPNErrorObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8206F32224367A240056B465 /* VPNErrorObserver.swift */; };
8208525623FD56870008C112 /* FloatingPanelMainLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8208525523FD56870008C112 /* FloatingPanelMainLayout.swift */; };
Expand Down Expand Up @@ -151,6 +149,7 @@
828772F7221C008100D5E330 /* ServerConfigurationCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 828772F6221C008100D5E330 /* ServerConfigurationCell.swift */; };
828772F9221C01C300D5E330 /* ServersConfigurationTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 828772F8221C01C300D5E330 /* ServersConfigurationTableViewController.swift */; };
828772FB221C28E000D5E330 /* FlagImageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 828772FA221C28E000D5E330 /* FlagImageView.swift */; };
828C45692C88772E0064F365 /* AppIntentsHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 828C45682C8877290064F365 /* AppIntentsHandler.swift */; };
828D8A6D258245AD00CB0E5B /* TwoFactorViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 828D8A6C258245AD00CB0E5B /* TwoFactorViewController.swift */; };
828E9C95231E5780001E1FCF /* Data+Ext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 828E9C94231E5780001E1FCF /* Data+Ext.swift */; };
828E9C96231E5780001E1FCF /* Data+Ext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 828E9C94231E5780001E1FCF /* Data+Ext.swift */; };
Expand Down Expand Up @@ -267,6 +266,7 @@
82DB75EE239E766A0073E846 /* NEVPNStatusTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 82DB75ED239E766A0073E846 /* NEVPNStatusTests.swift */; };
82DC75BC22B277D200D3C73C /* APIClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 82DC75BB22B277D200D3C73C /* APIClient.swift */; };
82DC75BD22B7647500D3C73C /* APIClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 82DC75BB22B277D200D3C73C /* APIClient.swift */; };
82DE85712C8861CB00501935 /* AppIntents.swift in Sources */ = {isa = PBXBuildFile; fileRef = 82DE85702C8861CB00501935 /* AppIntents.swift */; };
82DEF01E244714D900CCB5CD /* ScannerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 82DEF01D244714D900CCB5CD /* ScannerViewController.swift */; };
82DEF021244714F000CCB5CD /* ScannerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 82DEF020244714F000CCB5CD /* ScannerView.swift */; };
82DEF0262447285F00CCB5CD /* CreateAccountViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 82DEF0252447285F00CCB5CD /* CreateAccountViewController.swift */; };
Expand Down Expand Up @@ -471,8 +471,6 @@
8206BAFE29ED6FFF00F916B7 /* ConnectionInfoView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConnectionInfoView.swift; sourceTree = "<group>"; };
8206BB0029ED7BEE00F916B7 /* ConnectionInfo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConnectionInfo.swift; sourceTree = "<group>"; };
8206BB0229ED7C3700F916B7 /* ConnectionInfoViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConnectionInfoViewModel.swift; sourceTree = "<group>"; };
8206E5CF22967E37003119AF /* UserActivityType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserActivityType.swift; sourceTree = "<group>"; };
8206E5D122967EAF003119AF /* UserActivityTitle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserActivityTitle.swift; sourceTree = "<group>"; };
8206F32024347A8F0056B465 /* MainView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainView.swift; sourceTree = "<group>"; };
8206F32224367A240056B465 /* VPNErrorObserver.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VPNErrorObserver.swift; sourceTree = "<group>"; };
8208525523FD56870008C112 /* FloatingPanelMainLayout.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FloatingPanelMainLayout.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -587,6 +585,7 @@
828772F6221C008100D5E330 /* ServerConfigurationCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ServerConfigurationCell.swift; sourceTree = "<group>"; };
828772F8221C01C300D5E330 /* ServersConfigurationTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ServersConfigurationTableViewController.swift; sourceTree = "<group>"; };
828772FA221C28E000D5E330 /* FlagImageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FlagImageView.swift; sourceTree = "<group>"; };
828C45682C8877290064F365 /* AppIntentsHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppIntentsHandler.swift; sourceTree = "<group>"; };
828D8A6C258245AD00CB0E5B /* TwoFactorViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TwoFactorViewController.swift; sourceTree = "<group>"; };
828E9C94231E5780001E1FCF /* Data+Ext.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Data+Ext.swift"; sourceTree = "<group>"; };
8290195E243CB27500777B6E /* ControlPanelView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ControlPanelView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -674,6 +673,7 @@
82DB75EB239E75EB0073E846 /* NEVPNStatus+Ext.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NEVPNStatus+Ext.swift"; sourceTree = "<group>"; };
82DB75ED239E766A0073E846 /* NEVPNStatusTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NEVPNStatusTests.swift; sourceTree = "<group>"; };
82DC75BB22B277D200D3C73C /* APIClient.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = APIClient.swift; sourceTree = "<group>"; };
82DE85702C8861CB00501935 /* AppIntents.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppIntents.swift; sourceTree = "<group>"; };
82DEF01D244714D900CCB5CD /* ScannerViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScannerViewController.swift; sourceTree = "<group>"; };
82DEF020244714F000CCB5CD /* ScannerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScannerView.swift; sourceTree = "<group>"; };
82DEF0252447285F00CCB5CD /* CreateAccountViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreateAccountViewController.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -925,6 +925,7 @@
82C1D5BD23FE8BD90059A915 /* ControlPanel */,
8208525723FD5EB20008C112 /* MainViewController.swift */,
8208525B23FD64160008C112 /* MainViewController+Ext.swift */,
828C45682C8877290064F365 /* AppIntentsHandler.swift */,
);
path = MainScreen;
sourceTree = "<group>";
Expand Down Expand Up @@ -1032,6 +1033,7 @@
827694F2263C04C40058B4DC /* LoginConfirmation.swift */,
821CA2DE288143470067F70D /* PortRange.swift */,
825ECB2B2A5582570032E986 /* AntiTrackerDns.swift */,
82DE85702C8861CB00501935 /* AppIntents.swift */,
);
path = Models;
sourceTree = "<group>";
Expand Down Expand Up @@ -1192,8 +1194,6 @@
82E716832181E8E100D6B7C2 /* ProviderConfigurationKeys.swift */,
82D598B321A5A7A3000FABDE /* NetworkTrust.swift */,
82D598C721A6ADF1000FABDE /* NetworkType.swift */,
8206E5CF22967E37003119AF /* UserActivityType.swift */,
8206E5D122967EAF003119AF /* UserActivityTitle.swift */,
823FFB062338DF1800F91A5D /* Capability.swift */,
8229209F2480FA3600476FC1 /* ServersSort.swift */,
826FBDA22461847D00B9E464 /* ServiceType.swift */,
Expand Down Expand Up @@ -2285,7 +2285,6 @@
82D598BC21A6949F000FABDE /* StorageManager.swift in Sources */,
826FBDA32461847D00B9E464 /* ServiceType.swift in Sources */,
821429B922FC2EA40056B8FF /* ApiService+Ext.swift in Sources */,
8206E5D222967EAF003119AF /* UserActivityTitle.swift in Sources */,
82E716902181E90500D6B7C2 /* ConnectionSettings.swift in Sources */,
8223C54C22E9E93A00CD283D /* Session.swift in Sources */,
822563922431E03A00AE7F8D /* AccountView.swift in Sources */,
Expand Down Expand Up @@ -2334,6 +2333,7 @@
8292E1A92174C11600123538 /* Interface.swift in Sources */,
82F638CC217DC25600410318 /* CIDRAddress.swift in Sources */,
824B86D226D40E7800D0101A /* FileManager+Extension.swift in Sources */,
828C45692C88772E0064F365 /* AppIntentsHandler.swift in Sources */,
8208525A23FD5F670008C112 /* FloatingPanelController+Ext.swift in Sources */,
821429B722FC2BE90056B8FF /* Result.swift in Sources */,
827855B92472B27F00B3B6BD /* Account.swift in Sources */,
Expand All @@ -2357,7 +2357,6 @@
82A3422524AB6AF700761AB0 /* Double+Ext.swift in Sources */,
8221377B2227E75E001E1BF5 /* CustomDNSViewController.swift in Sources */,
9C3031351DB42EF900C38B0C /* Application.swift in Sources */,
8206E5D022967E37003119AF /* UserActivityType.swift in Sources */,
82A6D74A24A3780B00D6C0E1 /* ConnectToServerPopupView.swift in Sources */,
828772FB221C28E000D5E330 /* FlagImageView.swift in Sources */,
8228C8D22B1DE906005977D3 /* PurchaseManager.swift in Sources */,
Expand Down Expand Up @@ -2392,6 +2391,7 @@
82DEF01E244714D900CCB5CD /* ScannerViewController.swift in Sources */,
8270D268241BB3D100B17B65 /* InfoAlertViewModel.swift in Sources */,
826E614A242A1CA80064F195 /* AccountViewModel.swift in Sources */,
82DE85712C8861CB00501935 /* AppIntents.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
124 changes: 0 additions & 124 deletions IVPNClient/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -171,99 +171,6 @@ class AppDelegate: UIResponder {
}
}

private func userActivityConnect() {
DispatchQueue.delay(0.75) {
if UserDefaults.shared.networkProtectionEnabled {
Application.shared.connectionManager.resetRulesAndConnectShortcut(closeApp: true, actionType: .connect)
return
}
Application.shared.connectionManager.connectShortcut(closeApp: true, actionType: .connect)
}
}

private func userActivityDisconnect() {
DispatchQueue.delay(0.75) {
if UserDefaults.shared.networkProtectionEnabled {
Application.shared.connectionManager.resetRulesAndDisconnectShortcut(closeApp: true, actionType: .disconnect)
return
}
Application.shared.connectionManager.disconnectShortcut(closeApp: true, actionType: .disconnect)
}
}

private func userActivityAntiTrackerEnable() {
DispatchQueue.async {
if let viewController = UIApplication.topViewController() {
if Application.shared.settings.connectionProtocol.tunnelType() == .ipsec {
viewController.showAlert(title: "IKEv2 not supported", message: "AntiTracker is supported only for OpenVPN and WireGuard protocols.") { _ in
}
return
}

UserDefaults.shared.set(true, forKey: UserDefaults.Key.isAntiTracker)
NotificationCenter.default.post(name: Notification.Name.AntiTrackerUpdated, object: nil)
if UIApplication.topViewController() as? MainViewController != nil {
NotificationCenter.default.post(name: Notification.Name.EvaluateReconnect, object: nil)
} else {
viewController.evaluateReconnect(sender: viewController.view)
}
}
}
}

private func userActivityAntiTrackerDisable() {
DispatchQueue.async {
if let viewController = UIApplication.topViewController() {
UserDefaults.shared.set(false, forKey: UserDefaults.Key.isAntiTracker)
NotificationCenter.default.post(name: Notification.Name.AntiTrackerUpdated, object: nil)
if UIApplication.topViewController() as? MainViewController != nil {
NotificationCenter.default.post(name: Notification.Name.EvaluateReconnect, object: nil)
} else {
viewController.evaluateReconnect(sender: viewController.view)
}
}
}
}

private func userActivityCustomDNSEnable() {
DispatchQueue.async {
if let viewController = UIApplication.topViewController() {
if Application.shared.settings.connectionProtocol.tunnelType() == .ipsec {
viewController.showAlert(title: "IKEv2 not supported", message: "Custom DNS is supported only for OpenVPN and WireGuard protocols.") { _ in
}
return
}

guard !UserDefaults.shared.customDNS.isEmpty else {
viewController.showAlert(title: "", message: "Please enter DNS server info")
return
}

UserDefaults.shared.set(true, forKey: UserDefaults.Key.isCustomDNS)
NotificationCenter.default.post(name: Notification.Name.CustomDNSUpdated, object: nil)
if UIApplication.topViewController() as? MainViewController != nil {
NotificationCenter.default.post(name: Notification.Name.EvaluateReconnect, object: nil)
} else {
viewController.evaluateReconnect(sender: viewController.view)
}
}
}
}

private func userActivityCustomDNSDisable() {
DispatchQueue.async {
if let viewController = UIApplication.topViewController() {
UserDefaults.shared.set(false, forKey: UserDefaults.Key.isCustomDNS)
NotificationCenter.default.post(name: Notification.Name.CustomDNSUpdated, object: nil)
if UIApplication.topViewController() as? MainViewController != nil {
NotificationCenter.default.post(name: Notification.Name.EvaluateReconnect, object: nil)
} else {
viewController.evaluateReconnect(sender: viewController.view)
}
}
}
}

private func startPurchaseObserver() {
PurchaseManager.shared.delegate = self
PurchaseManager.shared.startObserver()
Expand Down Expand Up @@ -354,37 +261,6 @@ extension AppDelegate: UIApplicationDelegate {
return true
}

func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
if let url = userActivity.webpageURL {
let endpoint = url.lastPathComponent
handleURLEndpoint(endpoint)
return false
}

guard Application.shared.authentication.isLoggedIn, Application.shared.serviceStatus.isActive else {
return false
}

switch userActivity.activityType {
case UserActivityType.Connect:
userActivityConnect()
case UserActivityType.Disconnect:
userActivityDisconnect()
case UserActivityType.AntiTrackerEnable:
userActivityAntiTrackerEnable()
case UserActivityType.AntiTrackerDisable:
userActivityAntiTrackerDisable()
case UserActivityType.CustomDNSEnable:
userActivityCustomDNSEnable()
case UserActivityType.CustomDNSDisable:
userActivityCustomDNSDisable()
default:
log(.info, message: "No such user activity")
}

return false
}

}

// MARK: - PurchaseManagerDelegate -
Expand Down
33 changes: 0 additions & 33 deletions IVPNClient/Enums/UserActivityTitle.swift

This file was deleted.

33 changes: 0 additions & 33 deletions IVPNClient/Enums/UserActivityType.swift

This file was deleted.

Loading

0 comments on commit 94a80b5

Please sign in to comment.