Show notifications if the window is minimized
// FREEBIE
This commit is contained in:
parent
f74a7b9621
commit
a57451d00b
1 changed files with 10 additions and 1 deletions
|
@ -89,10 +89,16 @@
|
||||||
conversation = conversations.create({id: conversationId});
|
conversation = conversations.create({id: conversationId});
|
||||||
conversation.fetch();
|
conversation.fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inboxOpened) {
|
if (inboxOpened) {
|
||||||
conversation.trigger('newmessages');
|
conversation.trigger('newmessages');
|
||||||
extension.windows.drawAttention(inboxWindowId);
|
extension.windows.drawAttention(inboxWindowId);
|
||||||
} else if (Whisper.Notifications.isEnabled()) {
|
if (!appWindow.isMinimized()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Whisper.Notifications.isEnabled()) {
|
||||||
var sender = ConversationController.create({id: message.get('source')});
|
var sender = ConversationController.create({id: message.get('source')});
|
||||||
conversation.fetch().then(function() {
|
conversation.fetch().then(function() {
|
||||||
sender.fetch().then(function() {
|
sender.fetch().then(function() {
|
||||||
|
@ -116,6 +122,7 @@
|
||||||
/* Inbox window controller */
|
/* Inbox window controller */
|
||||||
var inboxOpened = false;
|
var inboxOpened = false;
|
||||||
var inboxWindowId = 'inbox';
|
var inboxWindowId = 'inbox';
|
||||||
|
var appWindow = null;
|
||||||
window.openInbox = function() {
|
window.openInbox = function() {
|
||||||
if (inboxOpened === false) {
|
if (inboxOpened === false) {
|
||||||
inboxOpened = true;
|
inboxOpened = true;
|
||||||
|
@ -131,9 +138,11 @@
|
||||||
minHeight: 150
|
minHeight: 150
|
||||||
}, function (windowInfo) {
|
}, function (windowInfo) {
|
||||||
inboxWindowId = windowInfo.id;
|
inboxWindowId = windowInfo.id;
|
||||||
|
appWindow = windowInfo;
|
||||||
|
|
||||||
windowInfo.onClosed.addListener(function () {
|
windowInfo.onClosed.addListener(function () {
|
||||||
inboxOpened = false;
|
inboxOpened = false;
|
||||||
|
appWindow = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
// close the panel if background.html is refreshed
|
// close the panel if background.html is refreshed
|
||||||
|
|
Loading…
Add table
Reference in a new issue