Settings: Link notification sounds to playSound.

Fix: Restore hooks.ts patch, additionally use numbers.
This commit is contained in:
Paul
2021-06-24 14:26:18 +01:00
parent 352c0e880c
commit 8f62625506
10 changed files with 104 additions and 62 deletions

View File

@@ -23,6 +23,7 @@ import { SingletonMessageRenderer, SMOOTH_SCROLL_ON_RECEIVE } from "../../../lib
import ReplyBar from "./bars/ReplyBar";
import FilePreview from './bars/FilePreview';
import AutoComplete, { useAutoComplete } from "../AutoComplete";
import { SoundContext } from "../../../context/Settings";
type Props = WithDispatcher & {
channel: Channel;
@@ -59,6 +60,7 @@ function MessageBox({ channel, draft, dispatcher }: Props) {
const [ uploadState, setUploadState ] = useState<UploadState>({ type: 'none' });
const [ typing, setTyping ] = useState<boolean | number>(false);
const [ replies, setReplies ] = useState<Reply[]>([]);
const playSound = useContext(SoundContext);
const { openScreen } = useIntermediate();
const client = useContext(AppContext);
const translate = useTranslation();
@@ -108,6 +110,7 @@ function MessageBox({ channel, draft, dispatcher }: Props) {
stopTyping();
setMessage();
setReplies([]);
playSound('outbound');
const nonce = ulid();
dispatcher({
@@ -208,6 +211,7 @@ function MessageBox({ channel, draft, dispatcher }: Props) {
setMessage();
setReplies([]);
playSound('outbound');
if (files.length > CAN_UPLOAD_AT_ONCE) {
setUploadState({