summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/ios/qiosintegration.mm
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@qt.io>2016-09-28 13:58:56 +0200
committerRichard Moe Gustavsen <richard.gustavsen@qt.io>2016-10-26 08:55:10 +0000
commit99ce5d5e85007cb656cd48ab161be14af8f16238 (patch)
tree45a1f975156cd16fd5505793de0ca3df583cad45 /src/plugins/platforms/ios/qiosintegration.mm
parent60dbd80e5a26182b3ed9e2c60bb7212dfd32632b (diff)
iOS: refactor usage of photos into optional plugin
Starting from iOS 10, apps that tries to access photos on the device need to specify the reason for this up front by adding the key 'NSPhotoLibraryUsageDescription' into Info.plist. If the key is missing, the app will be rejected from AppStore. This causes problems for the iOS plugin as it stands since parts of it already tries to access photos, e.g to show an image picker dialog if a file dialog is set to open QStandardPaths::PicturesLocation. This means that currently, all apps written with Qt will be rejected from AppStore unless the developer adds this key, whether he tries to access photos or not. To solve this, we choose to split the plugin into two parts, one that contains the core functionality, and one that contains optional support. The latter will need to be enabled explicit by the developer in the pro file, or in this case, indirectly by adding the right key to the Info.plist. This patch refactors the code in the plugin that gives access to photos into a separate optional plugin called 'nsphotolibrarysupport'. Change-Id: Ic4351eb0bbfffdf840fd88cd00bb29a25907798f Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Diffstat (limited to 'src/plugins/platforms/ios/qiosintegration.mm')
-rw-r--r--src/plugins/platforms/ios/qiosintegration.mm8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/plugins/platforms/ios/qiosintegration.mm b/src/plugins/platforms/ios/qiosintegration.mm
index 85b5c477cc..d33c8cf47c 100644
--- a/src/plugins/platforms/ios/qiosintegration.mm
+++ b/src/plugins/platforms/ios/qiosintegration.mm
@@ -43,6 +43,7 @@
#include "qiosinputcontext.h"
#include "qiostheme.h"
#include "qiosservices.h"
+#include "qiosoptionalplugininterface.h"
#include <QtGui/private/qguiapplication_p.h>
@@ -68,6 +69,7 @@ QIOSIntegration::QIOSIntegration()
, m_inputContext(0)
, m_platformServices(new QIOSServices)
, m_accessibility(0)
+ , m_optionalPlugins(new QFactoryLoader(QIosOptionalPluginInterface_iid, QLatin1String("/platforms/darwin")))
, m_debugWindowManagement(false)
{
if (![UIApplication sharedApplication]) {
@@ -112,6 +114,9 @@ QIOSIntegration::QIOSIntegration()
m_touchDevice->setCapabilities(touchCapabilities);
QWindowSystemInterface::registerTouchDevice(m_touchDevice);
QMacInternalPasteboardMime::initializeMimeTypes();
+
+ for (int i = 0; i < m_optionalPlugins->metaData().size(); ++i)
+ qobject_cast<QIosOptionalPluginInterface *>(m_optionalPlugins->instance(i))->initPlugin();
}
QIOSIntegration::~QIOSIntegration()
@@ -134,6 +139,9 @@ QIOSIntegration::~QIOSIntegration()
delete m_accessibility;
m_accessibility = 0;
+
+ delete m_optionalPlugins;
+ m_optionalPlugins = 0;
}
bool QIOSIntegration::hasCapability(Capability cap) const