4b6cf4b86a
Re-implement tray envelope icon for unread messages. Fix minimize on close bug.
25 lines
708 B
JavaScript
25 lines
708 B
JavaScript
/* global api */
|
|
|
|
converse.plugins.add('converse-desktop-trayicon', {
|
|
|
|
initialize() {
|
|
const {_converse} = this;
|
|
let envelopeIsShowing = false;
|
|
|
|
function hideEnvelope() {
|
|
if (envelopeIsShowing) {
|
|
api.trayService.hideEnvelope();
|
|
envelopeIsShowing = false;
|
|
}
|
|
}
|
|
|
|
window.addEventListener('focus', hideEnvelope);
|
|
_converse.api.listen.on('chatBoxInitialized', hideEnvelope);
|
|
_converse.api.listen.on('chatBoxFocused', hideEnvelope);
|
|
_converse.api.listen.on('messageNotification', () => {
|
|
api.trayService.showEnvelope();
|
|
envelopeIsShowing = true;
|
|
});
|
|
}
|
|
});
|