diff --git a/src/web/app/common/mios.ts b/src/web/app/common/mios.ts
index bc83ec0bb..c5f0d1d4d 100644
--- a/src/web/app/common/mios.ts
+++ b/src/web/app/common/mios.ts
@@ -94,6 +94,13 @@ export default class MiOS extends EventEmitter {
return localStorage.getItem('debug') == 'true';
}
+ /**
+ * Whether enable sounds
+ */
+ public get isEnableSounds() {
+ return localStorage.getItem('enableSounds') == 'true';
+ }
+
public apis: API;
/**
diff --git a/src/web/app/common/views/components/messaging-room.vue b/src/web/app/common/views/components/messaging-room.vue
index 0a675ba03..e15e10ec7 100644
--- a/src/web/app/common/views/components/messaging-room.vue
+++ b/src/web/app/common/views/components/messaging-room.vue
@@ -29,6 +29,7 @@ import Vue from 'vue';
import MessagingStreamConnection from '../../scripts/streaming/messaging-stream';
import XMessage from './messaging-room.message.vue';
import XForm from './messaging-room.form.vue';
+import { url } from '../../../config';
export default Vue.extend({
components: {
@@ -147,6 +148,11 @@ export default Vue.extend({
},
onMessage(message) {
+ // サウンドを再生する
+ if ((this as any).os.isEnableSounds) {
+ new Audio(`${url}/assets/message.mp3`).play();
+ }
+
const isBottom = this.isBottom();
this.messages.push(message);
diff --git a/src/web/app/desktop/views/components/settings.vue b/src/web/app/desktop/views/components/settings.vue
index cba14f5f9..a0ffc4e0a 100644
--- a/src/web/app/desktop/views/components/settings.vue
+++ b/src/web/app/desktop/views/components/settings.vue
@@ -26,6 +26,13 @@
+
+ サウンド
+
+ 投稿やメッセージを送受信したときなどにサウンドを再生します。この設定はブラウザに記憶されます。
+
+
+
モバイル
@@ -166,6 +173,7 @@ export default Vue.extend({
version,
latestVersion: undefined,
checkingForUpdate: false,
+ enableSounds: localStorage.getItem('enableSounds') == 'true',
lang: localStorage.getItem('lang') || '',
preventUpdate: localStorage.getItem('preventUpdate') == 'true',
debug: localStorage.getItem('debug') == 'true',
@@ -173,6 +181,9 @@ export default Vue.extend({
};
},
watch: {
+ enableSounds() {
+ localStorage.setItem('enableSounds', this.enableSounds ? 'true' : 'false');
+ },
lang() {
localStorage.setItem('lang', this.lang);
},
diff --git a/src/web/app/desktop/views/components/timeline.vue b/src/web/app/desktop/views/components/timeline.vue
index 0d16d60df..c35baa159 100644
--- a/src/web/app/desktop/views/components/timeline.vue
+++ b/src/web/app/desktop/views/components/timeline.vue
@@ -18,6 +18,7 @@