mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-03-11 21:27:05 +00:00
added an error toast on copy fail
This commit is contained in:
parent
bb170f53c8
commit
c0b82fdefe
1 changed files with 20 additions and 5 deletions
|
|
@ -8,7 +8,6 @@ const { Button, Image, useProfile, platform, useToast, Popup, useBinaryState } =
|
||||||
const { useServices } = require('stremio/services');
|
const { useServices } = require('stremio/services');
|
||||||
const StreamPlaceholder = require('./StreamPlaceholder');
|
const StreamPlaceholder = require('./StreamPlaceholder');
|
||||||
const { t } = require('i18next');
|
const { t } = require('i18next');
|
||||||
|
|
||||||
const styles = require('./styles');
|
const styles = require('./styles');
|
||||||
|
|
||||||
const Stream = ({ className, videoId, videoReleased, addonName, name, description, thumbnail, progress, deepLinks, ...props }) => {
|
const Stream = ({ className, videoId, videoReleased, addonName, name, description, thumbnail, progress, deepLinks, ...props }) => {
|
||||||
|
|
@ -112,11 +111,27 @@ const Stream = ({ className, videoId, videoReleased, addonName, name, descriptio
|
||||||
const copyMagneticLinkToClipboard = React.useCallback((event) => {
|
const copyMagneticLinkToClipboard = React.useCallback((event) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
if (deepLinks?.externalPlayer?.download && navigator?.clipboard) {
|
if (deepLinks?.externalPlayer?.download && navigator?.clipboard) {
|
||||||
navigator.clipboard.writeText(deepLinks.externalPlayer.download);
|
navigator.clipboard.writeText(deepLinks.externalPlayer.download)
|
||||||
|
.then(() => {
|
||||||
|
toast.show({
|
||||||
|
type: 'success',
|
||||||
|
title: t('PLAYER_COPY_DOWNLOAD_LINK_SUCCESS'),
|
||||||
|
timeout: 4000
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
toast.show({
|
||||||
|
type: 'error',
|
||||||
|
title: t('PLAYER_COPY_DOWNLOAD_LINK_ERROR'),
|
||||||
|
timeout: 4000,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
} else {
|
||||||
toast.show({
|
toast.show({
|
||||||
type: 'success',
|
type: 'error',
|
||||||
title: t('PLAYER_COPY_DOWNLOAD_LINK_SUCCESS'),
|
title: t('PLAYER_COPY_DOWNLOAD_LINK_ERROR'),
|
||||||
timeout: 4000
|
timeout: 4000,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
closeMenu();
|
closeMenu();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue