From b48fd101e2c74c34f78b9f2212efe117f9e87931 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=A6=8C=20=EA=A6=AB=EA=A6=B6=20=EA=A6=8F=EA=A7=80?= =?UTF-8?q?=EA=A6=A6=EA=A6=BF=20=EA=A6=A7=20=EA=A6=AE=20=EA=A6=91=20?= =?UTF-8?q?=EA=A6=A9=20=EA=A6=AD=EA=A7=80?= Date: Tue, 24 Sep 2019 17:54:59 +0800 Subject: Common CA certificates is bundled in APK and then copied to files directory on Android --- controller.cxx | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'controller.cxx') diff --git a/controller.cxx b/controller.cxx index d69a6d6..d007855 100644 --- a/controller.cxx +++ b/controller.cxx @@ -1,3 +1,6 @@ +#ifdef ANDROID +#include +#endif #include #include #include @@ -6,7 +9,19 @@ Controller::Controller(QObject* parent) : QObject{parent} { +#ifdef ANDROID + QFile file{"assets:/certs/ca-certificates.crt"}; + file.copy(QDir{QStandardPaths::writableLocation + (QStandardPaths::AppDataLocation)}.absolutePath() + % "/ca-certificates.crt"); + auto path = QDir{QStandardPaths::writableLocation + (QStandardPaths::AppDataLocation)}.absolutePath() + % "/ca-certificates.crt"; + auto client = new RTClient::Client{"https://darapsa.co.id/rt" + , path.toLatin1().constData()}; +#else auto client = new RTClient::Client{"https://darapsa.co.id/rt"}; +#endif client->moveToThread(&thread); connect(&thread, &QThread::finished, client, &QObject::deleteLater); -- cgit v1.2.3