Add sound to reactions

Signed-off-by: limepotato <limepot@protonmail.ch>
This commit is contained in:
syuilo 2024-07-14 03:25:34 -06:00 committed by limepotato
parent 40cbd16f4b
commit 12f38a67c5
6 changed files with 13 additions and 0 deletions

View file

@ -1472,6 +1472,7 @@ _sfx:
chatBg: "Chat (Background)" chatBg: "Chat (Background)"
antenna: "Antennas" antenna: "Antennas"
channel: "Channel notifications" channel: "Channel notifications"
reaction: "Reaction"
_ago: _ago:
future: "Future" future: "Future"
justNow: "Just now" justNow: "Just now"

View file

@ -283,6 +283,7 @@ import { getWordSoftMute } from "@/scripts/check-word-mute";
import { useRouter } from "@/router"; import { useRouter } from "@/router";
import { userPage } from "@/filters/user"; import { userPage } from "@/filters/user";
import * as os from "@/os"; import * as os from "@/os";
import * as sound from '@/scripts/sound.js';
import { defaultStore, noteViewInterruptors } from "@/store"; import { defaultStore, noteViewInterruptors } from "@/store";
import { reactionPicker } from "@/scripts/reaction-picker"; import { reactionPicker } from "@/scripts/reaction-picker";
import { $i } from "@/account"; import { $i } from "@/account";
@ -390,6 +391,8 @@ function react(viaKeyboard = false): void {
reactionPicker.show( reactionPicker.show(
reactButton.value, reactButton.value,
(reaction) => { (reaction) => {
sound.play('reaction');
os.api("notes/reactions/create", { os.api("notes/reactions/create", {
noteId: appearNote.id, noteId: appearNote.id,
reaction: reaction, reaction: reaction,

View file

@ -177,6 +177,7 @@ import { pleaseLogin } from "@/scripts/please-login";
import { getWordSoftMute } from "@/scripts/check-word-mute"; import { getWordSoftMute } from "@/scripts/check-word-mute";
import { userPage } from "@/filters/user"; import { userPage } from "@/filters/user";
import * as os from "@/os"; import * as os from "@/os";
import * as sound from '@/scripts/sound.js';
import { defaultStore, noteViewInterruptors } from "@/store"; import { defaultStore, noteViewInterruptors } from "@/store";
import { reactionPicker } from "@/scripts/reaction-picker"; import { reactionPicker } from "@/scripts/reaction-picker";
import { $i } from "@/account"; import { $i } from "@/account";
@ -273,6 +274,8 @@ function react(viaKeyboard = false): void {
reactionPicker.show( reactionPicker.show(
reactButton.value, reactButton.value,
(reaction) => { (reaction) => {
sound.play('reaction');
os.api("notes/reactions/create", { os.api("notes/reactions/create", {
noteId: note.id, noteId: note.id,
reaction: reaction, reaction: reaction,

View file

@ -28,6 +28,7 @@ import XReactionIcon from "@/components/MkReactionIcon.vue";
import * as os from "@/os"; import * as os from "@/os";
import { useTooltip } from "@/scripts/use-tooltip"; import { useTooltip } from "@/scripts/use-tooltip";
import { $i } from "@/account"; import { $i } from "@/account";
import * as sound from '@/scripts/sound.js';
const props = defineProps<{ const props = defineProps<{
reaction: string; reaction: string;
@ -53,6 +54,7 @@ const toggleReaction = () => {
noteId: props.note.id, noteId: props.note.id,
}).then(() => { }).then(() => {
if (oldReaction !== props.reaction) { if (oldReaction !== props.reaction) {
sound.play('reaction');
os.api("notes/reactions/create", { os.api("notes/reactions/create", {
noteId: props.note.id, noteId: props.note.id,
reaction: props.reaction, reaction: props.reaction,
@ -60,6 +62,8 @@ const toggleReaction = () => {
} }
}); });
} else { } else {
sound.play('reaction');
os.api("notes/reactions/create", { os.api("notes/reactions/create", {
noteId: props.note.id, noteId: props.note.id,
reaction: props.reaction, reaction: props.reaction,

View file

@ -71,6 +71,7 @@ const sounds = ref({
chatBg: ColdDeviceStorage.get("sound_chatBg"), chatBg: ColdDeviceStorage.get("sound_chatBg"),
antenna: ColdDeviceStorage.get("sound_antenna"), antenna: ColdDeviceStorage.get("sound_antenna"),
channel: ColdDeviceStorage.get("sound_channel"), channel: ColdDeviceStorage.get("sound_channel"),
reaction: ColdDeviceStorage.get("sound_reaction"),
}); });
const soundsTypes = await os.api("get-sounds"); const soundsTypes = await os.api("get-sounds");

View file

@ -388,6 +388,7 @@ export class ColdDeviceStorage {
sound_chatBg: { type: 'syuilo/waon', volume: 0.5 }, sound_chatBg: { type: 'syuilo/waon', volume: 0.5 },
sound_antenna: { type: 'syuilo/triple', volume: 0.5 }, sound_antenna: { type: 'syuilo/triple', volume: 0.5 },
sound_channel: { type: 'syuilo/square-pico', volume: 0.5 }, sound_channel: { type: 'syuilo/square-pico', volume: 0.5 },
sound_reaction: { type: 'syuilo/bubble2', volume: 1 },
}; };
public static watchers = []; public static watchers = [];