Skip to content

Commit

Permalink
Tweak default notification content
Browse files Browse the repository at this point in the history
Change the placeholder content for when notifications are configured for
count-only or sender-only. Remove some options that are no longer
supported.

// FREEBIE
  • Loading branch information
liliakai authored and scottnonnenberg committed Sep 14, 2017
1 parent 79872be commit e65007e
Showing 1 changed file with 22 additions and 28 deletions.
50 changes: 22 additions & 28 deletions js/notifications.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,42 +44,36 @@
return;
}

var iconUrl = 'images/icon_128.png';
var title = [
var title;
var message;
var iconUrl;

var newMessageCount = [
this.length,
this.length === 1 ? i18n('newMessage') : i18n('newMessages')
].join(' ');

if (setting === SETTINGS.COUNT) {
extension.notification.update({
type : 'basic',
title : title,
iconUrl : iconUrl
});
return;
}

var m = this.last();
var type = 'basic';
var message = i18n('newMessage');
var imageUrl;
if (this.showMessage()) {
message = m.get('message');
if (m.get('imageUrl')) {
type = 'image';
imageUrl = m.get('imageUrl');
}
}
if (this.showSender()) {
title = m.get('title');
iconUrl = m.get('iconUrl');
var last = this.last();
switch (this.getSetting()) {
case SETTINGS.COUNT:
title = 'Signal';
message = newMessageCount;
break;
case SETTINGS.NAME:
title = newMessageCount;
message = 'Most recent from ' + last.get('title');
iconUrl = last.get('iconUrl');
break;
case SETTINGS.MESSAGE:
title = last.get('title');
message = last.get('message');
iconUrl = last.get('iconUrl');
break;
}
extension.notification.update({
type : type,
title : title,
message : message,
iconUrl : iconUrl,
imageUrl : imageUrl
iconUrl : iconUrl
});
},
getSetting: function() {
Expand Down

0 comments on commit e65007e

Please sign in to comment.