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/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..fb32dafa3 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.saveAccountWithCertificate() }) + 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() } 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