AusweisApp2/patches/qt-Avoid-using-deprecated-A...

74 lines
2.7 KiB
Diff

From 26383dba15ceed74b36dd71e5b1837c63aade927 Mon Sep 17 00:00:00 2001
From: Lars Schmertmann <Lars.Schmertmann@governikus.de>
Date: Thu, 14 Sep 2017 12:47:11 +0200
Subject: Avoid using deprecated APIs on iOS 10.0+
Change-Id: Ic9dc6a24ef793a29c2652ad37bc11120e2e6ceef
---
src/gui/util/qdesktopservices.cpp | 13 +++++++++++++
src/plugins/platforms/ios/qiosservices.mm | 14 ++++++++++++--
2 files changed, 25 insertions(+), 2 deletions(-)
diff --git x/qtbase/src/gui/util/qdesktopservices.cpp y/qtbase/src/gui/util/qdesktopservices.cpp
index c9747877f7..77ccc02aa5 100644
--- x/qtbase/src/gui/util/qdesktopservices.cpp
+++ y/qtbase/src/gui/util/qdesktopservices.cpp
@@ -177,6 +177,19 @@ void QOpenUrlHandlerRegistry::handlerDestroyed(QObject *handler)
still fail to launch or fail to open the requested URL. This result will not be reported back
to the application.
+ \warning URLs passed to this function on iOS will not load unless their schemes are
+ listed in the \c LSApplicationQueriesSchemes key of the application's Info.plist file.
+ For more information, see the Apple Developer Documentation for
+ \l{https://developer.apple.com/documentation/uikit/uiapplication/1622952-canopenurl}{canOpenURL(_:)}.
+ For example, the following lines enable URLs with the HTTPS scheme:
+
+ \code
+ <key>LSApplicationQueriesSchemes</key>
+ <array>
+ <string>https</string>
+ </array>
+ \endcode
+
\sa setUrlHandler()
*/
bool QDesktopServices::openUrl(const QUrl &url)
diff --git x/qtbase/src/plugins/platforms/ios/qiosservices.mm y/qtbase/src/plugins/platforms/ios/qiosservices.mm
index 0ecc8e123f..a963a5c05d 100644
--- x/qtbase/src/plugins/platforms/ios/qiosservices.mm
+++ y/qtbase/src/plugins/platforms/ios/qiosservices.mm
@@ -41,6 +41,7 @@
#include <QtCore/qurl.h>
#include <QtGui/qdesktopservices.h>
+#include <QOperatingSystemVersion>
#import <UIKit/UIApplication.h>
@@ -55,11 +56,20 @@ bool QIOSServices::openUrl(const QUrl &url)
return openDocument(url);
NSURL *nsUrl = url.toNSURL();
+ UIApplication *application = [UIApplication sharedApplication];
- if (![[UIApplication sharedApplication] canOpenURL:nsUrl])
+ if (![application canOpenURL:nsUrl])
return false;
- return [[UIApplication sharedApplication] openURL:nsUrl];
+#if QT_DARWIN_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_NA, 100000, 100000, __WATCHOS_NA)
+ if (QOperatingSystemVersion::current() >= QOperatingSystemVersion(QOperatingSystemVersion::IOS, 10)) {
+ [application openURL:nsUrl options:@{} completionHandler:nil];
+ return true;
+ } else
+#endif
+ {
+ return [application openURL:nsUrl];
+ }
}
bool QIOSServices::openDocument(const QUrl &url)
--
2.14.1