1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00
jellyfin-web/src/components/alert.js
dantesbr 05cce43ffd Backport pull request #6408 from jellyfin-web/release-10.10.z
Fix focus loss on popups in Samsung Tizen 8 Smart TVs

Original-merge: cc011feffb

Merged-by: thornbill <thornbill@users.noreply.github.com>

Backported-by: thornbill <thornbill@users.noreply.github.com>
2025-01-22 03:12:45 -05:00

34 lines
905 B
JavaScript

import { appRouter } from './router/appRouter';
import browser from '../scripts/browser';
import dialog from './dialog/dialog';
import globalize from '../lib/globalize';
export default async function (text, title) {
// Modals seem to be blocked on Web OS and Tizen 2.x
const canUseNativeAlert = !!(
!browser.web0s
&& !(browser.tizenVersion && (browser.tizenVersion < 3 || browser.tizenVersion >= 8))
&& browser.tv
&& window.alert
);
const options = typeof text === 'string' ? { title, text } : text;
await appRouter.ready();
if (canUseNativeAlert) {
alert((options.text || '').replaceAll('<br/>', '\n'));
return Promise.resolve();
}
options.buttons = [
{
name: globalize.translate('ButtonGotIt'),
id: 'ok',
type: 'submit'
}
];
return dialog.show(options);
}