feat: 노트 편집 시 토스트 알림을 표시하고 사운드를 재생

This commit is contained in:
NoriDev 2023-10-19 17:05:47 +09:00
parent 881fdeb2f0
commit f47c14f086
12 changed files with 43 additions and 15 deletions

View file

@ -28,6 +28,9 @@ Misskey의 전체 변경 사항을 확인하려면, [CHANGELOG.md#2023xx](CHANGE
기반 Misskey 버전: 2023.x.x<br>
Misskey의 전체 변경 사항을 확인하려면, [CHANGELOG.md#2023xx](CHANGELOG.md#2023xx) 문서를 참고하십시오.
### Client
- Feat: 노트 편집 시 토스트 알림을 표시하고 사운드를 재생
### Server
- Revert: Perf: 부팅 시 MeiliSearch 설정을 업데이트하지 마십시오 (MisskeyIO/misskey#158)

View file

@ -1,5 +1,6 @@
---
_lang_: "English"
noteEdited: "Note are now edited."
removeModalBgColorForBlur: "Remove modal background color"
skipThisVersion: "Skip this release"
enableReceivePrerelease: "Get notified of pre-release versions"
@ -1977,6 +1978,7 @@ _theme:
_sfx:
note: "New note"
noteMy: "Own note"
noteEdited: "Note Edited"
notification: "Notifications"
chat: "Chat"
chatBg: "Chat (Background)"

2
locales/index.d.ts vendored
View file

@ -3,6 +3,7 @@
// Do not edit this file directly.
export interface Locale {
"_lang_": string;
"noteEdited": string;
"removeModalBgColorForBlur": string;
"skipThisVersion": string;
"enableReceivePrerelease": string;
@ -2104,6 +2105,7 @@ export interface Locale {
"_sfx": {
"note": string;
"noteMy": string;
"noteEdited": string;
"notification": string;
"chat": string;
"chatBg": string;

View file

@ -1,5 +1,6 @@
_lang_: "日本語"
noteEdited: "ノートを編集しました。"
removeModalBgColorForBlur: "モーダル背景色を削除"
skipThisVersion: "このリリースをスキップする"
enableReceivePrerelease: "プレリリース版の通知を受け取る"
@ -2018,6 +2019,7 @@ _theme:
_sfx:
note: "ノート"
noteMy: "ノート(自分)"
noteEdited: "ノートを編集"
notification: "通知"
chat: "チャット"
chatBg: "チャット(バックグラウンド)"

View file

@ -1,5 +1,6 @@
---
_lang_: "한국어"
noteEdited: "노트를 편집했어요!"
removeModalBgColorForBlur: "모달 배경색 제거"
skipThisVersion: "이 릴리즈 건너뛰기"
enableReceivePrerelease: "출시 전 버전 알림 받기"
@ -1954,6 +1955,7 @@ _theme:
_sfx:
note: "새 노트"
noteMy: "내 노트"
noteEdited: "노트 편집"
notification: "알림"
chat: "대화"
chatBg: "대화 (백그라운드)"

View file

@ -14,7 +14,7 @@ SPDX-License-Identifier: AGPL-3.0-only
>
<div v-if="showing" class="_acrylic" :class="[$style.root, { [$style.reduceBlurEffect]: !defaultStore.state.useBlurEffect }]" :style="{ zIndex }">
<div style="padding: 16px 24px;">
<i :class="icon === 'posted' ? 'ti-check' : icon === 'reply' ? 'ti-arrow-back-up' : icon === 'renote' ? 'ti-repeat' : icon === 'quote' ? 'ti-quote' : 'ti-check'" class="ti"></i>
<i :class="icon === 'posted' ? 'ti-check' : icon === 'reply' ? 'ti-arrow-back-up' : icon === 'renote' ? 'ti-repeat' : icon === 'quote' ? 'ti-quote' : icon === 'edited' ? 'ti ti-pencil' : 'ti-check'" class="ti"></i>
{{ message }}
</div>
</div>

View file

@ -47,7 +47,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<template v-if="posted"></template>
<template v-else-if="posting"><MkEllipsis/></template>
<template v-else>{{ submitText }}</template>
<i style="margin-left: 6px;" :class="posted ? 'ti ti-check' : reply ? 'ti ti-arrow-back-up' : renote ? 'ti ti-quote' : defaultStore.state.renameTheButtonInPostFormToNya ? 'ti ti-paw-filled' : 'ti ti-send'"></i>
<i style="margin-left: 6px;" :class="posted ? 'ti ti-check' : reply ? 'ti ti-arrow-back-up' : renote ? 'ti ti-quote' : updateMode ? 'ti ti-pencil' : defaultStore.state.renameTheButtonInPostFormToNya ? 'ti ti-paw-filled' : 'ti ti-send'"></i>
</div>
</button>
</div>
@ -130,6 +130,7 @@ import MkRippleEffect from '@/components/MkRippleEffect.vue';
import { miLocalStorage } from '@/local-storage.js';
import { claimAchievement } from '@/scripts/achievements.js';
import { vibrate } from '@/scripts/vibrate.js';
import * as sound from '@/scripts/sound.js';
const modal = inject('modal');
@ -241,9 +242,11 @@ const submitText = $computed((): string => {
? i18n.ts.quote
: props.reply
? i18n.ts.reply
: defaultStore.state.renameTheButtonInPostFormToNya
? i18n.ts.nya
: i18n.ts.note;
: props.updateMode
? i18n.ts.edit
: defaultStore.state.renameTheButtonInPostFormToNya
? i18n.ts.nya
: i18n.ts.note;
});
const textLength = $computed((): number => {
@ -790,6 +793,7 @@ async function post(ev?: MouseEvent) {
nextTick(() => {
if (props.reply) os.noteToast(i18n.ts.replied, 'reply');
else if (props.renote) os.noteToast(i18n.ts.quoted, 'quote');
else if (props.updateMode) os.noteToast(i18n.ts.noteEdited, 'edited');
else os.noteToast(i18n.ts.posted, 'posted');
deleteDraft();
@ -851,6 +855,7 @@ async function post(ev?: MouseEvent) {
text: err.message + '\n' + (err as any).id,
});
});
if (props.updateMode) sound.play('noteEdited');
vibrate(ColdDeviceStorage.get('vibrateSystem') ? [10, 20, 10, 20, 10, 20, 60] : '');
}

View file

@ -53,7 +53,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<template v-if="posted"></template>
<template v-else-if="posting"><MkEllipsis/></template>
<template v-else>{{ submitText }}</template>
<i style="margin-left: 6px;" :class="posted ? 'ti ti-check' : reply ? 'ti ti-arrow-back-up' : renote ? 'ti ti-quote' : defaultStore.state.renameTheButtonInPostFormToNya ? 'ti ti-paw-filled' : 'ti ti-send'"></i>
<i style="margin-left: 6px;" :class="posted ? 'ti ti-check' : reply ? 'ti ti-arrow-back-up' : renote ? 'ti ti-quote' : updateMode ? 'ti ti-pencil' : defaultStore.state.renameTheButtonInPostFormToNya ? 'ti ti-paw-filled' : 'ti ti-send'"></i>
</div>
</button>
</div>
@ -81,7 +81,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<template v-if="posted"></template>
<template v-else-if="posting"><MkEllipsis/></template>
<template v-else>{{ submitText }}</template>
<i v-if="$i" style="margin-left: 6px;" :class="posted ? 'ti ti-check' : reply ? 'ti ti-arrow-back-up' : renote ? 'ti ti-quote' : defaultStore.state.renameTheButtonInPostFormToNya ? 'ti ti-paw-filled' : 'ti ti-send'"></i>
<i v-if="$i" style="margin-left: 6px;" :class="posted ? 'ti ti-check' : reply ? 'ti ti-arrow-back-up' : renote ? 'ti ti-quote' : updateMode ? 'ti ti-pencil' : defaultStore.state.renameTheButtonInPostFormToNya ? 'ti ti-paw-filled' : 'ti ti-send'"></i>
</div>
</button>
</div>
@ -151,6 +151,7 @@ import { miLocalStorage } from '@/local-storage.js';
import { claimAchievement } from '@/scripts/achievements.js';
import { vibrate } from '@/scripts/vibrate.js';
import XSigninDialog from '@/components/MkSigninDialog.vue';
import * as sound from '@/scripts/sound.js';
const modal = inject('modal');
@ -268,9 +269,11 @@ const submitText = $computed((): string => {
? i18n.ts.quote
: props.reply
? i18n.ts.reply
: defaultStore.state.renameTheButtonInPostFormToNya
? i18n.ts.nya
: i18n.ts.note;
: props.updateMode
? i18n.ts.edit
: defaultStore.state.renameTheButtonInPostFormToNya
? i18n.ts.nya
: i18n.ts.note;
});
const textLength = $computed((): number => {
@ -811,6 +814,7 @@ async function post(ev?: MouseEvent) {
nextTick(() => {
if (props.reply) os.noteToast(i18n.ts.replied, 'reply');
else if (props.renote) os.noteToast(i18n.ts.quoted, 'quote');
else if (props.updateMode) os.noteToast(i18n.ts.noteEdited, 'edited');
else os.noteToast(i18n.ts.posted, 'posted');
deleteDraft();
@ -872,6 +876,7 @@ async function post(ev?: MouseEvent) {
text: err.message + '\n' + (err as any).id,
});
});
if (props.updateMode) sound.play('noteEdited');
vibrate(ColdDeviceStorage.get('vibrateSystem') ? [10, 20, 10, 20, 10, 20, 60] : '');
}

View file

@ -136,6 +136,7 @@ const coldDeviceStorageSaveKeys: (keyof typeof ColdDeviceStorage.default)[] = [
'sound_masterVolume',
'sound_note',
'sound_noteMy',
'sound_noteEdited',
'sound_notification',
'sound_chat',
'sound_chatBg',

View file

@ -54,11 +54,12 @@ import { unisonReload } from '@/scripts/unison-reload.js';
const masterVolume = computed(soundConfigStore.makeGetterSetter('sound_masterVolume'));
const soundsKeys = ['note', 'noteMy', 'notification', 'chat', 'chatBg', 'antenna', 'channel'] as const;
const soundsKeys = ['note', 'noteMy', 'noteEdited', 'notification', 'chat', 'chatBg', 'antenna', 'channel'] as const;
const sounds = ref<Record<typeof soundsKeys[number], Ref<any>>>({
note: soundConfigStore.reactiveState.sound_note,
noteMy: soundConfigStore.reactiveState.sound_noteMy,
noteEdited: soundConfigStore.reactiveState.sound_noteEdited,
notification: soundConfigStore.reactiveState.sound_notification,
chat: soundConfigStore.reactiveState.sound_chat,
chatBg: soundConfigStore.reactiveState.sound_chatBg,

View file

@ -19,6 +19,10 @@ export const soundConfigStore = markRaw(new Storage('sound', {
where: 'account',
default: { type: 'syuilo/n-cea-4va', volume: 1 },
},
sound_noteEdited: {
where: 'account',
default: { type: 'syuilo/n-eca', volume: 1 },
},
sound_notification: {
where: 'account',
default: { type: 'syuilo/n-ea', volume: 1 },
@ -125,7 +129,7 @@ export function setVolume(audio: HTMLAudioElement, volume: number): HTMLAudioEle
return audio;
}
export function play(type: 'noteMy' | 'note' | 'chat' | 'chatBg' | 'antenna' | 'channel' | 'notification') {
export function play(type: 'noteMy' | 'note' | 'noteEdited' | 'chat' | 'chatBg' | 'antenna' | 'channel' | 'notification') {
const sound = soundConfigStore.state[`sound_${type}`];
if (_DEV_) console.log('play', type, sound);
if (sound.type == null) return;

View file

@ -594,9 +594,10 @@ export class ColdDeviceStorage {
vibrateChatBg: true,
vibrateSystem: true,
sound_masterVolume: 0.5,
sound_note: { type: 'syuilo/down', volume: 0.5 },
sound_noteMy: { type: 'syuilo/up', volume: 0.5 },
sound_notification: { type: 'syuilo/pope2', volume: 0.5 },
sound_note: { type: 'syuilo/n-aec', volume: 0.5 },
sound_noteMy: { type: 'syuilo/n-cea-4va', volume: 0.5 },
sound_noteEdited: { type: 'syuilo/n-eca', volume: 0.5 },
sound_notification: { type: 'syuilo/n-ea', volume: 0.5 },
sound_chat: { type: 'syuilo/pope1', volume: 0.5 },
sound_chatBg: { type: 'syuilo/waon', volume: 0.5 },
sound_antenna: { type: 'syuilo/triple', volume: 0.5 },