From 52477fcbce83bf9dcc9f5bfa7f4f64d63564e28c Mon Sep 17 00:00:00 2001 From: Philipp Schmid <25935690+phil1995@users.noreply.github.com> Date: Mon, 23 Jan 2023 20:24:52 +0100 Subject: [PATCH 1/3] Fix untrusted certificate alert not showing up --- Cryptomator/WebDAV/WebDAVAuthentication.swift | 29 ----------- .../WebDAVAuthenticationViewController.swift | 51 ++++++++++++++++++- 2 files changed, 50 insertions(+), 30 deletions(-) diff --git a/Cryptomator/WebDAV/WebDAVAuthentication.swift b/Cryptomator/WebDAV/WebDAVAuthentication.swift index de649a631..1a17f8fa2 100644 --- a/Cryptomator/WebDAV/WebDAVAuthentication.swift +++ b/Cryptomator/WebDAV/WebDAVAuthentication.swift @@ -42,35 +42,6 @@ struct WebDAVAuthentication: View { .introspectTableView(customize: { tableView in tableView.backgroundColor = .cryptomatorBackground }) - .alert(isPresented: $viewModel.showUntrustedCertificateError) { - untrustedCertificateAlert - } - .alert(isPresented: $viewModel.showAllowInsecureConnectionAlert) { - insecureConnectionAlert - } - } - - private var untrustedCertificateAlert: Alert { - Alert(title: Text(LocalizedString.getValue("untrustedTLSCertificate.title")), - message: Text(LocalizedString.getValue("untrustedTLSCertificate.message")), - primaryButton: .default(Text(LocalizedString.getValue("untrustedTLSCertificate.add")), - action: { - viewModel.allowCertificate() - }), - secondaryButton: .cancel(Text(LocalizedString.getValue("untrustedTLSCertificate.dismiss")))) - } - - private var insecureConnectionAlert: Alert { - Alert(title: Text(LocalizedString.getValue("webDAVAuthentication.httpConnection.alert.title")), - message: Text(LocalizedString.getValue("webDAVAuthentication.httpConnection.alert.message")), - primaryButton: .default(Text(LocalizedString.getValue("webDAVAuthentication.httpConnection.change")), - action: { - viewModel.saveAccountWithTransformedURL() - }), - secondaryButton: .destructive(Text(LocalizedString.getValue("webDAVAuthentication.httpConnection.continue")), - action: { - viewModel.saveAccountWithInsecureConnection() - })) } } diff --git a/Cryptomator/WebDAV/WebDAVAuthenticationViewController.swift b/Cryptomator/WebDAV/WebDAVAuthenticationViewController.swift index 3d3ca7e75..0ec35ae23 100644 --- a/Cryptomator/WebDAV/WebDAVAuthenticationViewController.swift +++ b/Cryptomator/WebDAV/WebDAVAuthenticationViewController.swift @@ -60,7 +60,11 @@ class WebDAVAuthenticationViewController: UIViewController { hud?.transformToSelfDismissingSuccess().then { self.coordinator?.authenticated(with: credential) } - case .initial, .insecureConnectionNotAllowed, .untrustedCertificate: + case .insecureConnectionNotAllowed: + showInsecureConnectionAlert() + case let .untrustedCertificate(certificate: certificate, url: url): + showUntrustedCertificateAlert(certificate: certificate, url: url) + case .initial: break } } @@ -86,6 +90,51 @@ class WebDAVAuthenticationViewController: UIViewController { hud?.showLoadingIndicator() } + private func showUntrustedCertificateAlert(certificate: TLSCertificate, url: URL) { + let precondition: Promise + if let hud = hud { + precondition = hud.dismiss(animated: true) + } else { + precondition = Promise(()) + } + precondition.then { [weak self] in + let message = String(format: LocalizedString.getValue("untrustedTLSCertificate.message"), url.absoluteString, certificate.fingerprint) + let alertController = UIAlertController(title: LocalizedString.getValue("untrustedTLSCertificate.title"), + message: message, + preferredStyle: .alert) + let addAction = UIAlertAction(title: LocalizedString.getValue("untrustedTLSCertificate.add"), + style: .default, + handler: { _ in self?.viewModel.allowCertificate() }) + alertController.addAction(addAction) + alertController.addAction(UIAlertAction(title: LocalizedString.getValue("untrustedTLSCertificate.dismiss"), style: .cancel)) + self?.present(alertController, animated: true) + } + } + + private func showInsecureConnectionAlert() { + let precondition: Promise + if let hud = hud { + precondition = hud.dismiss(animated: true) + } else { + precondition = Promise(()) + } + precondition.then { [weak self] in + let alertController = UIAlertController(title: LocalizedString.getValue("webDAVAuthentication.httpConnection.alert.title"), + message: LocalizedString.getValue("webDAVAuthentication.httpConnection.alert.message"), + preferredStyle: .alert) + let changeToHTTPSAction = UIAlertAction(title: LocalizedString.getValue("webDAVAuthentication.httpConnection.change"), style: .default, handler: { _ in + self?.viewModel.saveAccountWithTransformedURL() + }) + + alertController.addAction(changeToHTTPSAction) + alertController.preferredAction = changeToHTTPSAction + alertController.addAction(UIAlertAction(title: LocalizedString.getValue("webDAVAuthentication.httpConnection.continue"), style: .destructive, handler: { _ in + self?.viewModel.saveAccountWithInsecureConnection() + })) + self?.present(alertController, animated: true) + } + } + @objc func cancel() { coordinator?.cancel() } From 3e6c7418022b874de396f9f9e2ef2f254d5bb440 Mon Sep 17 00:00:00 2001 From: Tobias Hagemann Date: Mon, 23 Jan 2023 21:07:01 +0100 Subject: [PATCH 2/3] Fixed automatic proceeding after trusting TLS certificate --- Cryptomator/WebDAV/WebDAVAuthenticationViewController.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cryptomator/WebDAV/WebDAVAuthenticationViewController.swift b/Cryptomator/WebDAV/WebDAVAuthenticationViewController.swift index 0ec35ae23..fb32dafa3 100644 --- a/Cryptomator/WebDAV/WebDAVAuthenticationViewController.swift +++ b/Cryptomator/WebDAV/WebDAVAuthenticationViewController.swift @@ -104,7 +104,7 @@ class WebDAVAuthenticationViewController: UIViewController { preferredStyle: .alert) let addAction = UIAlertAction(title: LocalizedString.getValue("untrustedTLSCertificate.add"), style: .default, - handler: { _ in self?.viewModel.allowCertificate() }) + handler: { _ in self?.viewModel.saveAccountWithCertificate() }) alertController.addAction(addAction) alertController.addAction(UIAlertAction(title: LocalizedString.getValue("untrustedTLSCertificate.dismiss"), style: .cancel)) self?.present(alertController, animated: true) From 68cba49b7a2576faeed3f789c64dc38fcb87a329 Mon Sep 17 00:00:00 2001 From: Tobias Hagemann Date: Mon, 23 Jan 2023 21:20:41 +0100 Subject: [PATCH 3/3] Preparing 2.4.5 --- Cryptomator.xcodeproj/project.pbxproj | 4 ++-- fastlane/changelog.txt | 5 +---- fastlane/config/freemium/metadata/de-DE/release_notes.txt | 5 +---- fastlane/config/freemium/metadata/en-US/release_notes.txt | 5 +---- fastlane/config/premium/metadata/de-DE/release_notes.txt | 5 +---- fastlane/config/premium/metadata/en-US/release_notes.txt | 5 +---- 6 files changed, 7 insertions(+), 22 deletions(-) diff --git a/Cryptomator.xcodeproj/project.pbxproj b/Cryptomator.xcodeproj/project.pbxproj index 960ebd328..caf0d01b3 100644 --- a/Cryptomator.xcodeproj/project.pbxproj +++ b/Cryptomator.xcodeproj/project.pbxproj @@ -3260,7 +3260,7 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 13.0; - MARKETING_VERSION = 2.4.4; + MARKETING_VERSION = 2.4.5; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; ONLY_ACTIVE_ARCH = YES; @@ -3322,7 +3322,7 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 13.0; - MARKETING_VERSION = 2.4.4; + MARKETING_VERSION = 2.4.5; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; OTHER_SWIFT_FLAGS = "-Xfrontend -warn-long-expression-type-checking=200 -Xfrontend -warn-long-function-bodies=200"; diff --git a/fastlane/changelog.txt b/fastlane/changelog.txt index cb46f4ad6..42e37f333 100644 --- a/fastlane/changelog.txt +++ b/fastlane/changelog.txt @@ -1,4 +1 @@ -- Added download progress indication to Google Drive and WebDAV (#276, #293) -- Added upload progress indication to WebDAV (#293) -- Added background download/upload support to pCloud (#218, #293) -- Fixed error when trying to use self-signed certificates with WebDAV (#291) \ No newline at end of file +- Fixed adding WebDAV connection stuck at "Authenticating…" when using self-signed certificate (#295, #298) \ No newline at end of file diff --git a/fastlane/config/freemium/metadata/de-DE/release_notes.txt b/fastlane/config/freemium/metadata/de-DE/release_notes.txt index bdcf8292b..8aea35901 100644 --- a/fastlane/config/freemium/metadata/de-DE/release_notes.txt +++ b/fastlane/config/freemium/metadata/de-DE/release_notes.txt @@ -1,4 +1 @@ -- Anzeige des Download-Fortschritts zu Google Drive und WebDAV hinzugefügt (#276, #293) -- Anzeige des Upload-Fortschritts zu WebDAV hinzugefügt (#293) -- Hintergrund-Download/Upload-Unterstützung zu pCloud hinzugefügt (#218, #293) -- Fehler behoben, wenn versucht wurde, selbstsignierte Zertifikate mit WebDAV zu verwenden (#291) \ No newline at end of file +- Hinzufügen von WebDAV-Verbindungen behoben, die bei "Authentifizierung …" hingen, wenn ein selbstsigniertes Zertifikat verwendet wurde (#295, #298) \ No newline at end of file diff --git a/fastlane/config/freemium/metadata/en-US/release_notes.txt b/fastlane/config/freemium/metadata/en-US/release_notes.txt index cb46f4ad6..42e37f333 100644 --- a/fastlane/config/freemium/metadata/en-US/release_notes.txt +++ b/fastlane/config/freemium/metadata/en-US/release_notes.txt @@ -1,4 +1 @@ -- Added download progress indication to Google Drive and WebDAV (#276, #293) -- Added upload progress indication to WebDAV (#293) -- Added background download/upload support to pCloud (#218, #293) -- Fixed error when trying to use self-signed certificates with WebDAV (#291) \ No newline at end of file +- Fixed adding WebDAV connection stuck at "Authenticating…" when using self-signed certificate (#295, #298) \ No newline at end of file diff --git a/fastlane/config/premium/metadata/de-DE/release_notes.txt b/fastlane/config/premium/metadata/de-DE/release_notes.txt index bdcf8292b..8aea35901 100644 --- a/fastlane/config/premium/metadata/de-DE/release_notes.txt +++ b/fastlane/config/premium/metadata/de-DE/release_notes.txt @@ -1,4 +1 @@ -- Anzeige des Download-Fortschritts zu Google Drive und WebDAV hinzugefügt (#276, #293) -- Anzeige des Upload-Fortschritts zu WebDAV hinzugefügt (#293) -- Hintergrund-Download/Upload-Unterstützung zu pCloud hinzugefügt (#218, #293) -- Fehler behoben, wenn versucht wurde, selbstsignierte Zertifikate mit WebDAV zu verwenden (#291) \ No newline at end of file +- Hinzufügen von WebDAV-Verbindungen behoben, die bei "Authentifizierung …" hingen, wenn ein selbstsigniertes Zertifikat verwendet wurde (#295, #298) \ No newline at end of file diff --git a/fastlane/config/premium/metadata/en-US/release_notes.txt b/fastlane/config/premium/metadata/en-US/release_notes.txt index cb46f4ad6..42e37f333 100644 --- a/fastlane/config/premium/metadata/en-US/release_notes.txt +++ b/fastlane/config/premium/metadata/en-US/release_notes.txt @@ -1,4 +1 @@ -- Added download progress indication to Google Drive and WebDAV (#276, #293) -- Added upload progress indication to WebDAV (#293) -- Added background download/upload support to pCloud (#218, #293) -- Fixed error when trying to use self-signed certificates with WebDAV (#291) \ No newline at end of file +- Fixed adding WebDAV connection stuck at "Authenticating…" when using self-signed certificate (#295, #298) \ No newline at end of file