Add unread count in window title
The window title now shows the global number of unread messages as "Signal (1)". This way the user can see the number of unread messages in the task bar and when alt-tabbing. Resolves: #384
This commit is contained in:
parent
8c59862e3d
commit
156c7c3b3d
3 changed files with 16 additions and 17 deletions
|
@ -172,8 +172,6 @@
|
|||
type : 'incoming'
|
||||
});
|
||||
|
||||
extension.navigator.setBadgeText(newUnreadCount);
|
||||
|
||||
return message;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,14 +9,6 @@
|
|||
|
||||
window.Whisper = window.Whisper || {};
|
||||
|
||||
window.setUnreadCount = function(count) {
|
||||
if (count > 0) {
|
||||
extension.navigator.setBadgeText(count);
|
||||
} else {
|
||||
extension.navigator.setBadgeText("");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
window.isFocused = function() {
|
||||
return inboxFocused;
|
||||
|
@ -79,6 +71,22 @@
|
|||
}
|
||||
};
|
||||
|
||||
window.setUnreadCount = function(count) {
|
||||
if (count > 0) {
|
||||
extension.navigator.setBadgeText(count);
|
||||
if (inboxOpened === true) {
|
||||
var appWindow = chrome.app.window.get(inboxWindowId);
|
||||
appWindow.contentWindow.document.title = "Signal (" + count + ")";
|
||||
}
|
||||
} else {
|
||||
extension.navigator.setBadgeText("");
|
||||
if (inboxOpened === true) {
|
||||
var appWindow = chrome.app.window.get(inboxWindowId);
|
||||
appWindow.contentWindow.document.title = "Signal";
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var open;
|
||||
window.openConversation = function(conversation) {
|
||||
if (inboxOpened === true) {
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
this.listenTo(this.model, 'change:avatar', this.updateAvatar);
|
||||
this.listenTo(this.model, 'change:name', this.updateTitle);
|
||||
this.listenTo(this.model, 'newmessage', this.addMessage);
|
||||
this.listenTo(this.model, 'change:unreadCount', this.onUnread);
|
||||
this.listenTo(this.model, 'opened', this.onOpened);
|
||||
|
||||
this.render();
|
||||
|
@ -130,12 +129,6 @@
|
|||
this.model.markRead();
|
||||
},
|
||||
|
||||
onUnread: function(model, previous) {
|
||||
if (!this.isHidden()) {
|
||||
this.markRead();
|
||||
}
|
||||
},
|
||||
|
||||
verifyIdentity: function() {
|
||||
if (this.model.isPrivate()) {
|
||||
var their_number = this.model.id;
|
||||
|
|
Loading…
Reference in a new issue