mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Clickable notifications (#745)
This commit is contained in:
parent
69c01e5789
commit
9ade5a585b
5 changed files with 121 additions and 39 deletions
|
|
@ -778,10 +778,7 @@
|
||||||
|
|
||||||
if (bClick)
|
if (bClick)
|
||||||
{
|
{
|
||||||
this.focusedItem(oItem);
|
this.selectMessageItem(oItem);
|
||||||
this.selectedItem(oItem);
|
|
||||||
|
|
||||||
this.scrollToFocused();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -791,6 +788,14 @@
|
||||||
this.oCallbacks[sEventName] = fCallback;
|
this.oCallbacks[sEventName] = fCallback;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Selector.prototype.selectMessageItem = function (oMessageItem)
|
||||||
|
{
|
||||||
|
this.focusedItem(oMessageItem);
|
||||||
|
this.selectedItem(oMessageItem);
|
||||||
|
|
||||||
|
this.scrollToFocused();
|
||||||
|
};
|
||||||
|
|
||||||
module.exports = Selector;
|
module.exports = Selector;
|
||||||
|
|
||||||
}());
|
}());
|
||||||
|
|
@ -781,47 +781,55 @@
|
||||||
*/
|
*/
|
||||||
MessageModel.prototype.populateByMessageListItem = function (oMessage)
|
MessageModel.prototype.populateByMessageListItem = function (oMessage)
|
||||||
{
|
{
|
||||||
this.folderFullNameRaw = oMessage.folderFullNameRaw;
|
if (oMessage)
|
||||||
this.uid = oMessage.uid;
|
{
|
||||||
this.hash = oMessage.hash;
|
this.folderFullNameRaw = oMessage.folderFullNameRaw;
|
||||||
this.requestHash = oMessage.requestHash;
|
this.uid = oMessage.uid;
|
||||||
this.subject(oMessage.subject());
|
this.hash = oMessage.hash;
|
||||||
|
this.requestHash = oMessage.requestHash;
|
||||||
|
this.subject(oMessage.subject());
|
||||||
|
}
|
||||||
|
|
||||||
this.subjectPrefix(this.subjectPrefix());
|
this.subjectPrefix(this.subjectPrefix());
|
||||||
this.subjectSuffix(this.subjectSuffix());
|
this.subjectSuffix(this.subjectSuffix());
|
||||||
|
|
||||||
this.size(oMessage.size());
|
if (oMessage)
|
||||||
this.dateTimeStampInUTC(oMessage.dateTimeStampInUTC());
|
{
|
||||||
this.priority(oMessage.priority());
|
|
||||||
|
|
||||||
this.proxy = oMessage.proxy;
|
this.size(oMessage.size());
|
||||||
|
this.dateTimeStampInUTC(oMessage.dateTimeStampInUTC());
|
||||||
|
this.priority(oMessage.priority());
|
||||||
|
|
||||||
this.fromEmailString(oMessage.fromEmailString());
|
this.proxy = oMessage.proxy;
|
||||||
this.fromClearEmailString(oMessage.fromClearEmailString());
|
|
||||||
this.toEmailsString(oMessage.toEmailsString());
|
|
||||||
this.toClearEmailsString(oMessage.toClearEmailsString());
|
|
||||||
|
|
||||||
this.emails = oMessage.emails;
|
this.fromEmailString(oMessage.fromEmailString());
|
||||||
|
this.fromClearEmailString(oMessage.fromClearEmailString());
|
||||||
|
this.toEmailsString(oMessage.toEmailsString());
|
||||||
|
this.toClearEmailsString(oMessage.toClearEmailsString());
|
||||||
|
|
||||||
this.from = oMessage.from;
|
this.emails = oMessage.emails;
|
||||||
this.to = oMessage.to;
|
|
||||||
this.cc = oMessage.cc;
|
|
||||||
this.bcc = oMessage.bcc;
|
|
||||||
this.replyTo = oMessage.replyTo;
|
|
||||||
this.deliveredTo = oMessage.deliveredTo;
|
|
||||||
|
|
||||||
this.unseen(oMessage.unseen());
|
this.from = oMessage.from;
|
||||||
this.flagged(oMessage.flagged());
|
this.to = oMessage.to;
|
||||||
this.answered(oMessage.answered());
|
this.cc = oMessage.cc;
|
||||||
this.forwarded(oMessage.forwarded());
|
this.bcc = oMessage.bcc;
|
||||||
this.isReadReceipt(oMessage.isReadReceipt());
|
this.replyTo = oMessage.replyTo;
|
||||||
this.deletedMark(oMessage.deletedMark());
|
this.deliveredTo = oMessage.deliveredTo;
|
||||||
|
|
||||||
this.priority(oMessage.priority());
|
this.unseen(oMessage.unseen());
|
||||||
|
this.flagged(oMessage.flagged());
|
||||||
|
this.answered(oMessage.answered());
|
||||||
|
this.forwarded(oMessage.forwarded());
|
||||||
|
this.isReadReceipt(oMessage.isReadReceipt());
|
||||||
|
this.deletedMark(oMessage.deletedMark());
|
||||||
|
|
||||||
this.selected(oMessage.selected());
|
this.priority(oMessage.priority());
|
||||||
this.checked(oMessage.checked());
|
|
||||||
this.hasAttachments(oMessage.hasAttachments());
|
this.selected(oMessage.selected());
|
||||||
this.attachmentsSpecData(oMessage.attachmentsSpecData());
|
this.checked(oMessage.checked());
|
||||||
|
this.hasAttachments(oMessage.hasAttachments());
|
||||||
|
this.attachmentsSpecData(oMessage.attachmentsSpecData());
|
||||||
|
}
|
||||||
|
|
||||||
this.body = null;
|
this.body = null;
|
||||||
|
|
||||||
|
|
@ -830,7 +838,10 @@
|
||||||
this.sInReplyTo = '';
|
this.sInReplyTo = '';
|
||||||
this.sReferences = '';
|
this.sReferences = '';
|
||||||
|
|
||||||
this.threads(oMessage.threads());
|
if (oMessage)
|
||||||
|
{
|
||||||
|
this.threads(oMessage.threads());
|
||||||
|
}
|
||||||
|
|
||||||
this.computeSenderEmail();
|
this.computeSenderEmail();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -279,7 +279,8 @@
|
||||||
require('Stores/User/Account').email(),
|
require('Stores/User/Account').email(),
|
||||||
Translator.i18n('MESSAGE_LIST/NEW_MESSAGE_NOTIFICATION', {
|
Translator.i18n('MESSAGE_LIST/NEW_MESSAGE_NOTIFICATION', {
|
||||||
'COUNT': iLen
|
'COUNT': iLen
|
||||||
})
|
}),
|
||||||
|
{'Folder': '', 'Uid': ''}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -290,7 +291,11 @@
|
||||||
Links.notificationMailIcon(),
|
Links.notificationMailIcon(),
|
||||||
MessageHelper.emailArrayToString(
|
MessageHelper.emailArrayToString(
|
||||||
MessageHelper.emailArrayFromJson(aNewMessages[iIndex].From), false),
|
MessageHelper.emailArrayFromJson(aNewMessages[iIndex].From), false),
|
||||||
aNewMessages[iIndex].Subject
|
aNewMessages[iIndex].Subject,
|
||||||
|
{
|
||||||
|
'Folder': aNewMessages[iIndex].Folder,
|
||||||
|
'Uid': aNewMessages[iIndex].Uid
|
||||||
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -744,6 +749,24 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
MessageUserStore.prototype.selectMessageByFolderAndUid = function (sFolder, sUid)
|
||||||
|
{
|
||||||
|
if (sFolder && sUid)
|
||||||
|
{
|
||||||
|
window.console.log(sFolder, sUid);
|
||||||
|
|
||||||
|
this.message(this.staticMessage.populateByMessageListItem(null));
|
||||||
|
this.message().folderFullNameRaw = sFolder;
|
||||||
|
this.message().uid = sUid;
|
||||||
|
|
||||||
|
this.populateMessageBody(this.message());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.message(null);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
MessageUserStore.prototype.populateMessageBody = function (oMessage)
|
MessageUserStore.prototype.populateMessageBody = function (oMessage)
|
||||||
{
|
{
|
||||||
if (oMessage)
|
if (oMessage)
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@
|
||||||
ko = require('ko'),
|
ko = require('ko'),
|
||||||
|
|
||||||
Enums = require('Common/Enums'),
|
Enums = require('Common/Enums'),
|
||||||
|
Events = require('Common/Events'),
|
||||||
Audio = require('Common/Audio'),
|
Audio = require('Common/Audio'),
|
||||||
|
|
||||||
Settings = require('Storage/Settings')
|
Settings = require('Storage/Settings')
|
||||||
|
|
@ -161,7 +162,7 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
NotificationUserStore.prototype.displayDesktopNotification = function (sImageSrc, sTitle, sText)
|
NotificationUserStore.prototype.displayDesktopNotification = function (sImageSrc, sTitle, sText, oMessageData)
|
||||||
{
|
{
|
||||||
if (this.enableDesktopNotification())
|
if (this.enableDesktopNotification())
|
||||||
{
|
{
|
||||||
|
|
@ -180,6 +181,19 @@
|
||||||
oNotification.show();
|
oNotification.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (oMessageData)
|
||||||
|
{
|
||||||
|
oNotification.onclick = function () {
|
||||||
|
|
||||||
|
window.focus();
|
||||||
|
|
||||||
|
if (oMessageData.Folder && oMessageData.Uid)
|
||||||
|
{
|
||||||
|
Events.pub('mailbox.message.show', [oMessageData.Folder, oMessageData.Uid]);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
window.setTimeout((function (oLocalNotifications) {
|
window.setTimeout((function (oLocalNotifications) {
|
||||||
return function () {
|
return function () {
|
||||||
if (oLocalNotifications.cancel)
|
if (oLocalNotifications.cancel)
|
||||||
|
|
|
||||||
|
|
@ -292,6 +292,35 @@
|
||||||
}, this)
|
}, this)
|
||||||
;
|
;
|
||||||
|
|
||||||
|
Events
|
||||||
|
.sub('mailbox.message.show', function (sFolder, sUid) {
|
||||||
|
|
||||||
|
var oMessage = _.find(this.messageList(), function (oItem) {
|
||||||
|
return oItem && sFolder === oItem.folderFullNameRaw && sUid === oItem.uid;
|
||||||
|
});
|
||||||
|
|
||||||
|
if ('INBOX' === sFolder)
|
||||||
|
{
|
||||||
|
kn.setHash(Links.mailBox(sFolder, 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (oMessage)
|
||||||
|
{
|
||||||
|
this.selector.selectMessageItem(oMessage);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ('INBOX' !== sFolder)
|
||||||
|
{
|
||||||
|
kn.setHash(Links.mailBox(sFolder, 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
MessageStore.selectMessageByFolderAndUid(sFolder, sUid);
|
||||||
|
}
|
||||||
|
|
||||||
|
}, this)
|
||||||
|
;
|
||||||
|
|
||||||
MessageStore.messageListEndHash.subscribe(function () {
|
MessageStore.messageListEndHash.subscribe(function () {
|
||||||
this.selector.scrollToTop();
|
this.selector.scrollToTop();
|
||||||
}, this);
|
}, this);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue