Merge lp:~mzanetti/reminders-app/fix-enable-push into lp:reminders-app

Proposed by Michael Zanetti on 2015-06-21
Status: Merged
Approved by: Riccardo Padovani on 2015-06-22
Approved revision: 459
Merged at revision: 460
Proposed branch: lp:~mzanetti/reminders-app/fix-enable-push
Merge into: lp:reminders-app
Diff against target: 616 lines (+175/-106)
13 files modified
src/account-plugin/qml/evernote/Main.qml.in (+2/-2)
src/app/preferences.cpp (+16/-0)
src/app/preferences.h (+3/-0)
src/app/qml/reminders.qml (+33/-15)
src/libqtevernote/jobs/fetchusernamejob.cpp (+2/-4)
src/libqtevernote/jobs/fetchusernamejob.h (+2/-2)
src/libqtevernote/notesstore.cpp (+59/-40)
src/libqtevernote/notesstore.h (+3/-1)
src/libqtevernote/userstore.cpp (+17/-9)
src/libqtevernote/userstore.h (+8/-5)
src/push-helper/core.cpp (+28/-26)
src/push-helper/core.h (+1/-2)
src/push-helper/main.cpp (+1/-0)
To merge this branch: bzr merge lp:~mzanetti/reminders-app/fix-enable-push
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve on 2015-06-22
Riccardo Padovani 2015-06-21 Approve on 2015-06-22
Review via email: mp+262541@code.launchpad.net

Commit Message

Fix the remaining issues in the push notification integration and enable it.

To post a comment you must log in.
457. By Michael Zanetti on 2015-06-22

drop unused included

458. By Michael Zanetti on 2015-06-22

drop unused method declaration

459. By Michael Zanetti on 2015-06-22

only try to register push on remote users

Riccardo Padovani (rpadovani) wrote :

lgtm

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/account-plugin/qml/evernote/Main.qml.in'
2--- src/account-plugin/qml/evernote/Main.qml.in 2015-02-20 21:18:01 +0000
3+++ src/account-plugin/qml/evernote/Main.qml.in 2015-06-22 08:14:09 +0000
4@@ -24,7 +24,7 @@
5 creationComponent: OAuth {
6 Connections {
7 target: UserStore
8- onUsernameChanged: saveUsername()
9+ onUserChanged: saveUsername()
10 }
11
12 function completeCreation(reply) {
13@@ -37,7 +37,7 @@
14 }
15
16 function saveUsername() {
17- account.updateDisplayName(UserStore.username)
18+ account.updateDisplayName(UserStore.userName)
19 account.synced.connect(finished)
20 account.sync()
21 }
22
23=== modified file 'src/app/preferences.cpp'
24--- src/app/preferences.cpp 2015-02-23 18:00:46 +0000
25+++ src/app/preferences.cpp 2015-06-22 08:14:09 +0000
26@@ -80,3 +80,19 @@
27 m_settings.endGroup();
28 return colorName;
29 }
30+
31+QString Preferences::tokenForUser(const QString &user)
32+{
33+ QString token;
34+ m_settings.beginGroup("accounts");
35+ token = m_settings.value(user).toString();
36+ m_settings.endGroup();
37+ return token;
38+}
39+
40+void Preferences::setTokenForUser(const QString &user, const QString &token)
41+{
42+ m_settings.beginGroup("accounts");
43+ m_settings.setValue(user, token);
44+ m_settings.endGroup();
45+}
46
47=== modified file 'src/app/preferences.h'
48--- src/app/preferences.h 2015-03-06 00:47:45 +0000
49+++ src/app/preferences.h 2015-06-22 08:14:09 +0000
50@@ -45,6 +45,9 @@
51
52 Q_INVOKABLE QString colorForNotebook(const QString &notebookGuid);
53
54+ Q_INVOKABLE QString tokenForUser(const QString &user);
55+ Q_INVOKABLE void setTokenForUser(const QString &user, const QString &token);
56+
57 signals:
58 void accountNameChanged();
59 void haveLocalUserChanged();
60
61=== modified file 'src/app/qml/reminders.qml'
62--- src/app/qml/reminders.qml 2015-06-12 09:48:22 +0000
63+++ src/app/qml/reminders.qml 2015-06-22 08:14:09 +0000
64@@ -280,9 +280,13 @@
65 }
66
67 function registerPushClient() {
68- console.log("Registering push client");
69+ console.log("Registering push client", JSON.stringify({
70+ "userId" : "" + UserStore.userId,
71+ "appId": root.applicationName + "_reminders",
72+ "token": pushClient.token
73+ }));
74 var req = new XMLHttpRequest();
75- req.open("post", "http://162.213.35.108/register", true);
76+ req.open("post", "https://push.ubuntu.com/gateway/register", true);
77 req.setRequestHeader("content-type", "application/json");
78 req.onreadystatechange = function() {//Call a function when the state changes.
79 print("push client register response")
80@@ -295,7 +299,7 @@
81 }
82 }
83 req.send(JSON.stringify({
84- "userId" : UserStore.username,
85+ "userId" : "" + UserStore.userId,
86 "appId": root.applicationName + "_reminders",
87 "token": pushClient.token
88 }))
89@@ -324,18 +328,30 @@
90 onNotificationsChanged: {
91 print("PushClient notification:", notifications)
92 var notification = JSON.parse(notifications)["payload"];
93- print("user", notification["userId"])
94- if (notification["userId"] !== UserStore.username) {
95- console.warn("user mismatch:", notification["userId"], "!=", UserStore.username)
96+
97+ if (notification["userId"] != UserStore.userId) { // Yes, we want type coercion here.
98+ console.warn("user mismatch:", notification["userId"], "!=", UserStore.userId)
99 return;
100 }
101
102- if (notification["notebookGUID"] !== undefined) {
103+ switch(notification["reason"]) {
104+ case "update":
105+ print("Note updated on server:", notification["guid"])
106+ if (NotesStore.note(notification["guid"]) === null) {
107+ NotesStore.refreshNotes();
108+ } else {
109+ NotesStore.refreshNoteContent(notification["guid"]);
110+ }
111+ break;
112+ case "create":
113+ print("New note appeared on server:", notification["guid"])
114+ NotesStore.refreshNotes();
115+ break;
116+ case "notebook_update":
117 NotesStore.refreshNotebooks();
118- NotesStore.refreshNotes(notification["notebookGUID"]);
119- }
120- if (notification["noteGUID"] !== undefined) {
121- NotesStore.refreshNoteContent(notification["noteGUID"]);
122+ break;
123+ default:
124+ console.warn("Unhandled push notification:", notification["reason"])
125 }
126 }
127
128@@ -412,10 +428,12 @@
129
130 Connections {
131 target: UserStore
132- onUsernameChanged: {
133- print("Logged in as user:", UserStore.username);
134- // Disabling push notifications as we haven't had a chance to properly test that yet
135- //registerPushClient();
136+ onUserChanged: {
137+ print("Logged in as user:", UserStore.userId, UserStore.userName);
138+ preferences.setTokenForUser(UserStore.userId, EvernoteConnection.token);
139+ if (UserStore.userId >= 0) {
140+ registerPushClient();
141+ }
142 }
143 }
144
145
146=== modified file 'src/libqtevernote/jobs/fetchusernamejob.cpp'
147--- src/libqtevernote/jobs/fetchusernamejob.cpp 2014-09-19 21:31:39 +0000
148+++ src/libqtevernote/jobs/fetchusernamejob.cpp 2015-06-22 08:14:09 +0000
149@@ -42,12 +42,10 @@
150
151 void FetchUsernameJob::startJob()
152 {
153- evernote::edam::User user;
154- client()->getUser(user, token().toStdString());
155- m_result = QString::fromStdString(user.username);
156+ client()->getUser(m_user, token().toStdString());
157 }
158
159 void FetchUsernameJob::emitJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage)
160 {
161- emit jobDone(errorCode, errorMessage, m_result);
162+ emit jobDone(errorCode, errorMessage, m_user.id, QString::fromStdString(m_user.username));
163 }
164
165=== modified file 'src/libqtevernote/jobs/fetchusernamejob.h'
166--- src/libqtevernote/jobs/fetchusernamejob.h 2014-09-19 21:31:39 +0000
167+++ src/libqtevernote/jobs/fetchusernamejob.h 2015-06-22 08:14:09 +0000
168@@ -33,14 +33,14 @@
169 virtual void attachToDuplicate(const EvernoteJob *other) override;
170
171 signals:
172- void jobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage, const QString &result);
173+ void jobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage, const int userId, const QString &userName);
174
175 protected:
176 void startJob();
177 void emitJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage);
178
179 private:
180- QString m_result;
181+ evernote::edam::User m_user;
182 };
183
184 #endif // FETCHUSERNAMEJOB_H
185
186=== modified file 'src/libqtevernote/notesstore.cpp'
187--- src/libqtevernote/notesstore.cpp 2015-06-12 09:48:22 +0000
188+++ src/libqtevernote/notesstore.cpp 2015-06-22 08:14:09 +0000
189@@ -61,7 +61,7 @@
190 m_tagsLoading(false)
191 {
192 qCDebug(dcNotesStore) << "Creating NotesStore instance.";
193- connect(UserStore::instance(), &UserStore::usernameChanged, this, &NotesStore::userStoreConnected);
194+ connect(UserStore::instance(), &UserStore::userChanged, this, &NotesStore::userStoreConnected);
195
196 qRegisterMetaType<evernote::edam::NotesMetadataList>("evernote::edam::NotesMetadataList");
197 qRegisterMetaType<evernote::edam::Note>("evernote::edam::Note");
198@@ -98,7 +98,7 @@
199 // We don't accept an empty username.
200 return;
201 }
202- if (!UserStore::instance()->username().isEmpty() && username != UserStore::instance()->username()) {
203+ if (!UserStore::instance()->userName().isEmpty() && username != UserStore::instance()->userName()) {
204 qCWarning(dcNotesStore) << "Logged in to Evernote. Can't change account manually. User EvernoteConnection to log in to another account or log out and change this manually.";
205 return;
206 }
207@@ -118,8 +118,9 @@
208 return QStandardPaths::standardLocations(QStandardPaths::DataLocation).first() + "/" + m_username + "/";
209 }
210
211-void NotesStore::userStoreConnected(const QString &username)
212+void NotesStore::userStoreConnected()
213 {
214+ QString username = UserStore::instance()->userName();
215 qCDebug(dcNotesStore) << "User store connected! Using username:" << username;
216 setUsername(username);
217
218@@ -738,10 +739,12 @@
219 connect(job, &SaveNoteJob::jobDone, this, &NotesStore::saveNoteJobDone);
220 EvernoteConnection::instance()->enqueue(job);
221 } else {
222- qCWarning(dcSync) << "CONFLICT: Note has been changed on server and locally!";
223- qCWarning(dcSync) << "local note sequence:" << note->updateSequenceNumber();
224- qCWarning(dcSync) << "last synced sequence:" << note->lastSyncedSequenceNumber();
225- qCWarning(dcSync) << "remote sequence:" << result.updateSequenceNum;
226+ qCWarning(dcSync) << "********************************************************";
227+ qCWarning(dcSync) << "* CONFLICT: Note has been changed on server and locally!";
228+ qCWarning(dcSync) << "* local note sequence:" << note->updateSequenceNumber();
229+ qCWarning(dcSync) << "* last synced sequence:" << note->lastSyncedSequenceNumber();
230+ qCWarning(dcSync) << "* remote update sequence:" << result.updateSequenceNum;
231+ qCWarning(dcSync) << "********************************************************";
232 note->setConflicting(true);
233 changedRoles << RoleConflicting;
234
235@@ -826,19 +829,7 @@
236
237 if (note->synced()) {
238 qCDebug(dcSync) << "Note has been deleted from the server and not changed locally. Deleting local note:" << note->guid();
239- beginRemoveRows(QModelIndex(), idx, idx);
240- m_notes.removeAt(idx);
241- m_notesHash.remove(note->guid());
242- endRemoveRows();
243- emit noteRemoved(note->guid(), note->notebookGuid());
244- emit countChanged();
245-
246- QSettings settings(m_cacheFile, QSettings::IniFormat);
247- settings.beginGroup("notes");
248- settings.remove(note->guid());
249- settings.endGroup();
250-
251- note->deleteLater();
252+ removeNote(note->guid());
253 } else {
254 qCDebug(dcSync) << "CONFLICT: Note has been deleted from the server but we have unsynced local changes for note:" << note->guid();
255 FetchNoteJob::LoadWhatFlags flags = 0x0;
256@@ -902,6 +893,12 @@
257 return;
258 }
259
260+ if (result.deleted > 0) {
261+ qCDebug(dcSync) << "Note has been deleted on server. Deleting locally.";
262+ removeNote(note->guid());
263+ return;
264+ }
265+
266 if (note->notebookGuid() != QString::fromStdString(result.notebookGuid)) {
267 note->setNotebookGuid(QString::fromStdString(result.notebookGuid));
268 roles << RoleGuid;
269@@ -914,6 +911,18 @@
270 note->setUpdated(QDateTime::fromMSecsSinceEpoch(result.updated));
271 roles << RoleUpdated << RoleUpdatedString;
272 }
273+ QStringList tagGuids;
274+ for (quint32 i = 0; i < result.tagGuids.size(); i++) {
275+ QString tag = QString::fromStdString(result.tagGuids.at(i));
276+ if (m_tagsHash.contains(tag)) {
277+ refreshTags();
278+ }
279+ tagGuids << tag;
280+ }
281+ if (note->tagGuids() != tagGuids) {
282+ note->setTagGuids(tagGuids);
283+ roles << RoleTagGuids;
284+ }
285
286 // Notes are fetched without resources by default. if we discover one or more resources where we don't have
287 // data in the cache, let's refresh the note again with resource data.
288@@ -948,11 +957,14 @@
289 if (what == FetchNoteJob::LoadContent) {
290 note->setEnmlContent(QString::fromStdString(result.content));
291 note->setUpdateSequenceNumber(result.updateSequenceNum);
292+ note->setLastSyncedSequenceNumber(result.updateSequenceNum);
293 roles << RoleHtmlContent << RoleEnmlContent << RoleTagline << RolePlaintextContent;
294 }
295+ bool syncReminders = false;
296 if (note->reminderOrder() != result.attributes.reminderOrder) {
297 note->setReminderOrder(result.attributes.reminderOrder);
298 roles << RoleReminder;
299+ syncReminders = true;
300 }
301 QDateTime reminderTime;
302 if (result.attributes.reminderTime > 0) {
303@@ -961,6 +973,7 @@
304 if (note->reminderTime() != reminderTime) {
305 note->setReminderTime(reminderTime);
306 roles << RoleReminderTime << RoleReminderTimeString;
307+ syncReminders = true;
308 }
309 QDateTime reminderDoneTime;
310 if (result.attributes.reminderDoneTime > 0) {
311@@ -969,6 +982,10 @@
312 if (note->reminderDoneTime() != reminderDoneTime) {
313 note->setReminderDoneTime(reminderDoneTime);
314 roles << RoleReminderDone << RoleReminderDoneTime;
315+ syncReminders = true;
316+ }
317+ if (syncReminders) {
318+ m_organizerAdapter->startSync();
319 }
320
321 note->setLoading(false);
322@@ -1456,14 +1473,7 @@
323 int idx = m_notes.indexOf(note);
324
325 if (note->lastSyncedSequenceNumber() == 0) {
326- emit noteRemoved(note->guid(), note->notebookGuid());
327- beginRemoveRows(QModelIndex(), idx, idx);
328- m_notes.takeAt(idx);
329- m_notesHash.take(guid);
330- endRemoveRows();
331- emit countChanged();
332- deleteFromCacheFile(note);
333- note->deleteLater();
334+ removeNote(guid);
335 } else {
336
337 qCDebug(dcNotesStore) << "Setting note to deleted:" << note->guid();
338@@ -1516,18 +1526,7 @@
339 qCWarning(dcSync) << "Cannot delete note from server:" << errorMessage;
340 return;
341 }
342- Note *note = m_notesHash.value(guid);
343- int noteIndex = m_notes.indexOf(note);
344-
345- emit noteRemoved(guid, note->notebookGuid());
346-
347- beginRemoveRows(QModelIndex(), noteIndex, noteIndex);
348- m_notes.takeAt(noteIndex);
349- m_notesHash.take(guid);
350- endRemoveRows();
351- emit countChanged();
352- deleteFromCacheFile(note);
353- note->deleteLater();
354+ removeNote(guid);
355 }
356
357 void NotesStore::expungeNotebookJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage, const QString &guid)
358@@ -1786,6 +1785,26 @@
359 return true;
360 }
361
362+void NotesStore::removeNote(const QString &guid)
363+{
364+ Note *note = m_notesHash.value(guid);
365+ int idx = m_notes.indexOf(note);
366+
367+ emit noteRemoved(note->guid(), note->notebookGuid());
368+
369+ beginRemoveRows(QModelIndex(), idx, idx);
370+ m_notes.removeAt(idx);
371+ m_notesHash.remove(note->guid());
372+ endRemoveRows();
373+ emit countChanged();
374+
375+ QSettings settings(m_cacheFile, QSettings::IniFormat);
376+ settings.beginGroup("notes");
377+ settings.remove(note->guid());
378+ settings.endGroup();
379+
380+ note->deleteLater();
381+}
382
383 void NotesStore::expungeTag(const QString &guid)
384 {
385
386=== modified file 'src/libqtevernote/notesstore.h'
387--- src/libqtevernote/notesstore.h 2015-06-11 18:55:24 +0000
388+++ src/libqtevernote/notesstore.h 2015-06-22 08:14:09 +0000
389@@ -205,7 +205,7 @@
390 void syncToCacheFile(Tag *tag);
391 void loadFromCacheFile();
392
393- void userStoreConnected(const QString &username);
394+ void userStoreConnected();
395 void emitDataChanged();
396 void clear();
397
398@@ -215,6 +215,8 @@
399
400 bool handleUserError(EvernoteConnection::ErrorCode errorCode);
401
402+ void removeNote(const QString &guid);
403+
404 private:
405 explicit NotesStore(QObject *parent = 0);
406 static NotesStore *s_instance;
407
408=== modified file 'src/libqtevernote/userstore.cpp'
409--- src/libqtevernote/userstore.cpp 2015-03-06 00:47:45 +0000
410+++ src/libqtevernote/userstore.cpp 2015-06-22 08:14:09 +0000
411@@ -42,7 +42,8 @@
412 UserStore* UserStore::s_instance = 0;
413
414 UserStore::UserStore(QObject *parent) :
415- QObject(parent)
416+ QObject(parent),
417+ m_userId(-1)
418 {
419 connect(EvernoteConnection::instance(), &EvernoteConnection::isConnectedChanged, this, &UserStore::fetchUsername);
420
421@@ -57,9 +58,13 @@
422 return s_instance;
423 }
424
425-QString UserStore::username() const
426-{
427- return m_username;
428+qint32 UserStore::userId() const
429+{
430+ return m_userId;
431+}
432+QString UserStore::userName() const
433+{
434+ return m_userName;
435 }
436
437 void UserStore::fetchUsername()
438@@ -69,18 +74,21 @@
439 connect(job, &FetchUsernameJob::jobDone, this, &UserStore::fetchUsernameJobDone);
440 EvernoteConnection::instance()->enqueue(job);
441 } else {
442- m_username.clear();
443- emit usernameChanged(m_username);
444+ m_userId = -1;
445+ m_userName.clear();
446+ emit userChanged();
447 }
448 }
449
450-void UserStore::fetchUsernameJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage, const QString &result)
451+void UserStore::fetchUsernameJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage, const int userId, const QString &userName)
452 {
453 if (errorCode != EvernoteConnection::ErrorCodeNoError) {
454 qCWarning(dcConnection) << "Error fetching username:" << errorMessage;
455 return;
456 }
457
458- m_username = result;
459- emit usernameChanged(m_username);
460+ qCDebug(dcConnection) << "FetchUsername done. User ID:" << userId << "User name:" << userName;
461+ m_userId = userId;
462+ m_userName = userName;
463+ emit userChanged();
464 }
465
466=== modified file 'src/libqtevernote/userstore.h'
467--- src/libqtevernote/userstore.h 2014-12-08 10:25:48 +0000
468+++ src/libqtevernote/userstore.h 2015-06-22 08:14:09 +0000
469@@ -33,26 +33,29 @@
470 Q_OBJECT
471
472 // TODO: Once we need more than just the username, turn this into a class User
473- Q_PROPERTY(QString username READ username NOTIFY usernameChanged)
474+ Q_PROPERTY(qint32 userId READ userId NOTIFY userChanged)
475+ Q_PROPERTY(QString userName READ userName NOTIFY userChanged)
476
477 public:
478 static UserStore* instance();
479
480- QString username() const;
481+ qint32 userId() const;
482+ QString userName() const;
483
484 signals:
485- void usernameChanged(const QString &username);
486+ void userChanged();
487
488 private slots:
489 void fetchUsername();
490
491- void fetchUsernameJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage, const QString &result);
492+ void fetchUsernameJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage, const int userId, const QString &userName);
493
494 private:
495 static UserStore* s_instance;
496 explicit UserStore(QObject *parent = 0);
497
498- QString m_username;
499+ qint32 m_userId;
500+ QString m_userName;
501 };
502
503 #endif // USERSTORE_H
504
505=== modified file 'src/push-helper/core.cpp'
506--- src/push-helper/core.cpp 2014-12-08 10:25:48 +0000
507+++ src/push-helper/core.cpp 2015-06-22 08:14:09 +0000
508@@ -6,33 +6,43 @@
509
510 #include <QDebug>
511 #include <QOrganizerEvent>
512+#include <QStandardPaths>
513+#include <QJsonDocument>
514
515 Core::Core(QObject *parent):
516 QObject(parent)
517 {
518- qDebug() << "Core starting up";
519 connect(EvernoteConnection::instance(), &EvernoteConnection::isConnectedChanged, this, &Core::connectedChanged);
520- qDebug() << "EvernoteConnection created";
521 connect(NotesStore::instance(), &NotesStore::loadingChanged, this, &Core::notesLoaded);
522- qDebug() << "notestore created";
523-// connect(&m_oaSetup, &OnlineAccountsClient::Setup::finished, this, &Core::oaRequestFinished);
524-
525-
526-// m_oaSetup.setApplicationId("com.ubuntu.reminders_reminders");
527-// m_oaSetup.setServiceTypeId("evernote");
528-// m_oaSetup.exec();
529-// qDebug() << "OA request started";
530-
531- EvernoteConnection::instance()->setToken("S=s358:U=39eb980:E=1516e9a3575:C=14a16e90690:P=185:A=canonicalis:V=2:H=737f36850d4943e61ff2fcf7b4c809e2");
532+}
533+
534+bool Core::process(const QByteArray &pushNotification)
535+{
536+ qDebug() << "should process:" << pushNotification;
537+
538+ QJsonParseError error;
539+ QJsonDocument jsonDoc = QJsonDocument::fromJson(pushNotification, &error);
540+ if (error.error != QJsonParseError::NoError) {
541+ qDebug() << "Error parsing notification json:" << error.errorString();
542+ return false;
543+ }
544+ QVariantMap notification = jsonDoc.toVariant().toMap().value("payload").toMap();
545+
546+ QSettings settings(QStandardPaths::standardLocations(QStandardPaths::ConfigLocation).first() + "/com.ubuntu.reminders/reminders.conf", QSettings::IniFormat);
547+ settings.beginGroup("accounts");
548+ QString token = settings.value(notification.value("userId").toString()).toString();
549+ settings.endGroup();
550+
551+ if (token.isEmpty()) {
552+ qDebug() << "No token found for this userId in " + settings.fileName() + ". Discarding push notification...";
553+ return false;
554+ }
555+
556+ EvernoteConnection::instance()->setToken(token);
557 EvernoteConnection::instance()->setHostname("www.evernote.com");
558 EvernoteConnection::instance()->connectToEvernote();
559
560- qDebug() << "Core created";
561-}
562-
563-void Core::process(const QByteArray &pushNotification)
564-{
565- qDebug() << "should process:" << pushNotification;
566+ return true;
567 }
568
569 void Core::connectedChanged()
570@@ -48,13 +58,5 @@
571 void Core::notesLoaded()
572 {
573 qDebug() << "notes loading changed:" << NotesStore::instance()->loading();
574- foreach (Note *note, NotesStore::instance()->notes()) {
575- qDebug() << "have note" << note->title();
576- qDebug() << "content:" << note->plaintextContent();
577- }
578 }
579
580-void Core::oaRequestFinished(const QVariantMap &reply)
581-{
582- qDebug() << "OA reply" << reply;
583-}
584
585=== modified file 'src/push-helper/core.h'
586--- src/push-helper/core.h 2014-12-14 02:40:47 +0000
587+++ src/push-helper/core.h 2015-06-22 08:14:09 +0000
588@@ -9,7 +9,7 @@
589 public:
590 Core(QObject *parent = 0);
591
592- void process(const QByteArray &pushNotification);
593+ bool process(const QByteArray &pushNotification);
594
595
596 signals:
597@@ -17,7 +17,6 @@
598
599 private slots:
600 void connectedChanged();
601- void oaRequestFinished(const QVariantMap &reply);
602
603 void notesLoaded();
604 };
605
606=== modified file 'src/push-helper/main.cpp'
607--- src/push-helper/main.cpp 2014-12-06 22:35:01 +0000
608+++ src/push-helper/main.cpp 2015-06-22 08:14:09 +0000
609@@ -23,6 +23,7 @@
610
611 Core core;
612 QObject::connect(&core, &Core::finished, &a, &QCoreApplication::exit);
613+
614 core.process(data);
615
616 a.exec();

Subscribers

People subscribed via source and target branches