sw: なんかもうめっちゃ変えた (#10570)
* sw: なんかいろいろ * remove debug code * never renotify * update changelog.md
This commit is contained in:
parent
f6dc100748
commit
3a90bcc03c
10 changed files with 106 additions and 31 deletions
|
@ -21,7 +21,7 @@ const iconUrl = (name: BadgeNames) => `/static-assets/tabler-badges/${name}.png`
|
|||
* 1. Find the icon and download png from https://tabler-icons.io/
|
||||
* 2. vips resize ~/Downloads/icon-name.png vipswork.png 0.4; vips scRGB2BW vipswork.png ~/icon-name.png"[compression=9,strip]"; rm vipswork.png;
|
||||
* 3. mv ~/icon-name.png ~/misskey/packages/backend/assets/tabler-badges/
|
||||
* 4. Add 'icon-name' to badgeNames
|
||||
* 4. Add 'icon-name' to BadgeNames
|
||||
* 5. Add `badge: iconUrl('icon-name'),`
|
||||
*/
|
||||
|
||||
|
@ -168,14 +168,6 @@ async function composeNotification(data: PushNotificationDataMap[keyof PushNotif
|
|||
}];
|
||||
}
|
||||
|
||||
case 'pollEnded':
|
||||
return [t('_notification.pollEnded'), {
|
||||
body: data.body.note.text || '',
|
||||
badge: iconUrl('chart-arrows'),
|
||||
tag: `poll:${data.body.note.id}`,
|
||||
data,
|
||||
}];
|
||||
|
||||
case 'receiveFollowRequest':
|
||||
return [t('_notification.youReceivedFollowRequest'), {
|
||||
body: getUserName(data.body.user),
|
||||
|
@ -202,6 +194,14 @@ async function composeNotification(data: PushNotificationDataMap[keyof PushNotif
|
|||
data,
|
||||
}];
|
||||
|
||||
case 'achievementEarned':
|
||||
return [t('_notification.achievementEarned'), {
|
||||
body: t(`_achievements._types._${data.body.achievement}.title`),
|
||||
badge: iconUrl('medal'),
|
||||
data,
|
||||
tag: `achievement:${data.body.achievement}`,
|
||||
}];
|
||||
|
||||
case 'app':
|
||||
return [data.body.header ?? data.body.body, {
|
||||
body: data.body.header ? data.body.body : '',
|
||||
|
@ -233,17 +233,29 @@ export async function createEmptyNotification() {
|
|||
const { t } = i18n;
|
||||
|
||||
await globalThis.registration.showNotification(
|
||||
t('_notification.emptyPushNotificationMessage'),
|
||||
(new URL(origin)).host,
|
||||
{
|
||||
body: `Misskey v${_VERSION_}`,
|
||||
silent: true,
|
||||
badge: iconUrl('null'),
|
||||
tag: 'read_notification',
|
||||
actions: [
|
||||
{
|
||||
action: 'markAllAsRead',
|
||||
title: t('markAllAsRead'),
|
||||
},
|
||||
{
|
||||
action: 'settings',
|
||||
title: t('notificationSettings'),
|
||||
},
|
||||
],
|
||||
data: {},
|
||||
},
|
||||
);
|
||||
|
||||
setTimeout(async () => {
|
||||
try {
|
||||
await closeNotificationsByTags(['user_visible_auto_notification', 'read_notification']);
|
||||
await closeNotificationsByTags(['user_visible_auto_notification']);
|
||||
} finally {
|
||||
res();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue