summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id>2019-09-24 17:54:59 +0800
committerꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id>2019-09-24 17:54:59 +0800
commitb48fd101e2c74c34f78b9f2212efe117f9e87931 (patch)
tree455c0a530c4302cdd759e95c8ce8a14ea65ebd0a
parentb4a7a55b35b441d7e4e4acd83e85f2c21961f9b6 (diff)
Common CA certificates is bundled in APK
and then copied to files directory on Android
-rw-r--r--controller.cxx15
-rw-r--r--kelakon.pro3
m---------qrtclient0
3 files changed, 18 insertions, 0 deletions
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 <QStringBuilder>
+#endif
#include <QQmlApplicationEngine>
#include <QtQml>
#include <qrtclient/client.hxx>
@@ -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);
diff --git a/kelakon.pro b/kelakon.pro
index ba344b5..97b543a 100644
--- a/kelakon.pro
+++ b/kelakon.pro
@@ -39,6 +39,9 @@ android {
QT += svg
DISTFILES += android/AndroidManifest.xml
ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android
+ certs.path = /assets/certs
+ certs.files = /etc/ssl/certs/ca-certificates.crt
+ INSTALLS += certs
}
debug: DEFINES += DEBUG
diff --git a/qrtclient b/qrtclient
-Subproject a018a703dade256a26f1e3f13591734c0ad171e
+Subproject 18977911a7645333c1887bfbbee96520226b398