web/download: assume userActivation expired if agent doesn't support it

This commit is contained in:
wukko 2024-09-11 14:42:54 +06:00
parent 6e3589c8ce
commit d7454a073b
No known key found for this signature in database
GPG key ID: 3E30B3F26C7B4AA2

View file

@ -77,8 +77,10 @@ export const downloadFile = ({ url, file }: { url?: string, file?: File }) => {
navigator.userActivation.isActive makes sure that we're still able to navigator.userActivation.isActive makes sure that we're still able to
invoke an action without the user agent interrupting it. invoke an action without the user agent interrupting it.
if not, we show a saving dialog for user to re-invoke that action. if not, we show a saving dialog for user to re-invoke that action.
if browser is old or doesn't support this API, we just assume that it expired.
*/ */
if (!navigator.userActivation.isActive) { if (!navigator?.userActivation?.isActive) {
return openSavingDialog({ return openSavingDialog({
url, url,
file, file,