File tree Expand file tree Collapse file tree 1 file changed +19
-3
lines changed
Expand file tree Collapse file tree 1 file changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -35,14 +35,30 @@ function onTextClick(): void {
3535
3636const supportsHover = window .matchMedia (' (hover: hover)' ).matches
3737
38- const downloadLink = ref (null )
38+ const downloadLink = ref <HTMLAnchorElement | null >(null )
39+
40+ // Auto download may be restricted in some environments, such as iOS and DuckDuckGo desktop.
41+ const isRestrictedEnv = () => {
42+ const ua = navigator .userAgent
43+ return (
44+ / (iPhone| iPod| iPad). * AppleWebKit/ i .test (ua ) ||
45+ / DuckDuckGo\/ \d + \. \d + / .test (ua )
46+ )
47+ }
3948
4049watch (
4150 () => props .success ,
4251 success => {
43- if (success && autoDownload .value && props .type === ' TRANSFER_TYPE_FILE' ) {
52+ if (
53+ success &&
54+ autoDownload .value &&
55+ props .type === ' TRANSFER_TYPE_FILE' &&
56+ ! isRestrictedEnv ()
57+ ) {
4458 setTimeout (() => {
45- downloadLink .value .click ()
59+ if (downloadLink .value ) {
60+ downloadLink .value .click ()
61+ }
4662 }, 1000 )
4763 }
4864 },
You can’t perform that action at this time.
0 commit comments