Tweak default notification content
Change the placeholder content for when notifications are configured for count-only or sender-only. Remove some options that are no longer supported. // FREEBIE
This commit is contained in:
		
					parent
					
						
							
								79872be9f5
							
						
					
				
			
			
				commit
				
					
						e65007e297
					
				
			
		
					 1 changed files with 22 additions and 28 deletions
				
			
		| 
						 | 
				
			
			@ -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() {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue