From 87fc6522fb204e9196e34ce62c0ddccfed0b5e57 Mon Sep 17 00:00:00 2001 From: syuilo Date: Thu, 21 Jun 2018 11:35:28 +0900 Subject: Improve ServiceWorker notification --- src/client/app/desktop/script.ts | 28 +++++----------------------- 1 file changed, 5 insertions(+), 23 deletions(-) (limited to 'src/client/app/desktop/script.ts') diff --git a/src/client/app/desktop/script.ts b/src/client/app/desktop/script.ts index 201ab0a83d..beb358c7ee 100644 --- a/src/client/app/desktop/script.ts +++ b/src/client/app/desktop/script.ts @@ -115,26 +115,8 @@ function registerNotifications(stream: HomeStreamManager) { }); function attach(connection) { - connection.on('drive_file_created', file => { - const _n = composeNotification('drive_file_created', file); - const n = new Notification(_n.title, { - body: _n.body, - icon: _n.icon - }); - setTimeout(n.close.bind(n), 5000); - }); - - connection.on('mention', note => { - const _n = composeNotification('mention', note); - const n = new Notification(_n.title, { - body: _n.body, - icon: _n.icon - }); - setTimeout(n.close.bind(n), 6000); - }); - - connection.on('reply', note => { - const _n = composeNotification('reply', note); + connection.on('notification', notification => { + const _n = composeNotification('notification', notification); const n = new Notification(_n.title, { body: _n.body, icon: _n.icon @@ -142,13 +124,13 @@ function registerNotifications(stream: HomeStreamManager) { setTimeout(n.close.bind(n), 6000); }); - connection.on('quote', note => { - const _n = composeNotification('quote', note); + connection.on('drive_file_created', file => { + const _n = composeNotification('drive_file_created', file); const n = new Notification(_n.title, { body: _n.body, icon: _n.icon }); - setTimeout(n.close.bind(n), 6000); + setTimeout(n.close.bind(n), 5000); }); connection.on('unread_messaging_message', message => { -- cgit v1.2.3-freya