From f71ee2277f836406e34f3a32be0f7ca22356a4d5 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Wed, 20 Mar 2019 04:24:23 +0100 Subject: [PATCH] macOS: Privacy notice is provided by system dialogs So it really doesn't make sense to add our own. This causes several popups when trying to add a tunnel, which is madness. --- WireGuard/WireGuard.xcodeproj/project.pbxproj | 4 --- .../UI/macOS/AppStorePrivacyNotice.swift | 29 ------------------- .../UI/macOS/ImportPanelPresenter.swift | 4 +-- .../TunnelEditViewController.swift | 18 +++++------- 4 files changed, 9 insertions(+), 46 deletions(-) delete mode 100644 WireGuard/WireGuard/UI/macOS/AppStorePrivacyNotice.swift diff --git a/WireGuard/WireGuard.xcodeproj/project.pbxproj b/WireGuard/WireGuard.xcodeproj/project.pbxproj index 89ecbdb..9a1c399 100644 --- a/WireGuard/WireGuard.xcodeproj/project.pbxproj +++ b/WireGuard/WireGuard.xcodeproj/project.pbxproj @@ -44,7 +44,6 @@ 6B6956362211DA80001B618A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6956352211DA80001B618A /* main.m */; }; 6B707D8421F918D4000A8F73 /* TunnelConfiguration+UapiConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B707D8321F918D4000A8F73 /* TunnelConfiguration+UapiConfig.swift */; }; 6B707D8621F918D4000A8F73 /* TunnelConfiguration+UapiConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B707D8321F918D4000A8F73 /* TunnelConfiguration+UapiConfig.swift */; }; - 6BAC16E6221634B300A5FB78 /* AppStorePrivacyNotice.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6BAC16E42216324B00A5FB78 /* AppStorePrivacyNotice.swift */; }; 6BD5C97B220D1AE200784E08 /* key.c in Sources */ = {isa = PBXBuildFile; fileRef = 6BD5C979220D1AE100784E08 /* key.c */; }; 6BD5C97C220D1AE200784E08 /* key.c in Sources */ = {isa = PBXBuildFile; fileRef = 6BD5C979220D1AE100784E08 /* key.c */; }; 6BD5C97D220D1AE200784E08 /* key.c in Sources */ = {isa = PBXBuildFile; fileRef = 6BD5C979220D1AE100784E08 /* key.c */; }; @@ -286,7 +285,6 @@ 6B62E45E220A6FA900EF34A6 /* PrivateDataConfirmation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrivateDataConfirmation.swift; sourceTree = ""; }; 6B6956352211DA80001B618A /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 6B707D8321F918D4000A8F73 /* TunnelConfiguration+UapiConfig.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "TunnelConfiguration+UapiConfig.swift"; sourceTree = ""; }; - 6BAC16E42216324B00A5FB78 /* AppStorePrivacyNotice.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppStorePrivacyNotice.swift; sourceTree = ""; }; 6BD5C979220D1AE100784E08 /* key.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = key.c; sourceTree = ""; }; 6BD5C97A220D1AE200784E08 /* key.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = key.h; sourceTree = ""; }; 6F0F44C8222D55BB00B0FF04 /* TextCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextCell.swift; sourceTree = ""; }; @@ -623,7 +621,6 @@ 6F4DD16721DA552B00690EAE /* NSTableView+Reuse.swift */, 5F52D0BE21E3788900283CEA /* NSColor+Hex.swift */, 6FFACD1E21E4D89600E9A2A5 /* ParseError+WireGuardAppError.swift */, - 6BAC16E42216324B00A5FB78 /* AppStorePrivacyNotice.swift */, ); path = macOS; sourceTree = ""; @@ -1257,7 +1254,6 @@ 6FB1BDCA21D50F1700A991BF /* x25519.c in Sources */, 6FB1BDCB21D50F1700A991BF /* Curve25519.swift in Sources */, 6B586C55220CBA6D00427C51 /* Data+KeyEncoding.swift in Sources */, - 6BAC16E6221634B300A5FB78 /* AppStorePrivacyNotice.swift in Sources */, 6FB17946222FD5960018AE71 /* OnDemandWiFiControls.swift in Sources */, 6FB1BDBB21D50F0200A991BF /* Localizable.strings in Sources */, 6FB1BDBC21D50F0200A991BF /* ringlogger.c in Sources */, diff --git a/WireGuard/WireGuard/UI/macOS/AppStorePrivacyNotice.swift b/WireGuard/WireGuard/UI/macOS/AppStorePrivacyNotice.swift deleted file mode 100644 index 15aeb8d..0000000 --- a/WireGuard/WireGuard/UI/macOS/AppStorePrivacyNotice.swift +++ /dev/null @@ -1,29 +0,0 @@ -// SPDX-License-Identifier: MIT -// Copyright © 2018-2019 WireGuard LLC. All Rights Reserved. - -import Cocoa - -class AppStorePrivacyNotice { - // The App Store Review Board does not comprehend the fact that this application - // is not a service and does not have any servers of its own. They therefore require - // us to give a notice regarding collection of user data using our non-existent - // servers. This demand is obviously impossible to fulfill, since it doesn't make sense, - // but we do our best here to show something in that category. - static func show(from sourceVC: NSViewController?, into tunnelsManager: TunnelsManager, _ callback: @escaping () -> Void) { - if tunnelsManager.numberOfTunnels() > 0 { - callback() - return - } - let alert = NSAlert() - - alert.messageText = tr("macPrivacyNoticeMessage") - alert.informativeText = tr("macPrivacyNoticeInfo") - alert.alertStyle = NSAlert.Style.warning - if let window = sourceVC?.view.window { - alert.beginSheetModal(for: window) { _ in callback() } - } else { - alert.runModal() - callback() - } - } -} diff --git a/WireGuard/WireGuard/UI/macOS/ImportPanelPresenter.swift b/WireGuard/WireGuard/UI/macOS/ImportPanelPresenter.swift index 67b074c..d081f8c 100644 --- a/WireGuard/WireGuard/UI/macOS/ImportPanelPresenter.swift +++ b/WireGuard/WireGuard/UI/macOS/ImportPanelPresenter.swift @@ -13,9 +13,7 @@ class ImportPanelPresenter { openPanel.beginSheetModal(for: window) { [weak tunnelsManager] response in guard let tunnelsManager = tunnelsManager else { return } guard response == .OK else { return } - AppStorePrivacyNotice.show(from: sourceVC, into: tunnelsManager) { - TunnelImporter.importFromFile(urls: openPanel.urls, into: tunnelsManager, sourceVC: sourceVC, errorPresenterType: ErrorPresenter.self) - } + TunnelImporter.importFromFile(urls: openPanel.urls, into: tunnelsManager, sourceVC: sourceVC, errorPresenterType: ErrorPresenter.self) } } } diff --git a/WireGuard/WireGuard/UI/macOS/ViewController/TunnelEditViewController.swift b/WireGuard/WireGuard/UI/macOS/ViewController/TunnelEditViewController.swift index 3d959cf..13433c0 100644 --- a/WireGuard/WireGuard/UI/macOS/ViewController/TunnelEditViewController.swift +++ b/WireGuard/WireGuard/UI/macOS/ViewController/TunnelEditViewController.swift @@ -243,17 +243,15 @@ class TunnelEditViewController: NSViewController { } } else { // We're creating a new tunnel - AppStorePrivacyNotice.show(from: self, into: tunnelsManager) { [weak self] in - self?.tunnelsManager.add(tunnelConfiguration: tunnelConfiguration, onDemandOption: onDemandOption) { [weak self] result in - self?.setUserInteractionEnabled(true) - if let error = result.error { - ErrorPresenter.showErrorAlert(error: error, from: self) - return - } - let tunnel: TunnelContainer = result.value! - self?.dismiss(self) - self?.delegate?.tunnelSaved(tunnel: tunnel) + self.tunnelsManager.add(tunnelConfiguration: tunnelConfiguration, onDemandOption: onDemandOption) { [weak self] result in + self?.setUserInteractionEnabled(true) + if let error = result.error { + ErrorPresenter.showErrorAlert(error: error, from: self) + return } + let tunnel: TunnelContainer = result.value! + self?.dismiss(self) + self?.delegate?.tunnelSaved(tunnel: tunnel) } } }