summaryrefslogtreecommitdiff
path: root/src/web/app/desktop
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2017-11-21 05:09:45 +0900
committersyuilo <syuilotan@yahoo.co.jp>2017-11-21 05:09:45 +0900
commitc598a9cba2d4cdecf2aec3dcde1a893ee039bce3 (patch)
treeecd8d77ef22f487296b7ae0b3aba44d79eaf1506 /src/web/app/desktop
parentMerge remote-tracking branch 'refs/remotes/origin/master' into sw (diff)
downloadsharkey-c598a9cba2d4cdecf2aec3dcde1a893ee039bce3.tar.gz
sharkey-c598a9cba2d4cdecf2aec3dcde1a893ee039bce3.tar.bz2
sharkey-c598a9cba2d4cdecf2aec3dcde1a893ee039bce3.zip
wip
Diffstat (limited to 'src/web/app/desktop')
-rw-r--r--src/web/app/desktop/script.ts37
1 files changed, 21 insertions, 16 deletions
diff --git a/src/web/app/desktop/script.ts b/src/web/app/desktop/script.ts
index bc0fc8dfe3..694cb7879c 100644
--- a/src/web/app/desktop/script.ts
+++ b/src/web/app/desktop/script.ts
@@ -11,9 +11,9 @@ import * as riot from 'riot';
import init from '../init';
import route from './router';
import fuckAdBlock from './scripts/fuck-ad-block';
-import getPostSummary from '../../../common/get-post-summary';
import MiOS from '../common/mios';
import HomeStreamManager from '../common/scripts/streaming/home-stream-manager';
+import composeNotification from '../common/scripts/compose-notification';
/**
* init
@@ -55,41 +55,46 @@ function registerNotifications(stream: HomeStreamManager) {
function attach(connection) {
connection.on('drive_file_created', file => {
- const n = new Notification('ファイルがアップロードされました', {
- body: file.name,
- icon: file.url + '?thumbnail&size=64'
+ 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', post => {
- const n = new Notification(`${post.user.name}さんから:`, {
- body: getPostSummary(post),
- icon: post.user.avatar_url + '?thumbnail&size=64'
+ const _n = composeNotification('mention', post);
+ const n = new Notification(_n.title, {
+ body: _n.body,
+ icon: _n.icon
});
setTimeout(n.close.bind(n), 6000);
});
connection.on('reply', post => {
- const n = new Notification(`${post.user.name}さんから返信:`, {
- body: getPostSummary(post),
- icon: post.user.avatar_url + '?thumbnail&size=64'
+ const _n = composeNotification('reply', post);
+ const n = new Notification(_n.title, {
+ body: _n.body,
+ icon: _n.icon
});
setTimeout(n.close.bind(n), 6000);
});
connection.on('quote', post => {
- const n = new Notification(`${post.user.name}さんが引用:`, {
- body: getPostSummary(post),
- icon: post.user.avatar_url + '?thumbnail&size=64'
+ const _n = composeNotification('quote', post);
+ const n = new Notification(_n.title, {
+ body: _n.body,
+ icon: _n.icon
});
setTimeout(n.close.bind(n), 6000);
});
connection.on('unread_messaging_message', message => {
- const n = new Notification(`${message.user.name}さんからメッセージ:`, {
- body: message.text, // TODO: getMessagingMessageSummary(message),
- icon: message.user.avatar_url + '?thumbnail&size=64'
+ const _n = composeNotification('unread_messaging_message', message);
+ const n = new Notification(_n.title, {
+ body: _n.body,
+ icon: _n.icon
});
n.onclick = () => {
n.close();