diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml
index d09a769a3..da255351e 100644
--- a/locales/ja-JP.yml
+++ b/locales/ja-JP.yml
@@ -437,6 +437,7 @@ _sfx:
notification: "通知"
chat: "チャット"
chatBg: "チャット(バックグラウンド)"
+ antenna: "アンテナ受信"
_ago:
unknown: "謎"
diff --git a/src/client/app.vue b/src/client/app.vue
index 34e2dbf7f..7f97b6cf4 100644
--- a/src/client/app.vue
+++ b/src/client/app.vue
@@ -565,9 +565,7 @@ export default Vue.extend({
});
}
- const audio = new Audio(`/assets/sounds/${this.$store.state.device.sfxNotification}.mp3`);
- audio.volume = this.$store.state.device.sfxVolume;
- audio.play();
+ this.$root.sound('notification');
},
onMousedown(e) {
diff --git a/src/client/assets/sounds/syuilo/popo.mp3 b/src/client/assets/sounds/syuilo/popo.mp3
new file mode 100644
index 000000000..9819555c0
--- /dev/null
+++ b/src/client/assets/sounds/syuilo/popo.mp3
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:98867595eb034d709e1b414f2e68f2c7c24b7a7f95bdcdd2b024b0f8e97d24db
+size 18240
diff --git a/src/client/assets/sounds/syuilo/triple.mp3 b/src/client/assets/sounds/syuilo/triple.mp3
new file mode 100644
index 000000000..ee6803239
--- /dev/null
+++ b/src/client/assets/sounds/syuilo/triple.mp3
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:ea5df52551fd233a1e6861d237691f802c2ecce598cdbf75acc225e9194b3a16
+size 18240
diff --git a/src/client/components/timeline.vue b/src/client/components/timeline.vue
index 6befd7c2a..234ed6b07 100644
--- a/src/client/components/timeline.vue
+++ b/src/client/components/timeline.vue
@@ -53,11 +53,7 @@ export default Vue.extend({
(this.$refs.tl as any).prepend(note);
if (this.sound) {
- const audio = new Audio(note.userId === this.$store.state.i.id
- ? `/assets/sounds/${this.$store.state.device.sfxNoteMy}.mp3`
- : `/assets/sounds/${this.$store.state.device.sfxNote}.mp3`);
- audio.volume = this.$store.state.device.sfxVolume;
- audio.play();
+ this.$root.sound(note.userId === this.$store.state.i.id ? 'noteMy' : 'note');
}
};
diff --git a/src/client/init.ts b/src/client/init.ts
index 69f071ddc..d333a1289 100644
--- a/src/client/init.ts
+++ b/src/client/init.ts
@@ -189,6 +189,13 @@ os.init(async () => {
if (cb) vm.$once('closed', cb);
(vm as any).focus();
},
+ sound(type: string) {
+ const sound = this.$store.state.device['sfx' + type.substr(0, 1).toUpperCase() + type.substr(1)];
+ if (sound == null) return;
+ const audio = new Audio(`/assets/sounds/${sound}.mp3`);
+ audio.volume = this.$store.state.device.sfxVolume;
+ audio.play();
+ }
},
router: router,
render: createEl => createEl(App)
@@ -198,4 +205,96 @@ os.init(async () => {
// マウント
app.$mount('#app');
+
+ if (app.$store.getters.isSignedIn) {
+ const main = os.stream.useSharedConnection('main');
+
+ // 自分の情報が更新されたとき
+ main.on('meUpdated', i => {
+ app.$store.dispatch('mergeMe', i);
+ });
+
+ main.on('readAllNotifications', () => {
+ app.$store.dispatch('mergeMe', {
+ hasUnreadNotification: false
+ });
+ });
+
+ main.on('unreadNotification', () => {
+ app.$store.dispatch('mergeMe', {
+ hasUnreadNotification: true
+ });
+ });
+
+ main.on('unreadMention', () => {
+ app.$store.dispatch('mergeMe', {
+ hasUnreadMentions: true
+ });
+ });
+
+ main.on('readAllUnreadMentions', () => {
+ app.$store.dispatch('mergeMe', {
+ hasUnreadMentions: false
+ });
+ });
+
+ main.on('unreadSpecifiedNote', () => {
+ app.$store.dispatch('mergeMe', {
+ hasUnreadSpecifiedNotes: true
+ });
+ });
+
+ main.on('readAllUnreadSpecifiedNotes', () => {
+ app.$store.dispatch('mergeMe', {
+ hasUnreadSpecifiedNotes: false
+ });
+ });
+
+ main.on('readAllMessagingMessages', () => {
+ app.$store.dispatch('mergeMe', {
+ hasUnreadMessagingMessage: false
+ });
+ });
+
+ main.on('unreadMessagingMessage', () => {
+ app.$store.dispatch('mergeMe', {
+ hasUnreadMessagingMessage: true
+ });
+
+ app.sound('chatBg');
+ });
+
+ main.on('readAllAntennas', () => {
+ app.$store.dispatch('mergeMe', {
+ hasUnreadAntenna: false
+ });
+ });
+
+ main.on('unreadAntenna', () => {
+ app.$store.dispatch('mergeMe', {
+ hasUnreadAntenna: true
+ });
+
+ app.sound('antenna');
+ });
+
+ main.on('readAllAnnouncements', () => {
+ app.$store.dispatch('mergeMe', {
+ hasUnreadAnnouncement: false
+ });
+ });
+
+ main.on('clientSettingUpdated', x => {
+ app.$store.commit('settings/set', {
+ key: x.key,
+ value: x.value
+ });
+ });
+
+ // トークンが再生成されたとき
+ // このままではMisskeyが利用できないので強制的にサインアウトさせる
+ main.on('myTokenRegenerated', () => {
+ os.signout();
+ });
+ }
});
diff --git a/src/client/mios.ts b/src/client/mios.ts
index e0eb99769..a29dcd855 100644
--- a/src/client/mios.ts
+++ b/src/client/mios.ts
@@ -3,7 +3,7 @@ import Vue from 'vue';
import { EventEmitter } from 'eventemitter3';
import initStore from './store';
-import { apiUrl, version, locale } from './config';
+import { apiUrl, version } from './config';
import Progress from './scripts/loading';
import Stream from './scripts/stream';
@@ -142,98 +142,6 @@ export default class MiOS extends EventEmitter {
@autobind
private initStream() {
this.stream = new Stream(this);
-
- if (this.store.getters.isSignedIn) {
- const main = this.stream.useSharedConnection('main');
-
- // 自分の情報が更新されたとき
- main.on('meUpdated', i => {
- this.store.dispatch('mergeMe', i);
- });
-
- main.on('readAllNotifications', () => {
- this.store.dispatch('mergeMe', {
- hasUnreadNotification: false
- });
- });
-
- main.on('unreadNotification', () => {
- this.store.dispatch('mergeMe', {
- hasUnreadNotification: true
- });
- });
-
- main.on('unreadMention', () => {
- this.store.dispatch('mergeMe', {
- hasUnreadMentions: true
- });
- });
-
- main.on('readAllUnreadMentions', () => {
- this.store.dispatch('mergeMe', {
- hasUnreadMentions: false
- });
- });
-
- main.on('unreadSpecifiedNote', () => {
- this.store.dispatch('mergeMe', {
- hasUnreadSpecifiedNotes: true
- });
- });
-
- main.on('readAllUnreadSpecifiedNotes', () => {
- this.store.dispatch('mergeMe', {
- hasUnreadSpecifiedNotes: false
- });
- });
-
- main.on('readAllMessagingMessages', () => {
- this.store.dispatch('mergeMe', {
- hasUnreadMessagingMessage: false
- });
- });
-
- main.on('unreadMessagingMessage', () => {
- this.store.dispatch('mergeMe', {
- hasUnreadMessagingMessage: true
- });
-
- const audio = new Audio(`/assets/sounds/${this.store.state.device.sfxChatBg}.mp3`);
- audio.volume = this.store.state.device.sfxVolume;
- audio.play();
- });
-
- main.on('readAllAntennas', () => {
- this.store.dispatch('mergeMe', {
- hasUnreadAntenna: false
- });
- });
-
- main.on('unreadAntenna', () => {
- this.store.dispatch('mergeMe', {
- hasUnreadAntenna: true
- });
- });
-
- main.on('readAllAnnouncements', () => {
- this.store.dispatch('mergeMe', {
- hasUnreadAnnouncement: false
- });
- });
-
- main.on('clientSettingUpdated', x => {
- this.store.commit('settings/set', {
- key: x.key,
- value: x.value
- });
- });
-
- // トークンが再生成されたとき
- // このままではMisskeyが利用できないので強制的にサインアウトさせる
- main.on('myTokenRegenerated', () => {
- this.signout();
- });
- }
}
/**
diff --git a/src/client/pages/messaging-room.vue b/src/client/pages/messaging-room.vue
index aa0c4c93b..7f7e77fc1 100644
--- a/src/client/pages/messaging-room.vue
+++ b/src/client/pages/messaging-room.vue
@@ -184,10 +184,7 @@ export default Vue.extend({
},
onMessage(message) {
- // サウンドを再生する
- const audio = new Audio(`/assets/sounds/${this.$store.state.device.sfxChat}.mp3`);
- audio.volume = this.$store.state.device.sfxVolume;
- audio.play();
+ this.$root.sound('chat');
const isBottom = this.isBottom();
diff --git a/src/client/pages/preferences/index.vue b/src/client/pages/preferences/index.vue
index 9d57ddad5..34dcbd825 100644
--- a/src/client/pages/preferences/index.vue
+++ b/src/client/pages/preferences/index.vue
@@ -37,6 +37,11 @@
+
+ {{ $t('_sfx.antenna') }}
+
+
+
@@ -97,6 +102,8 @@ const sounds = [
'syuilo/pope1',
'syuilo/pope2',
'syuilo/waon',
+ 'syuilo/popo',
+ 'syuilo/triple',
'aisha/1',
'aisha/2',
'aisha/3',
@@ -196,6 +203,11 @@ export default Vue.extend({
get() { return this.$store.state.device.sfxChatBg; },
set(value) { this.$store.commit('device/set', { key: 'sfxChatBg', value }); }
},
+
+ sfxAntenna: {
+ get() { return this.$store.state.device.sfxAntenna; },
+ set(value) { this.$store.commit('device/set', { key: 'sfxAntenna', value }); }
+ },
},
watch: {
diff --git a/src/client/store.ts b/src/client/store.ts
index 1a26bc82d..3064cfdec 100644
--- a/src/client/store.ts
+++ b/src/client/store.ts
@@ -47,6 +47,7 @@ const defaultDeviceSettings = {
sfxNotification: 'syuilo/pope2',
sfxChat: 'syuilo/pope1',
sfxChatBg: 'syuilo/waon',
+ sfxAntenna: 'syuilo/triple',
userData: {},
};