Merge lp:~libqtelegram-team/telegram-app/app-dev-cpp-push-helper into lp:telegram-app/app-dev

Proposed by Michał Karnicki
Status: Merged
Approved by: Giulio Collura
Approved revision: 278
Merged at revision: 269
Proposed branch: lp:~libqtelegram-team/telegram-app/app-dev-cpp-push-helper
Merge into: lp:telegram-app/app-dev
Diff against target: 700 lines (+594/-11)
12 files modified
.bzrignore (+1/-0)
CMakeLists.txt (+38/-1)
config.h.in (+0/-1)
push.cpp (+25/-0)
push.json (+1/-1)
pushclient.cpp (+113/-0)
pushclient.h (+76/-0)
pushhelper.cpp (+290/-0)
pushhelper.h (+41/-0)
scripts/pushlog.sh (+3/-0)
src.moved/_sctelegram.ini (+0/-8)
telegram.qml (+6/-0)
To merge this branch: bzr merge lp:~libqtelegram-team/telegram-app/app-dev-cpp-push-helper
Reviewer Review Type Date Requested Status
Giulio Collura Approve
Roberto Mier Escandon (community) Needs Fixing
Review via email: mp+250608@code.launchpad.net

Description of the change

Rewrote push helper in C++.

Add 'grouping' of notifications (no counter in notification of grouped messages yet).
Add clearing counter / notifications when logging out.

Requires lib: lp:~libqtelegram-team/libqtelegram/dev-cpp-push-helper
https://code.launchpad.net/~libqtelegram-team/libqtelegram/app-dev-cpp-push-helper/+merge/250608

Tested:
- reading msg on PC and opening Tg clears counter/notifications
- opening Tg and reading msg on PC clears counter/notifications
- opening chat clears counter
- most of incoming push notification types listed in pushhelper.cpp

To post a comment you must log in.
Revision history for this message
Michał Karnicki (karni) wrote :

Roberto, any idea why I need to use line 101 instead of 97 (which doesn't work)?

Revision history for this message
Roberto Mier Escandon (rmescandon) wrote :

helper should manage CHAT_MESSAGE_NOTEXT push received message from telegram servers (see https://core.telegram.org/api/push-updates)

review: Needs Fixing
Revision history for this message
Giulio Collura (gcollura) wrote :

As discussed extensively on IRC, this is working and looking fine. Thanks karni!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.bzrignore'
2--- .bzrignore 2015-02-23 15:00:09 +0000
3+++ .bzrignore 2015-02-24 16:42:37 +0000
4@@ -2,6 +2,7 @@
5 click
6 *.click
7 library
8+push
9 push.py
10 config.h
11 manifest.json
12
13=== modified file 'CMakeLists.txt'
14--- CMakeLists.txt 2015-02-03 19:03:00 +0000
15+++ CMakeLists.txt 2015-02-24 16:42:37 +0000
16@@ -190,9 +190,35 @@
17 QML_JS_TARGET ALL SOURCES ${QML_JS_FILES}
18 )
19
20+add_custom_target(
21+ "_project_files" ALL SOURCES
22+
23+ "manifest.json.in"
24+ "apparmor-telegram.json"
25+ "push.json"
26+ "apparmor-push.json"
27+ "content-hub.json"
28+ "telegram.desktop.in.in"
29+
30+ "config.h.in"
31+ "push.cpp"
32+ "pushhelper.h"
33+ "pushhelper.cpp"
34+ "pushclient.h"
35+ "pushclient.cpp"
36+
37+ "push.py"
38+ "countries.py"
39+
40+ "HACKING.md"
41+ "README.md"
42+ "README.translations"
43+ "LICENSE"
44+)
45+
46 configure_file(
47 config.h.in
48- ${CMAKE_CURRENT_BINARY_DIR}/config.h @ONL
49+ ${CMAKE_CURRENT_BINARY_DIR}/config.h @ONLY
50 )
51
52 set(telegram_app_SRCS
53@@ -218,3 +244,14 @@
54 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
55 )
56
57+add_executable(push
58+ push.cpp
59+ pushhelper.cpp
60+ pushclient.cpp
61+)
62+qt5_use_modules(push
63+ Core
64+ DBus
65+)
66+install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/push
67+ DESTINATION ${CMAKE_INSTALL_BINDIR})
68
69=== modified file 'config.h.in'
70--- config.h.in 2014-11-03 09:57:18 +0000
71+++ config.h.in 2015-02-24 16:42:37 +0000
72@@ -1,2 +1,1 @@
73-
74 #define TELEGRAM_VERSION "@APP_VERSION@"
75
76=== added file 'push.cpp'
77--- push.cpp 1970-01-01 00:00:00 +0000
78+++ push.cpp 2015-02-24 16:42:37 +0000
79@@ -0,0 +1,25 @@
80+#include <QCoreApplication>
81+#include <QStringList>
82+#include <QTimer>
83+
84+#include "pushhelper.h"
85+
86+int main(int argc, char *argv[]) {
87+ if (argc != 3) {
88+ qFatal("Usage: %s infile outfile", argv[0]);
89+ }
90+
91+ QCoreApplication app(argc, argv);
92+ QStringList args = app.arguments();
93+
94+ PushHelper pushHelper("com.ubuntu.telegram_telegram",
95+ QString(args.at(1)), QString(args.at(2)), &app);
96+
97+// QObject::connect(&pushHelper, SIGNAL(done()), &app, SLOT(quit()));
98+ pushHelper.process();
99+
100+ // TODO check why I need this and the connect above doesn't work.
101+ QTimer::singleShot(500, &app, SLOT(quit()));
102+
103+ return app.exec();
104+}
105
106=== modified file 'push.json'
107--- push.json 2014-09-02 21:51:24 +0000
108+++ push.json 2015-02-24 16:42:37 +0000
109@@ -1,4 +1,4 @@
110 {
111- "exec": "push.py",
112+ "exec": "push",
113 "app_id": "com.ubuntu.telegram_telegram"
114 }
115
116=== added file 'pushclient.cpp'
117--- pushclient.cpp 1970-01-01 00:00:00 +0000
118+++ pushclient.cpp 2015-02-24 16:42:37 +0000
119@@ -0,0 +1,113 @@
120+/*
121+Copyright 2014 Canonical Ltd.
122+
123+This program is free software: you can redistribute it and/or modify
124+it under the terms of the GNU Lesser General Public License, version 3
125+as published by the Free Software Foundation.
126+
127+This program is distributed in the hope that it will be useful, but
128+WITHOUT ANY WARRANTY; without even the implied warranty of
129+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
130+GNU Lesser General Public License for more details.
131+
132+You should have received a copy of the GNU Lesser General Public
133+License along with this program. If not, see
134+<http://www.gnu.org/licenses/>.
135+*/
136+
137+#include "pushclient.h"
138+#include <QtDBus/QDBusConnection>
139+#include <QtDBus/QDBusMessage>
140+#include <QtDBus/QDBusPendingCall>
141+#include <QtDBus/QDBusPendingReply>
142+#include <QTimer>
143+
144+#define PUSH_SERVICE "com.ubuntu.PushNotifications"
145+#define POSTAL_SERVICE "com.ubuntu.Postal"
146+#define PUSH_PATH "/com/ubuntu/PushNotifications"
147+#define POSTAL_PATH "/com/ubuntu/Postal"
148+#define PUSH_IFACE "com.ubuntu.PushNotifications"
149+#define POSTAL_IFACE "com.ubuntu.Postal"
150+
151+PushClient::PushClient(QObject *parent) : QObject(parent) {
152+}
153+
154+void PushClient::registerApp(const QString &appId) {
155+ pkgname = appId.split("_").at(0);
156+ pkgname = pkgname.replace(".","_2e").replace("-","_2d");
157+ Q_EMIT appIdChanged(appId);
158+}
159+
160+QString PushClient::getAppId() {
161+ return appId;
162+}
163+
164+QString PushClient::getToken() {
165+ return token;
166+}
167+
168+void PushClient::emitError() {
169+ Q_EMIT error(status);
170+}
171+
172+void PushClient::clearPersistent(const QStringList &tags) {
173+ QDBusConnection bus = QDBusConnection::sessionBus();
174+ QString path(POSTAL_PATH);
175+ path += "/" + pkgname;
176+ QDBusMessage message = QDBusMessage::createMethodCall(
177+ POSTAL_SERVICE, path, POSTAL_IFACE, "ClearPersistent");
178+ message << this->appId;
179+ for (int i = 0; i < tags.size(); ++i) {
180+ message << tags.at(i);
181+ }
182+ bus.send(message);
183+
184+ QDBusPendingCall pcall = bus.asyncCall(message);
185+ QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pcall, this);
186+ connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
187+ this, SLOT(clearPersistentFinished(QDBusPendingCallWatcher*)));
188+}
189+
190+void PushClient::clearPersistentFinished(QDBusPendingCallWatcher *watcher) {
191+ QDBusPendingReply<void> reply = *watcher;
192+
193+ if (reply.isError()) {
194+ Q_EMIT error(reply.error().message());
195+ } else {
196+ Q_EMIT persistentCleared();
197+ }
198+ watcher->deleteLater();
199+}
200+
201+void PushClient::setCount(int count) {
202+ QDBusConnection bus = QDBusConnection::sessionBus();
203+ QString path(POSTAL_PATH);
204+ bool visible = count != 0;
205+ counter = count;
206+ path += "/" + pkgname;
207+ QDBusMessage message = QDBusMessage::createMethodCall(POSTAL_SERVICE, path, POSTAL_IFACE, "setCounter");
208+ message << this->appId << count << visible;
209+ QDBusPendingCall pcall = bus.asyncCall(message);
210+ QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pcall, this);
211+ connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
212+ this, SLOT(setCounterFinished(QDBusPendingCallWatcher*)));
213+}
214+
215+void PushClient::setCounterFinished(QDBusPendingCallWatcher *watcher) {
216+ QDBusPendingReply<void> reply = *watcher;
217+ if (reply.isError()) {
218+ Q_EMIT error(reply.error().message());
219+ }
220+ else {
221+ Q_EMIT countChanged(counter);
222+ }
223+ watcher->deleteLater();
224+}
225+
226+int PushClient::getCount() {
227+ return counter;
228+}
229+
230+void PushClient::setAppId(const QString &appId) {
231+ this->appId = appId;
232+}
233
234=== added file 'pushclient.h'
235--- pushclient.h 1970-01-01 00:00:00 +0000
236+++ pushclient.h 2015-02-24 16:42:37 +0000
237@@ -0,0 +1,76 @@
238+/*
239+Copyright 2014 Canonical Ltd.
240+
241+This program is free software: you can redistribute it and/or modify
242+it under the terms of the GNU Lesser General Public License, version 3
243+as published by the Free Software Foundation.
244+
245+This program is distributed in the hope that it will be useful, but
246+WITHOUT ANY WARRANTY; without even the implied warranty of
247+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
248+GNU Lesser General Public License for more details.
249+
250+You should have received a copy of the GNU Lesser General Public
251+License along with this program. If not, see
252+<http://www.gnu.org/licenses/>.
253+*/
254+
255+#ifndef PUSHCLIENT_H
256+#define PUSHCLIENT_H
257+
258+#include <QObject>
259+#include <QString>
260+#include <QStringList>
261+
262+class QDBusPendingCallWatcher;
263+
264+class PushClient : public QObject {
265+ Q_OBJECT
266+
267+public:
268+ explicit PushClient(QObject *parent = 0);
269+
270+ QString getAppId();
271+ void setAppId(const QString &appId);
272+ QString getToken();
273+ QString getStatus() { return this->status; }
274+ int getCount();
275+ void setCount(int count);
276+
277+ void registerApp(const QString &appid);
278+
279+ Q_PROPERTY(QString appId WRITE setAppId READ getAppId NOTIFY appIdChanged);
280+ Q_PROPERTY(QString token READ getToken NOTIFY tokenChanged);
281+ Q_PROPERTY(QStringList notifications NOTIFY notificationsChanged);
282+ Q_PROPERTY(QString status READ getStatus NOTIFY statusChanged);
283+ Q_PROPERTY(int count READ getCount WRITE setCount NOTIFY countChanged)
284+
285+signals:
286+ void appIdChanged(const QString &appId);
287+ void tokenChanged(const QString &token);
288+ void statusChanged(const QString &status);
289+ void countChanged(int count);
290+ void notificationsChanged(const QStringList &notifications);
291+ void persistentChanged(const QStringList &tags);
292+ void persistentCleared();
293+
294+ void error(const QString &error);
295+
296+public slots:
297+ void emitError();
298+ void clearPersistent(const QStringList &tags);
299+
300+private slots:
301+ void setCounterFinished(QDBusPendingCallWatcher *watcher);
302+ void clearPersistentFinished(QDBusPendingCallWatcher *watcher);
303+
304+private:
305+ QString appId;
306+ QString pkgname;
307+ QString token;
308+ QString status;
309+ QStringList notifications;
310+ int counter;
311+};
312+
313+#endif // PUSHCLIENT_H
314
315=== added file 'pushhelper.cpp'
316--- pushhelper.cpp 1970-01-01 00:00:00 +0000
317+++ pushhelper.cpp 2015-02-24 16:42:37 +0000
318@@ -0,0 +1,290 @@
319+#include <QDebug>
320+#include <QFile>
321+#include <QJsonDocument>
322+#include <QJsonArray>
323+#include <QStringList>
324+#include <QTextStream>
325+
326+#include "pushhelper.h"
327+
328+PushHelper::PushHelper(QString appId, QString infile, QString outfile,
329+ QObject *parent) : QObject(parent) {
330+ connect(&mPushClient, SIGNAL(persistentCleared()),
331+ this, SLOT(notificationDismissed()));
332+
333+ mPushClient.setAppId(appId);
334+ mPushClient.registerApp(appId);
335+ mInfile = infile;
336+ mOutfile = outfile;
337+}
338+
339+PushHelper::~PushHelper() {
340+}
341+
342+void PushHelper::process() {
343+ QString tag = "";
344+
345+ QJsonObject pushMessage = readPushMessage(mInfile);
346+ mPostalMessage = pushToPostalMessage(pushMessage, tag);
347+ if (!tag.isEmpty()) {
348+ dismissNotification(tag);
349+ }
350+}
351+
352+void PushHelper::notificationDismissed() {
353+ writePostalMessage(mPostalMessage, mOutfile);
354+ Q_EMIT done();
355+}
356+
357+QJsonObject PushHelper::readPushMessage(const QString &filename) {
358+ QFile file(filename);
359+ file.open(QIODevice::ReadOnly | QIODevice::Text);
360+
361+ QString val = file.readAll();
362+ file.close();
363+ return QJsonDocument::fromJson(val.toUtf8()).object();
364+}
365+
366+void PushHelper::writePostalMessage(const QJsonObject &postalMessage, const QString &filename) {
367+ QFile out;
368+ out.setFileName(filename);
369+ out.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate);
370+
371+ QTextStream(&out) << QJsonDocument(postalMessage).toJson();
372+ out.close();
373+}
374+
375+QJsonObject PushHelper::pushToPostalMessage(const QJsonObject &push, QString &tag) {
376+ QString summary = "";
377+ QString body = "";
378+ qint32 count = 0;
379+
380+ QJsonObject message = push["message"].toObject();
381+ QJsonObject custom = message["custom"].toObject();
382+
383+ QString key = "";
384+ if (message.keys().contains("loc_key")) {
385+ key = message["loc_key"].toString();
386+ }
387+ QJsonArray args;
388+ if (message.keys().contains("loc_args")) {
389+ args = message["loc_args"].toArray();
390+ }
391+
392+ QString chatId = "0"; // More useful as string in this context.
393+ if (custom.keys().contains("from_id")) {
394+ chatId = custom["from_id"].toString();
395+ }
396+ if (custom.keys().contains("chat_id")) {
397+ chatId = custom["chat_id"].toString();
398+ }
399+
400+ QString tg = QString("Telegram");
401+ summary = args[0].toString();
402+
403+ if (key == "MESSAGE_TEXT") {
404+
405+ body = args[1].toString();
406+
407+ } else if (key == "MESSAGE_NOTEXT") {
408+
409+ body = "sent you a message";
410+
411+ } else if (key == "MESSAGE_PHOTO") {
412+
413+ body = "sent you a photo";
414+
415+ } else if (key == "MESSAGE_VIDEO") {
416+
417+ body = "sent you a video";
418+
419+ } else if (key == "MESSAGE_DOC") {
420+
421+ body = "sent you a document";
422+
423+ } else if (key == "MESSAGE_AUDIO") {
424+
425+ body = "sent you a voice message";
426+
427+ } else if (key == "MESSAGE_CONTACT") {
428+
429+ body = "shared a contact with you";
430+
431+ } else if (key == "MESSAGE_GEO") {
432+
433+ body = "sent you a map";
434+
435+ } else if (key == "CHAT_MESSAGE_TEXT") {
436+
437+ summary = args[1].toString();
438+ body = args[0].toString() + ": " + args[2].toString();
439+
440+ } else if (key == "CHAT_MESSAGE_NOTEXT") {
441+
442+ summary = args[1].toString();
443+ body = args[0].toString() + " sent a message to the group";
444+
445+ } else if (key == "CHAT_MESSAGE_PHOTO") {
446+
447+ summary = args[1].toString();
448+ body = args[0].toString() + " sent a photo to the group";
449+
450+ } else if (key == "CHAT_MESSAGE_VIDEO") {
451+
452+ summary = args[1].toString();
453+ body = args[0].toString() + " sent a video to the group";
454+
455+ } else if (key == "CHAT_MESSAGE_DOC") {
456+
457+ summary = args[1].toString();
458+ body = args[0].toString() + " sent a document to the group";
459+
460+ } else if (key == "CHAT_MESSAGE_AUDIO") {
461+
462+ summary = args[1].toString();
463+ body = args[0].toString() + " sent a voice message to the group";
464+
465+ } else if (key == "CHAT_MESSAGE_CONTACT") {
466+
467+ summary = args[1].toString();
468+ body = args[0].toString() + " sent a contact to the group";
469+
470+ } else if (key == "CHAT_MESSAGE_GEO") {
471+
472+ summary = args[1].toString();
473+ body = args[0].toString() + " sent a map to the group";
474+
475+ } else if (key == "CHAT_CREATED") {
476+
477+ summary = args[1].toString();
478+ body = args[0].toString() + " invited you to the group";
479+
480+ } else if (key == "CHAT_TITLE_EDITED") {
481+
482+ summary = args[1].toString();
483+ body = args[0].toString() + " changed group name";
484+
485+ } else if (key == "CHAT_PHOTO_EDITED") {
486+
487+ summary = args[1].toString();
488+ body = args[0].toString() + " changed group photo";
489+
490+ } else if (key == "CHAT_ADD_MEMBER") {
491+
492+ summary = args[1].toString();
493+ body = args[0].toString() + " invited " + args[2].toString();
494+
495+ } else if (key == "CHAT_ADD_YOU") {
496+
497+ summary = args[1].toString();
498+ body = args[0].toString() + " invited you to the group";
499+
500+ } else if (key == "CHAT_DELETE_MEMBER") {
501+
502+ summary = args[1].toString();
503+ body = args[0].toString() + " kicked " + args[2].toString();
504+
505+ } else if (key == "CHAT_DELETE_YOU") {
506+
507+ summary = args[1].toString();
508+ body = args[0].toString() + " kicked you from the group";
509+
510+ } else if (key == "CHAT_LEFT") {
511+
512+ summary = args[1].toString();
513+ body = args[0].toString() + " has left the group";
514+
515+ } else if (key == "CHAT_RETURNED") {
516+
517+ summary = args[1].toString();
518+ body = args[0].toString() + " has returned to the group";
519+
520+ } else if (key == "GEOCHAT_CHECKIN") {
521+
522+ summary = "@ " + args[1].toString();
523+ body = args[0].toString() + " has checked-in";
524+
525+ } else if (key == "CONTACT_JOINED") {
526+
527+ summary = tg;
528+ body = args[0].toString() + " joined Telegram!";
529+
530+ } else if (key == "AUTH_UNKNOWN") {
531+
532+ summary = args[0].toString();
533+ body = "New login from unrecognized device";
534+
535+ } else if (key == "AUTH_REGION") {
536+
537+ summary = args[0].toString() + " @ " + args[1].toString();
538+ body = "New login from unrecognized device";
539+
540+ } else if (key == "CONTACT_PHOTO") {
541+
542+ body = "updated profile photo";
543+
544+ } else if (key == "ENCRYPTION_REQUEST") {
545+
546+ summary = tg;
547+ body = "You have a new message";
548+
549+ } else if (key == "ENCRYPTION_ACCEPT") {
550+
551+ summary = tg;
552+ body = "You have a new message";
553+
554+ } else if (key == "ENCRYPTED_MESSAGE") {
555+
556+ summary = tg;
557+ body = "You have a new message";
558+
559+ } else {
560+ qDebug() << "Unhandled push type: " << key;
561+ return QJsonObject();
562+ }
563+
564+ QJsonArray actions = QJsonArray();
565+ QString actionUri = QString("telegram://chat/%1").arg(chatId);
566+ actions.append(actionUri);
567+
568+ if (message.keys().contains("badge")) {
569+ count = message["badge"].toInt();
570+ } else if (push.keys().contains("notification")) {
571+ // Legacy. Notification section is only used to retrieve the unread count.
572+ count = push["notification"]
573+ .toObject()["emblem-counter"]
574+ .toObject()["count"]
575+ .toInt();
576+ }
577+
578+ tag = chatId;
579+
580+ QJsonObject card;
581+ card["summary"] = summary;
582+ card["body"] = body;
583+ card["actions"] = actions;
584+ card["popup"] = true; // TODO make setting
585+ card["persist"] = true; // TODO make setting
586+
587+ QJsonObject emblem;
588+ emblem["count"] = count;
589+ emblem["visible"] = count > 0;
590+
591+ QJsonObject notification;
592+ notification["tag"] = tag;
593+ notification["card"] = card;
594+ notification["emblem-counter"] = emblem;
595+ notification["sound"] = true; // TODO make setting
596+ notification["vibrate"] = true; // TODO make setting
597+
598+ QJsonObject postalMessage = QJsonObject();
599+ postalMessage["notification"] = notification;
600+
601+ return postalMessage;
602+}
603+
604+void PushHelper::dismissNotification(const QString &tag) {
605+ QStringList tags;
606+ tags << tag;
607+ mPushClient.clearPersistent(tags);
608+}
609
610=== added file 'pushhelper.h'
611--- pushhelper.h 1970-01-01 00:00:00 +0000
612+++ pushhelper.h 2015-02-24 16:42:37 +0000
613@@ -0,0 +1,41 @@
614+#ifndef PUSH_HELPER_H
615+#define PUSH_HELPER_H
616+
617+#include <QObject>
618+#include <QString>
619+#include <QJsonObject>
620+
621+#include "pushclient.h"
622+
623+/**
624+ * See: https://core.telegram.org/api/push-updates
625+ */
626+class PushHelper : public QObject {
627+ Q_OBJECT
628+
629+public:
630+ PushHelper(QString appId, QString infile, QString outfile, QObject *parent = 0);
631+ ~PushHelper();
632+ void process();
633+
634+Q_SIGNALS:
635+ void done();
636+
637+public Q_SLOTS:
638+ void notificationDismissed();
639+
640+protected:
641+ QJsonObject readPushMessage(const QString &filename);
642+ void writePostalMessage(const QJsonObject &postalMessage, const QString &filename);
643+ QJsonObject pushToPostalMessage(const QJsonObject &push, QString &tag);
644+ void dismissNotification(const QString &tag);
645+
646+private:
647+ PushClient mPushClient;
648+ QString mInfile;
649+ QString mOutfile;
650+
651+ QJsonObject mPostalMessage;
652+};
653+
654+#endif
655
656=== added file 'scripts/pushlog.sh'
657--- scripts/pushlog.sh 1970-01-01 00:00:00 +0000
658+++ scripts/pushlog.sh 2015-02-24 16:42:37 +0000
659@@ -0,0 +1,3 @@
660+#!/bin/bash
661+
662+adb shell "tail -f /home/phablet/.cache/upstart/ubuntu-push-client.log"
663
664=== removed directory 'src.moved'
665=== removed file 'src.moved/_sctelegram.ini'
666--- src.moved/_sctelegram.ini 2014-11-21 19:07:32 +0000
667+++ src.moved/_sctelegram.ini 1970-01-01 00:00:00 +0000
668@@ -1,8 +0,0 @@
669-[ScopeConfig]
670-DisplayName=Telegram
671-Description=This is a Telegram scope
672-Author=Victor Palau
673-Art=contacts.Art
674-Icon=./tasks.png
675-SearchHint=search for a message
676-HotKey=tasks.HotKey
677
678=== modified file 'telegram.qml'
679--- telegram.qml 2015-02-23 19:56:40 +0000
680+++ telegram.qml 2015-02-24 16:42:37 +0000
681@@ -573,6 +573,9 @@
682 showIntro = false;
683 }
684
685+ pushClient.count = 0;
686+ pushClient.clearPersistent([]);
687+
688 logoutResetSession(showIntro);
689 logoutResetUI(showIntro);
690 }
691@@ -695,6 +698,9 @@
692
693 onUnreadCountChanged: {
694 pushClient.count = unreadCount;
695+ if (unreadCount === 0) {
696+ pushClient.clearPersistent([]);
697+ }
698 }
699
700 // We need to clean-up and streamline our APIs ;)

Subscribers

People subscribed via source and target branches

to all changes: