[-]
[+]
|
Changed |
_service:tar_git:harbour-apocalypse.changes
|
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-apocalypse.spec
^
|
|
[-]
[+]
|
Changed |
_service
^
|
@@ -2,7 +2,7 @@
<service name="tar_git">
<param name="url">https://github.com/black-sheep-dev/harbour-apocalypse.git</param>
<param name="branch"></param>
- <param name="revision">0.4.2-3</param>
+ <param name="revision">0.4.3</param>
<param name="debian">N</param>
<param name="dumb">N</param>
</service>
|
|
Deleted |
_service:tar_git:harbour-apocalypse-0.4.2.tar.bz2/app/icons/512x512/harbour-apocalypse.png
^
|
[-]
[+]
|
Added |
_service:tar_git:harbour-apocalypse-0.4.3.tar.bz2/.github/workflows/main.yml
^
|
@@ -0,0 +1,52 @@
+name: BUILD on Sailfish OS 4.5.0.18
+
+on:
+ push:
+ branches:
+ - master
+ tags:
+ - '*'
+ # to prevent secrets leaking,
+ # we don't build on PRs
+ #pull_request:
+ # branches:
+ # - master
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v2
+ with:
+ submodules: 'true'
+
+ - name: Prepare
+ run: mkdir output
+
+ - name: Build armv7hl
+ id: build_armv7hl
+ uses: coderus/github-sfos-build@master
+ with:
+ release: 4.4.0.58
+ arch: armv7hl
+
+ - name: Build i486
+ id: build_i486
+ uses: coderus/github-sfos-build@master
+ with:
+ release: 4.4.0.58
+ arch: i486
+
+ - name: Build aarch64
+ id: build_aarch64
+ uses: coderus/github-sfos-build@master
+ with:
+ release: 4.4.0.58
+ arch: aarch64
+
+ - name: Upload build result
+ uses: actions/upload-artifact@v2
+ with:
+ name: rpm-build-result
+ path: RPMS
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-apocalypse-0.4.3.tar.bz2/README.md
^
|
@@ -5,6 +5,7 @@
>![](app/icons/128x128/harbour-apocalypse.png)
+[![](https://github.com/black-sheep-dev/harbour-apocalypse/actions/workflows/main.yml/badge.svg)](https://github.com/black-sheep-dev/harbour-apocalypse/actions/workflows/main.yml)
## Current state of development
|
[-]
[+]
|
Added |
_service:tar_git:harbour-apocalypse-0.4.3.tar.bz2/app/icons/offline.svg
^
|
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generator: Adobe Illustrator 17.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<svg id="Layer_1" width="512" height="512" version="1.1" viewBox="0 0 512 512" xml:space="preserve" xmlns="http://www.w3.org/2000/svg">
+
+<g id="g1133" transform="matrix(5.3952 0 0 5.3952 -1924.3 -1369.1)" fill="#fff" stroke-width=".18535"><path id="path860" d="m404.13 333.21c-2.173 0-4.211-0.841-5.739-2.367l-34.908-34.908c-3.015-3.016-3.152-7.891-0.313-11.1l0.087-0.087c11.32-10 25.835-15.508 40.871-15.508 15.032 0 29.544 5.501 40.862 15.491l0.085 0.085c2.847 3.2 2.723 8.076-0.283 11.1l-34.925 34.93c-1.528 1.525-3.565 2.364-5.737 2.364zm-39.502-47.005c-2.1 2.419-1.986 6.061 0.269 8.316l34.908 34.908c1.149 1.148 2.686 1.781 4.325 1.781s3.174-0.632 4.322-1.779l34.923-34.928c2.246-2.26 2.35-5.902 0.243-8.315-10.945-9.641-24.967-14.949-39.491-14.949-14.526 1e-3 -28.552 5.315-39.499 14.966z"/><g id="g868" transform="translate(355.92 252.1)">
+ <path id="path862" d="m80.769 50.061c-8.46-9.278-20.468-14.6-32.944-14.6s-24.479 5.321-32.934 14.6l-1.479-1.347c8.832-9.693 21.375-15.252 34.412-15.252 13.038 0 25.584 5.559 34.423 15.252z" opacity=".6"/>
+ <path id="path864" d="m70.801 60.095c-6.134-6.139-14.292-9.52-22.973-9.52-8.678 0-16.837 3.38-22.975 9.517l-1.414-1.414c6.515-6.515 15.176-10.103 24.389-10.103 9.215 0 17.876 3.589 24.387 10.105z" opacity=".6"/>
+ <path id="path866" d="m35.36 70.596-1.414-1.414c3.71-3.709 8.64-5.752 13.882-5.752 5.244 0 10.175 2.043 13.883 5.752l-1.414 1.414c-3.33-3.331-7.759-5.166-12.469-5.166-4.707 0-9.135 1.835-12.468 5.166z" opacity=".6"/>
+ </g></g><g id="g1536" transform="matrix(4.3635 0 0 4.3635 299.93 240.49)" fill="#fff" stroke-width=".22917">
+ <path id="path1532" d="m42.099 43.101c-0.256 0-0.512-0.098-0.707-0.293l-7.877-7.878c-0.753-0.753-1.168-1.758-1.168-2.829s0.415-2.075 1.168-2.828l7.879-7.879c0.391-0.391 1.023-0.391 1.414 0s0.391 1.023 0 1.414l-7.879 7.879c-0.376 0.375-0.582 0.877-0.582 1.414s0.207 1.039 0.582 1.415l7.877 7.878c0.391 0.391 0.391 1.023 0 1.414-0.196 0.195-0.452 0.293-0.707 0.293z"/>
+ <path id="path1534" d="m22.101 43.101c-0.256 0-0.512-0.098-0.707-0.293-0.391-0.391-0.391-1.023 0-1.414l7.878-7.878c0.779-0.78 0.779-2.049 0-2.829l-7.878-7.878c-0.391-0.391-0.391-1.023 0-1.414s1.023-0.391 1.414 0l7.878 7.878c1.559 1.56 1.559 4.098 0 5.657l-7.878 7.878c-0.195 0.195-0.451 0.293-0.707 0.293z"/>
+ </g></svg>
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-apocalypse-0.4.3.tar.bz2/app/qml/cover/CoverPage.qml
^
|
@@ -27,18 +27,15 @@
}
Rectangle {
+ visible: !offline
id: background
anchors.fill: parent;
-
opacity: localSeverity === 0 ? 0.0 : 0.6
-
color: helper.getSeverityColor(localSeverity)
}
-
Label {
id: coverTitle
-
anchors.horizontalCenter: parent.horizontalCenter
y: Theme.paddingLarge
@@ -48,6 +45,31 @@
font.pixelSize: Theme.fontSizeLarge
}
+ Image {
+ visible: offline
+ id: offlineIcon
+ anchors.centerIn: parent
+ smooth: true
+ width: parent.width * 0.75
+ height: width
+ sourceSize {
+ width: parent.width * 0.75
+ height: width
+ }
+ source: "/usr/share/harbour-apocalypse/icons/offline.svg"
+ }
+
+ Label {
+ visible: offline
+ anchors {
+ top: offlineIcon.bottom
+ topMargin: -Theme.paddingMedium
+ horizontalCenter: offlineIcon.horizontalCenter
+ }
+ //% "Offline"
+ text: qsTrId("id-offline")
+ }
+
Item {
id: spacer
anchors.top: coverTitle.bottom
@@ -56,8 +78,8 @@
}
SilicaListView {
+ visible: !offline
id: listView
-
anchors.top: spacer.bottom
anchors.bottom: parent.bottom
width: parent.width
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-apocalypse-0.4.3.tar.bz2/app/qml/global.qml
^
|
@@ -3,5 +3,5 @@
QtObject {
readonly property string appId: "harbour-apocalypse"
- readonly property string appVersion: "0.4.2"
+ readonly property string appVersion: "0.4.3"
}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-apocalypse-0.4.3.tar.bz2/app/qml/harbour-apocalypse.qml
^
|
@@ -11,6 +11,7 @@
property bool loading: false
property int localSeverity: 0
property var localMessages: []
+ property bool offline: true
function updateLocalMessages() {
@@ -61,12 +62,17 @@
function notifyChanged(enabled) {
console.log("Notify enabled: " + enabled)
}
+ function offlineChanged() {
+ offline = getProperty("offline")
+ }
+
function playSoundChanged(enabled) {
console.log("Play sound enabled: " + enabled)
}
Component.onCompleted: {
localSeverity = getProperty("localSeverity")
+ offline = getProperty("offline")
updateLocalMessages()
}
}
@@ -93,4 +99,6 @@
initialPage: Component { OverviewPage { } }
cover: Qt.resolvedUrl("cover/CoverPage.qml")
allowedOrientations: defaultAllowedOrientations
+
+ Component.onCompleted: dbusService.call("refresh", undefined)
}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-apocalypse-0.4.3.tar.bz2/app/qml/pages/SettingsPage.qml
^
|
@@ -7,6 +7,14 @@
allowedOrientations: Orientation.All
SilicaListView {
+ PullDownMenu {
+ MenuItem {
+ //% "Restart service"
+ text: qsTrId("id-restart-service")
+ onClicked: dbusService.call("enableService")
+ }
+ }
+
id: listView
model: ListModel {
id: listModel
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-apocalypse-0.4.3.tar.bz2/app/translations/harbour-apocalypse-de.ts
^
|
@@ -377,7 +377,7 @@
</message>
<message id="id-update-interval">
<source>Update interval (minutes)</source>
- <translation type="unfinished">Update Intervall (Minuten)</translation>
+ <translation>Update Intervall (Minuten)</translation>
</message>
<message id="id-play-sound">
<source>Play notifaction sound</source>
@@ -387,6 +387,14 @@
<source>When active the application will play a sound when new notification is available.</source>
<translation>Wenn aktiviert wird ein Ton bei einer neuen Meldung abgespielt.</translation>
</message>
+ <message id="id-offline">
+ <source>Offline</source>
+ <translation>Offline</translation>
+ </message>
+ <message id="id-restart-service">
+ <source>Restart service</source>
+ <translation>Service neustarten</translation>
+ </message>
</context>
<context>
<name>AboutPage</name>
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-apocalypse-0.4.3.tar.bz2/app/translations/harbour-apocalypse.ts
^
|
@@ -387,5 +387,13 @@
<source>When active the application will play a sound when new notification is available.</source>
<translation>When active the application will play a sound when new notification is available.</translation>
</message>
+ <message id="id-offline">
+ <source>Offline</source>
+ <translation>Offline</translation>
+ </message>
+ <message id="id-restart-service">
+ <source>Restart service</source>
+ <translation>Restart Service</translation>
+ </message>
</context>
</TS>
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-apocalypse-0.4.3.tar.bz2/daemon/daemon.pro
^
|
@@ -1,6 +1,6 @@
TARGET = harbour-apocalypse-daemon
-VERSION = 0.4.2-1
+VERSION = 0.4.3-1
DEFINES += APP_VERSION=\"\\\"$$VERSION\\\"\"
DEFINES += APP_NAME=\"\\\"$$TARGET\\\"\"
@@ -8,7 +8,7 @@
CONFIG += link_pkgconfig
-PKGCONFIG += nemonotifications-qt5 keepalive
+PKGCONFIG += nemonotifications-qt5 keepalive connman-qt5
LIBS += -lz
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-apocalypse-0.4.3.tar.bz2/daemon/src/apiinterface.cpp
^
|
@@ -35,11 +35,9 @@
}
if (reply->error()) {
-#ifdef QT_DEBUG
- qDebug() << reply->errorString();
-#endif
+ qCritical() << reply->errorString();
+ emit requestFailed(reply->url().toString());
reply->deleteLater();
-
return;
}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-apocalypse-0.4.3.tar.bz2/daemon/src/apiinterface.h
^
|
@@ -15,6 +15,7 @@
explicit ApiInterface(QObject *parent = nullptr);
signals:
+ void requestFailed(const QString &url);
void messagesAvailable(const QString &url, const QJsonArray &msg);
public slots:
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-apocalypse-0.4.3.tar.bz2/daemon/src/harbour-apocalypse-daemon.cpp
^
|
@@ -3,14 +3,80 @@
#include <QDebug>
#include <QDBusConnection>
#include <QDBusError>
+#include <QFile>
+#include <QMutex>
#include <QObject>
+#include <QStandardPaths>
#include <csignal>
#include "serviceprovider.h"
+#ifdef QT_DEBUG
+
+//some constants to parameterize.
+const qint64 LOG_FILE_LIMIT = 3000000;
+const QString LOG_PATH = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + "/org.nubecula/apocalypse";
+const QString LOG_FILENAME = "/daemon.log";
+
+void redirectDebugMessages(QtMsgType type, const QMessageLogContext & context, const QString & str)
+{
+ Q_UNUSED(context)
+
+ //thread safety
+ QMutex mutex;
+ mutex.lock();
+ QString txt;
+
+ //prepend timestamp to every message
+ QString datetime = QDateTime::currentDateTime().toString("yyyy.MM.dd hh:mm:ss");
+ //prepend a log level label to every message
+ switch (type) {
+ case QtDebugMsg:
+ txt = QString("[Debug*] ");
+ break;
+ case QtWarningMsg:
+ txt = QString("[Warning] ");
+ break;
+ case QtInfoMsg:
+ txt = QString("[Info] ");
+ break;
+ case QtCriticalMsg:
+ txt = QString("[Critical] ");
+ break;
+ case QtFatalMsg:
+ txt = QString("[Fatal] ");
+ }
+
+ QString filePath = LOG_PATH + LOG_FILENAME;
+ QFile outFile(filePath);
+
+ //if file reached the limit, rotate to filename.1
+ if(outFile.size() > LOG_FILE_LIMIT){
+ //roll the log file.
+ QFile::remove(filePath + ".1");
+ QFile::rename(filePath, filePath + ".1");
+ QFile::resize(filePath, 0);
+ }
+
+ //write message
+ outFile.open(QIODevice::WriteOnly | QIODevice::Append);
+ QTextStream ts(&outFile);
+ ts << datetime << txt << str << endl;
+
+ //close fd
+ outFile.close();
+ mutex.unlock();
+}
+
+#endif
+
int main(int argc, char *argv[])
{
+#ifdef QT_DEBUG
+ qInstallMessageHandler(redirectDebugMessages);
+#endif
+
QCoreApplication app(argc, argv);
app.setApplicationName(APP_NAME);
app.setApplicationVersion(APP_VERSION);
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-apocalypse-0.4.3.tar.bz2/daemon/src/serviceprovider.cpp
^
|
@@ -19,7 +19,16 @@
readServices();
readSettings();
- connect(m_api, &ApiInterface::messagesAvailable, this, &ServiceProvider::parseMessages);
+ restartApiInterface();
+
+ // check if network is available
+ connect(m_nm, &NetworkManager::connectedChanged, [this]() {
+ qDebug() << "Connected: " << m_nm->connected();
+ this->m_offline = !m_nm->connected();
+ emit this->offlineChanged();
+
+ if (m_nm->connected()) this->refresh();
+ });
if (!m_autoUpdate) {
refresh();
@@ -136,6 +145,11 @@
emit notifyChanged(m_notify);
}
+bool ServiceProvider::offline() const
+{
+ return m_offline;
+}
+
bool ServiceProvider::playSound() const
{
return m_playSound;
@@ -248,7 +262,7 @@
void ServiceProvider::refresh()
{
- if (m_loading) {
+ if (!m_nm->connected()) {
return;
}
@@ -259,16 +273,33 @@
// clear
m_requestQueue.clear();
m_localSeverity = 0;
+ m_localMessageBuffer = QJsonArray();
+ m_messageBuffer = QJsonArray();
// send requests
for (const auto &service : m_services) {
if (!service.active) continue;
+
m_requestQueue.append(service.url);
m_api->fetch(service.url);
}
}
+void ServiceProvider::restartApiInterface()
+{
+ m_loading = false;
+ m_requestQueue.clear();
+
+ if (m_api != nullptr) {
+ delete m_api;
+ }
+
+ m_api = new ApiInterface(this);
+ connect(m_api, &ApiInterface::messagesAvailable, this, &ServiceProvider::parseMessages);
+ connect(m_api, &ApiInterface::requestFailed, this, &ServiceProvider::onRequestFailed);
+}
+
void ServiceProvider::saveSettings()
{
writeSettings();
@@ -284,6 +315,16 @@
sendNotification(QJsonObject());
}
+void ServiceProvider::onRequestFailed(const QString &url)
+{
+ m_requestQueue.removeAll(url);
+
+ if (m_requestQueue.isEmpty()) {
+ m_loading = false;
+ emit loadingChanged();
+ }
+}
+
void ServiceProvider::parseMessages(const QString &url, const QJsonArray &msgs)
{
if (m_backgroundJob != nullptr) {
@@ -456,9 +497,8 @@
m_messageBuffer.append(msg);
}
-
// apply if all requests are finished
- if (!m_loading) {
+ if (m_requestQueue.isEmpty()) {
m_localMessages = QJsonDocument(m_localMessageBuffer).toJson(QJsonDocument::Compact);
emit localMessagesChanged(m_localMessages);
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-apocalypse-0.4.3.tar.bz2/daemon/src/serviceprovider.h
^
|
@@ -7,6 +7,7 @@
#include <QHash>
#include <keepalive/backgroundactivity.h>
+#include <connman-qt5/networkmanager.h>
#include "apiinterface.h"
#include "location.h"
@@ -26,6 +27,7 @@
Q_PROPERTY(QString mapBoxApiKey READ mapBoxApiKey NOTIFY mapBoxApiKeyChanged)
Q_PROPERTY(QString messages READ messages NOTIFY messagesChanged)
Q_PROPERTY(bool notify READ notify WRITE setNotify NOTIFY notifyChanged)
+ Q_PROPERTY(bool offline READ offline NOTIFY offlineChanged)
Q_PROPERTY(bool playSound READ playSound WRITE setPlaySound NOTIFY playSoundChanged)
Q_PROPERTY(QString services READ services NOTIFY servicesChanged)
Q_PROPERTY(int updateInterval READ updateInterval WRITE setUpdateInterval NOTIFY updateIntervalChanged)
@@ -56,6 +58,8 @@
bool notify() const;
void setNotify(bool enabled);
+ bool offline() const;
+
bool playSound() const;
void setPlaySound(bool enabled);
@@ -75,6 +79,7 @@
void mapBoxApiKeyChanged();
void messagesChanged(const QString&);
void notifyChanged(bool);
+ void offlineChanged();
void playSoundChanged(bool);
void activeServicesChanged();
void servicesChanged();
@@ -91,11 +96,13 @@
// other
void refresh();
+ void restartApiInterface();
void saveSettings();
void shutdown();
void test();
private slots:
+ void onRequestFailed(const QString &url);
void parseMessages(const QString &url, const QJsonArray &msgs);
private:
@@ -106,7 +113,7 @@
void readSettings();
void writeSettings();
- ApiInterface *m_api{new ApiInterface(this)};
+ ApiInterface *m_api{nullptr};
QJsonArray m_localMessageBuffer;
QJsonArray m_messageBuffer;
QStringList m_requestQueue;
@@ -120,6 +127,8 @@
BackgroundActivity *m_backgroundJob{nullptr};
+ NetworkManager *m_nm{NetworkManager::instance()};
+
// properties
bool m_autoUpdate{false};
bool m_gps{false};
@@ -128,6 +137,7 @@
int m_localSeverity{0};
QString m_messages{"[]"};
bool m_notify{true};
+ bool m_offline{true};
bool m_playSound{false};
int m_updateInterval{BackgroundActivity::FiveMinutes};
};
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-apocalypse-0.4.3.tar.bz2/service/harbour-apocalypse.service
^
|
@@ -1,11 +1,10 @@
[Unit]
Description=Apocalypse daemon
-After=pre-user-session.target
+After=pre-user-session.target network-online.target
[Service]
ExecStart=/usr/bin/harbour-apocalypse-daemon
Restart=on-failure
-RestartSec=1s
[Install]
WantedBy=user-session.target
|