Commit 3290d10a0486c60ffd57efad99561ab7fc70bdd5

Authored by OpenWapp Developer
1 parent 5c844733a1

Fixing titles for in app notifications and back button pulse.

Showing 4 changed files with 23 additions and 21 deletions

app/scripts/collections/history.js View file @ 3290d10
... ... @@ -60,8 +60,6 @@
60 60 // TODO: refactor this in a proper 'translate' method that takes care
61 61 // of the current language
62 62 content = this._formatImageMessageContent(content);
63   - global.notifications.send(this._getNotificationTitle(from),
64   - content.caption, from.msisdn);
65 63  
66 64 var message = new MessageModel({
67 65 type: meta.type,
... ... @@ -74,8 +72,6 @@
74 72 },
75 73  
76 74 _onTextReceived: function (from, meta, inContent) {
77   - global.notifications.send(this._getNotificationTitle(from),
78   - inContent, from.msisdn);
79 75 console.log('Received text from ', from, inContent, meta);
80 76  
81 77 var message = new MessageModel({
... ... @@ -95,8 +91,6 @@
95 91  
96 92 content.address = content.address ||
97 93 global.localisation[global.language].defaultImageCaption;
98   - global.notifications.send(this._getNotificationTitle(from),
99   - content.address, from.msisdn);
100 94  
101 95 var message = new MessageModel({
102 96 type: 'location',
... ... @@ -158,6 +152,17 @@
158 152 }
159 153 }
160 154  
  155 + var contents = message.get('contents');
  156 + var notificationBody = contents.address ||
  157 + contents.caption ||
  158 + contents;
  159 +
  160 + global.notifications.send(
  161 + contact.get('displayName') || from.displayName,
  162 + notificationBody,
  163 + from.msisdn
  164 + );
  165 +
161 166 var isRead = (!!global.router.currentView &&
162 167 global.router.currentView.model === conversation);
163 168 conversation.set({
... ... @@ -463,11 +468,6 @@
463 468  
464 469 comparator: function (conv, another) {
465 470 return -(conv.get('date').getTime() - another.get('date').getTime());
466   - },
467   -
468   - _getNotificationTitle: function (from) {
469   - return (from.displayName) ? from.displayName :
470   - this._getConversationTitle(from.msisdn);
471 471 },
472 472  
473 473 _getConversationTitle: function (identifier) {
app/scripts/utils/notifications.js View file @ 3290d10
... ... @@ -89,7 +89,7 @@
89 89 }) });
90 90 }
91 91  
92   - this._queue.splice(0, pendingNotifications);
  92 + this._queue = [];
93 93 this._sendNow(notification);
94 94 console.log('[notifications] Report sent!');
95 95 },
app/scripts/views/conversation.js View file @ 3290d10
... ... @@ -148,12 +148,14 @@
148 148 title: notification.title,
149 149 body: notification.body
150 150 });
151   - _this.$el.find('h2.in-app-notification').text(message);
  151 + var inAppNotificationArea = _this.$el.find('h2.in-app-notification');
  152 + inAppNotificationArea.text(message);
  153 + Helpers.revealEmoji(inAppNotificationArea);
152 154  
153 155 setTimeout(function () {
154 156 next();
155 157 }, _this.TIME_TO_DISPLAY_NOTIFICATION);
156   - })
  158 + });
157 159  
158 160 function next() {
159 161 if (_this._inAppNotifications.length > 0) {
app/styles/_animations.scss View file @ 3290d10
1 1 @keyframes pulse {
2   - 0% { box-shadow: 0px 0px 0.9rem 0.8rem rgba(191, 249, 249, 0) }
3   - 16% { box-shadow: 0px 0px 0.9rem 0.8rem rgba(191, 249, 249, 1) }
4   - 33% { box-shadow: 0px 0px 0.9rem 0.8rem rgba(191, 249, 249, 0) }
5   - 50% { box-shadow: 0px 0px 0.9rem 0.8rem rgba(191, 249, 249, 1) }
6   - 66% { box-shadow: 0px 0px 0.9rem 0.8rem rgba(191, 249, 249, 0) }
7   - 74% { box-shadow: 0px 0px 0.9rem 0.8rem rgba(191, 249, 249, 1) }
8   - 100% { box-shadow: 0px 0px 0.9rem 0.8rem rgba(191, 249, 249, 0) }
  2 + 0% { box-shadow: 0px 0px 2.1rem 1.4rem rgba(191, 249, 249, 0) }
  3 + 16% { box-shadow: 0px 0px 2.1rem 1.4rem rgba(191, 249, 249, 1) }
  4 + 33% { box-shadow: 0px 0px 2.1rem 1.4rem rgba(191, 249, 249, 0) }
  5 + 50% { box-shadow: 0px 0px 2.1rem 1.4rem rgba(191, 249, 249, 0.33) }
  6 + 66% { box-shadow: 0px 0px 2.1rem 1.4rem rgba(191, 249, 249, 0) }
  7 + 84% { box-shadow: 0px 0px 2.1rem 1.4rem rgba(191, 249, 249, 0.66) }
  8 + 100% { box-shadow: 0px 0px 2.1rem 1.4rem rgba(191, 249, 249, 0) }
9 9 }