diff --git a/src/equicordplugins/downloadify/index.tsx b/src/equicordplugins/downloadify/index.tsx index 4e612f2f6..3b0fb0618 100644 --- a/src/equicordplugins/downloadify/index.tsx +++ b/src/equicordplugins/downloadify/index.tsx @@ -91,23 +91,13 @@ export default definePlugin({ replacement: [ { // Make use of the download function. - match: /(let{item:\i}=(\i).{0,450}?)let \i=(await \i.\i.saveImage\(\i,\i.contentType,\i.\i\)).{0,110}?&&/, + match: /(let{item:\i}=(\i).{0,450}?)(\i\(!0\);try{.{0,400}?finally{\i\(!1\)})/, replace: "$1await $self.handleExpandedModalDownloadButtonClicked($2,async()=>{$3});", }, - { - // Disable default success toast. - match: /\(\(0,.{0,85}?ToastType.SUCCESS\)\)\)/, - replace: "", - }, - { - // Disable default failure toast. - match: /(\(0,.{0,85}?ToastType.FAILURE\)\))/, - replace: "", - }, { // Prevent videos from opening in browser. - match: /(let{item:\i}=\i.{0,350}?)(SAVE_MEDIA_PRESSED\)).{0,100}?(\i\(!0\);)/, - replace: "$1$2,true){$3" + match: /(let{item:\i}=\i.{0,350}?)(SAVE_MEDIA_PRESSED\)).{0,100}?type\){/, + replace: "$1$2,true){" } ], } diff --git a/src/equicordplugins/downloadify/utils/handlers.tsx b/src/equicordplugins/downloadify/utils/handlers.tsx index 42dd32fc7..43f336578 100644 --- a/src/equicordplugins/downloadify/utils/handlers.tsx +++ b/src/equicordplugins/downloadify/utils/handlers.tsx @@ -677,7 +677,7 @@ export async function handleHoverDownloadButtonClicked(props: HoverDownloadProps if (!originalItem) { // Fallback to default behavior. DownloadifyLogger.info(`[${getFormattedNow()}] [UNRECOGNIZED HOVER DOWNLOAD ITEM]`, props.item); - displayStatus && showToast("File Opened in Browser", Toasts.Type.MESSAGE, { duration: statusDuration * 1000 }); + displayStatus && showToast("Unknown Media Item. Falling Back to Default Behavior", Toasts.Type.MESSAGE, { duration: statusDuration * 1250 }); window.open(downloadUrl, "_blank"); } else { contentType ??= (await DownloadifyNative.queryURL(downloadUrl) || ""); @@ -700,15 +700,8 @@ export async function handleExpandedModalDownloadButtonClicked(props: ExpandedMo if (!url && !original) { // Fallback to default behavior. DownloadifyLogger.info(`[${getFormattedNow()}] [UNRECOGNIZED EXPANDED MODAL DOWNLOAD ITEM]`, props.item); - displayStatus && showToast("Download Started", Toasts.Type.MESSAGE, { duration: statusDuration * 1000 }); - - try { - await fallback(); - displayStatus && showToast("Download Success", Toasts.Type.SUCCESS, { duration: statusDuration * 1000 }); - } catch (error) { - DownloadifyLogger.info(`[${getFormattedNow()}] [FALLBACK DOWNLOAD FAILED]`, error); - displayStatus && showToast("Download Failed", Toasts.Type.FAILURE, { duration: statusDuration * 1000 }); - } + displayStatus && showToast("Unknown Media Item. Falling Back to Default Behavior", Toasts.Type.MESSAGE, { duration: statusDuration * 1250 }); + await fallback(); } else { contentType ??= (await DownloadifyNative.queryURL(url) || ""); let aliasBasename = sourceMetadata?.identifier.title ?? null;