From 3687c0d24cde9031e545e9d137952bb76b5b719a Mon Sep 17 00:00:00 2001 From: Carlo Baratto Date: Tue, 20 Oct 2026 13:54:52 +0200 Subject: [PATCH] Il controllo continua con l'app in background (0.3.1) - non si ferma piu' quando la pagina perde il primo piano: il polling vive dentro l'app e si spegne chiudendo l'app - il conto alla rovescia a schermo gira solo con la pagina visibile - dichiarato il limite di sistema: Sailfish puo' congelare un'app in background, e in quel caso l'avviso arriva alla riapertura - post e descrizione allineati alla 0.3.1 (nomi, impronte, comportamento) --- qml/pages/MainPage.qml | 12 ++++++++---- rpm/harbour-thinq.spec | 10 +++++++++- src/main.cpp | 4 ++-- src/thinqclient.cpp | 12 +++++++++++- src/thinqclient.h | 4 ++++ store/description.md | 11 ++++++----- store/forum-post.md | 42 ++++++++++++++++++++++-------------------- 7 files changed, 62 insertions(+), 33 deletions(-) diff --git a/qml/pages/MainPage.qml b/qml/pages/MainPage.qml index e9aa0e4..06a3435 100644 --- a/qml/pages/MainPage.qml +++ b/qml/pages/MainPage.qml @@ -14,13 +14,17 @@ Page { allowedOrientations: Orientation.All - // La macchina si aggiorna solo mentre la schermata e' in primo piano: - // niente ponte, niente servizio che gira di nascosto. + // Nessun ponte e nessun servizio che gira di nascosto: il controllo vive + // dentro l'app e si spegne quando l'app viene chiusa. onStatusChanged: { + // Il conto alla rovescia a schermo gira solo quando la pagina si vede. + api.setScreenVisible(status === PageStatus.Active) + // Il controllo invece NON si ferma quando l'app va in background: resta + // attivo finche' il processo vive, e si spegne chiudendo l'app. Il + // sistema puo' congelare un'app in background: se lo fa, i timer si + // fermano comunque e la notifica arriva alla riapertura. if (status === PageStatus.Active) api.startPolling() - else - api.stopPolling() } SilicaFlickable { diff --git a/rpm/harbour-thinq.spec b/rpm/harbour-thinq.spec index 318c99e..9db59e5 100644 --- a/rpm/harbour-thinq.spec +++ b/rpm/harbour-thinq.spec @@ -1,6 +1,6 @@ Name: harbour-thinq Summary: Control an LG ThinQ washing machine -Version: 0.3.0 +Version: 0.3.1 Release: 1 Group: Qt/Qt License: MIT @@ -26,6 +26,14 @@ ThinQ Connect cloud from the phone: no server in between. The access token is stored only on the device, in the app private configuration file. %changelog +* Mon Oct 12 2026 Carlo - 0.3.1-1 +- il controllo non si ferma piu' quando l'app passa in background: continua + finche' il processo vive, e si spegne chiudendo l'app +- il conto alla rovescia a schermo gira solo quando la pagina si vede: in + background non si consuma per ricalcolare un numero che nessuno guarda +- limite noto (di sistema, non dell'app): Sailfish puo' congelare un'app in + background; in quel caso i timer si fermano e l'avviso arriva alla riapertura + * Mon Oct 12 2026 Carlo - 0.3.0-1 - un controllo ogni mezz'ora invece di ogni 45 secondi, sempre e solo mentre la schermata e' aperta: nessun servizio in background, nessun processo che resta diff --git a/src/main.cpp b/src/main.cpp index 9160246..5ec196d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -21,7 +21,7 @@ Q_DECL_EXPORT int main(int argc, char *argv[]) app->setOrganizationName(QStringLiteral("harbour")); app->setApplicationName(QStringLiteral("thinq")); - app->setApplicationVersion(QStringLiteral("0.3.0")); + app->setApplicationVersion(QStringLiteral("0.3.1")); Settings settings; ThinQClient api(&settings); @@ -34,7 +34,7 @@ Q_DECL_EXPORT int main(int argc, char *argv[]) QQuickView *view = SailfishApp::createView(); // Prima riga del log: dice se il device sta girando la build nuova o una stale. - qDebug() << "harbour-thinq v0.3.0 build" << __DATE__ << __TIME__; + qDebug() << "harbour-thinq v0.3.1 build" << __DATE__ << __TIME__; view->rootContext()->setContextProperty(QStringLiteral("appSettings"), &settings); view->rootContext()->setContextProperty(QStringLiteral("api"), &api); diff --git a/src/thinqclient.cpp b/src/thinqclient.cpp index da71442..b8b5307 100644 --- a/src/thinqclient.cpp +++ b/src/thinqclient.cpp @@ -41,7 +41,9 @@ ThinQClient::ThinQClient(Settings *settings, QObject *parent) // (cioe' a schermata aperta). m_tickTimer.setInterval(kTickMs); connect(&m_tickTimer, &QTimer::timeout, this, [this]() { - if (m_pollTimer.isActive()) + // Solo se la pagina si vede: in background nessuno guarda il numero e + // non vale la pena ricalcolarlo ogni minuto. + if (m_screenVisible && m_pollTimer.isActive()) emit devicesChanged(); }); @@ -192,10 +194,18 @@ void ThinQClient::startPolling() m_tickTimer.start(); } +void ThinQClient::setScreenVisible(bool visible) +{ + m_screenVisible = visible; + if (visible && !m_tickTimer.isActive()) + m_tickTimer.start(); +} + void ThinQClient::stopPolling() { m_pollTimer.stop(); m_tickTimer.stop(); + m_screenVisible = false; emit pollingChanged(); } diff --git a/src/thinqclient.h b/src/thinqclient.h index da09796..1e02f63 100644 --- a/src/thinqclient.h +++ b/src/thinqclient.h @@ -59,6 +59,9 @@ public: Q_INVOKABLE void sendDelayAt(int index); Q_INVOKABLE void startPolling(); Q_INVOKABLE void stopPolling(); + // Il conto alla rovescia a schermo serve solo quando la pagina si vede: il + // controllo invece continua anche con l'app in background. + Q_INVOKABLE void setScreenVisible(bool visible); Q_INVOKABLE void clearNotice(); Q_INVOKABLE void reloadCredentials(); Q_INVOKABLE QString durationText(int minutes) const; @@ -115,6 +118,7 @@ private: bool m_stateInFlight = false; int m_pollInterval = 1800000; // mezz'ora, e solo a schermata aperta int m_delayHours = 4; + bool m_screenVisible = false; // pagina davanti agli occhi bool m_busy = false; QString m_notice; bool m_noticeIsError = false; diff --git a/store/description.md b/store/description.md index 624e5ad..e754b41 100644 --- a/store/description.md +++ b/store/description.md @@ -52,11 +52,12 @@ WHAT IT DOES NOT DO can get accounts blocked by LG, so this app does not offer it. * No wash program selection. The machine's own API does not expose it, so the program is still chosen on the machine. -* No hidden background service. The app polls only while it is on screen, once - every 30 minutes, and backs off by itself when LG reports too many requests - (once an hour). The time left keeps counting down between checks because it is - recalculated on the phone. That is why the end-of-wash notification can arrive - up to half an hour after the cycle ends. +* No hidden background service, no daemon: the check lives inside the app and + keeps running while the app is open, including in the background; it stops when + the app is closed. LG is read once every 30 minutes, and the time left keeps + counting down between checks because it is recalculated on the phone. Sailfish + may freeze a background app to save power; if it does, the notification arrives + when the app is opened again. NOT AFFILIATED WITH LG diff --git a/store/forum-post.md b/store/forum-post.md index 5833cb0..4307846 100644 --- a/store/forum-post.md +++ b/store/forum-post.md @@ -55,21 +55,21 @@ uname -m | device | file | link | |---|---|---| -| 64-bit (`aarch64`) | `harbour-thinq-0.3.0-1.aarch64.rpm` (100 KB) | https://nextcloud.hackatoniclife.com/s/kXmJFokw9Ld6HNs | -| 32-bit (`armv7l`) | `harbour-thinq-0.3.0-1.armv7hl.rpm` (96 KB) | https://nextcloud.hackatoniclife.com/s/MPHaQLmfLSrZkMR | +| 64-bit (`aarch64`) | `harbour-thinq-0.3.1-1.aarch64.rpm` (100 KB) | https://nextcloud.hackatoniclife.com/s/kXmJFokw9Ld6HNs | +| 32-bit (`armv7l`) | `harbour-thinq-0.3.1-1.armv7hl.rpm` (96 KB) | https://nextcloud.hackatoniclife.com/s/MPHaQLmfLSrZkMR | Checksums, if you like to verify downloads: ``` -c8a4ecdf2f4fbe59f5948162a7fa82bac6bd315df6ea541b645eb5f3d6f9105f harbour-thinq-0.3.0-1.aarch64.rpm -0ac2ed5be803e16c4f7c1a180c1a9d984462fb3b528027f7dced1010c578312a harbour-thinq-0.3.0-1.armv7hl.rpm +ef2553735ece863a22292fc7db5ad725bb82dc83158be37fc8c847fdfc0f0fb5 harbour-thinq-0.3.1-1.aarch64.rpm +16cc58996409f7b4ca925785111d2f8e9729a59dc8af479550c5c5b704705804 harbour-thinq-0.3.1-1.armv7hl.rpm ``` **3. Install it** — either tap the downloaded file in Files and confirm, or from the terminal (developer mode): ``` -devel-su rpm -Uvh harbour-thinq-0.3.0-1.aarch64.rpm +devel-su rpm -Uvh harbour-thinq-0.3.1-1.aarch64.rpm ``` **4. First run** — paste your token, pick your country code (IT is the default), @@ -90,12 +90,13 @@ screen. can get accounts blocked by LG, so the app does not offer it. * No wash program selection. The machine's API does not expose it, so the program is still chosen on the machine. -* No hidden background service. It checks LG once every 30 minutes, and only - while the app is on screen; between one check and the next the time left is - recalculated on the phone, so the countdown keeps moving without any network - call. If LG reports too many requests, the check drops to once an hour. That - is also why the end-of-wash notification can arrive up to half an hour after - the cycle ends — without a server in the middle there is no push. +* No hidden background service, no daemon: the check lives inside the app. It + reads LG once every 30 minutes, keeps doing so while the app is in the + background, and stops when you close the app. Between one check and the next + the time left is recalculated on the phone, so the countdown keeps moving + without any network call. If LG reports too many requests, the check drops to + once an hour. Sailfish may freeze background apps to save power; if it does, + the end-of-wash notification arrives when you open the app again. ### Privacy @@ -168,14 +169,14 @@ uname -m | dispositivo | file | link | |---|---|---| -| 64 bit (`aarch64`) | `harbour-thinq-0.3.0-1.aarch64.rpm` (100 KB) | https://nextcloud.hackatoniclife.com/s/kXmJFokw9Ld6HNs | -| 32 bit (`armv7l`) | `harbour-thinq-0.3.0-1.armv7hl.rpm` (96 KB) | https://nextcloud.hackatoniclife.com/s/MPHaQLmfLSrZkMR | +| 64 bit (`aarch64`) | `harbour-thinq-0.3.1-1.aarch64.rpm` (100 KB) | https://nextcloud.hackatoniclife.com/s/kXmJFokw9Ld6HNs | +| 32 bit (`armv7l`) | `harbour-thinq-0.3.1-1.armv7hl.rpm` (96 KB) | https://nextcloud.hackatoniclife.com/s/MPHaQLmfLSrZkMR | **3. Installala** — tocca il file scaricato in File e conferma, oppure dal terminale (modalità sviluppatore): ``` -devel-su rpm -Uvh harbour-thinq-0.3.0-1.aarch64.rpm +devel-su rpm -Uvh harbour-thinq-0.3.1-1.aarch64.rpm ``` **4. Primo avvio** — incolla il token, scegli il codice paese (l'Italia è @@ -195,12 +196,13 @@ sullo stato. password può far bloccare l'account da LG, quindi l'app non lo offre. * Niente scelta del programma di lavaggio: l'API della macchina non lo espone, quindi il programma si sceglie ancora sulla macchina. -* Nessun servizio nascosto in background. Il controllo avviene una volta ogni - mezz'ora, e solo mentre l'app è aperta; fra un controllo e l'altro il tempo - rimanente viene ricalcolato sul telefono, così il conto alla rovescia scende - senza chiamare la rete. Se LG segnala troppe richieste si passa a una volta - l'ora. Per questo l'avviso di fine lavaggio può arrivare fino a mezz'ora dopo - la fine del ciclo: senza un server in mezzo non c'è notifica spinta. +* Nessun servizio nascosto e nessun demone: il controllo vive dentro l'app. Legge + LG una volta ogni mezz'ora, continua anche con l'app in background e si ferma + quando chiudi l'app. Fra un controllo e l'altro il tempo rimanente viene + ricalcolato sul telefono, così il conto alla rovescia scende senza chiamare la + rete. Se LG segnala troppe richieste si passa a una volta l'ora. Sailfish può + congelare le app in background per risparmiare: se lo fa, l'avviso di fine + lavaggio arriva alla riapertura. ### Privacy