mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2025-12-24 20:26:24 +00:00
Fix crashes when playing media on legacy OS
This commit is contained in:
@@ -6,6 +6,7 @@ import classNames from 'classnames';
|
||||
import { noop } from 'lodash';
|
||||
|
||||
import { assert } from '../../util/assert';
|
||||
import { showToast } from '../../util/showToast';
|
||||
import type { LocalizerType } from '../../types/Util';
|
||||
import type { AttachmentType } from '../../types/Attachment';
|
||||
import { hasNotDownloaded } from '../../types/Attachment';
|
||||
@@ -13,6 +14,7 @@ import type { DirectionType, MessageStatusType } from './Message';
|
||||
|
||||
import type { ComputePeaksResult } from '../GlobalAudioContext';
|
||||
import { MessageMetadata } from './MessageMetadata';
|
||||
import { ToastUnableToLoadAttachment } from '../ToastUnableToLoadAttachment';
|
||||
import * as log from '../../logging/log';
|
||||
|
||||
export type Props = {
|
||||
@@ -350,6 +352,11 @@ export const MessageAudio: React.FC<Props> = (props: Props) => {
|
||||
}, [id, audio, isActive, isPlaying, currentTime]);
|
||||
|
||||
const toggleIsPlaying = () => {
|
||||
if (window.isLegacyOS()) {
|
||||
showToast(ToastUnableToLoadAttachment);
|
||||
return;
|
||||
}
|
||||
|
||||
setIsPlaying(!isPlaying);
|
||||
|
||||
if (!isActive && !isPlaying) {
|
||||
|
||||
Reference in New Issue
Block a user