summaryrefslogtreecommitdiff
path: root/controller.cxx
diff options
context:
space:
mode:
authorAnatasof Wirapraja <anatasof.wirapraja@gmail.com>2019-09-24 18:02:32 +0700
committerAnatasof Wirapraja <anatasof.wirapraja@gmail.com>2019-09-24 18:02:32 +0700
commita570ecafaa7e1481778a35015776b6de6102da83 (patch)
tree455c0a530c4302cdd759e95c8ce8a14ea65ebd0a /controller.cxx
parent91640a2222eeca5e424ac27bc93514e56a2d5c56 (diff)
parentb48fd101e2c74c34f78b9f2212efe117f9e87931 (diff)
Merge branch 'master' of ssh://darapsa.co.id/usr/local/git/kelakon into development
* 'master' of ssh://darapsa.co.id/usr/local/git/kelakon: Common CA certificates is bundled in APK
Diffstat (limited to 'controller.cxx')
-rw-r--r--controller.cxx15
1 files changed, 15 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);