(finalUrl: string, forceSend?: boolean, displayName?: string)
| 1313 | } |
| 1314 | |
| 1315 | async function notifyUploadSuccess(finalUrl: string, forceSend?: boolean, displayName?: string): Promise<void> { |
| 1316 | if (settings.store.autoCopy) { |
| 1317 | if (!finalUrl || !finalUrl.trim()) { |
| 1318 | showToast("Upload successful, but no URL was available to copy", Toasts.Type.MESSAGE); |
| 1319 | return; |
| 1320 | } |
| 1321 | |
| 1322 | try { |
| 1323 | await copyToClipboard(finalUrl); |
| 1324 | showToast("Upload successful, URL copied to clipboard", Toasts.Type.SUCCESS); |
| 1325 | } catch (error) { |
| 1326 | logger.warn("Upload succeeded but clipboard copy failed", error); |
| 1327 | showToast("Upload successful, but failed to copy URL", Toasts.Type.MESSAGE); |
| 1328 | } |
| 1329 | } else { |
| 1330 | showToast("Upload successful", Toasts.Type.SUCCESS); |
| 1331 | } |
| 1332 | |
| 1333 | const autoSend = forceSend || Boolean((settings.store as { autoSend?: boolean; }).autoSend); |
| 1334 | if (autoSend) { |
| 1335 | const { autoFormat, displayOriginalFilename } = settings.store as { autoFormat?: boolean; displayOriginalFilename?: boolean; }; |
| 1336 | let text = finalUrl; |
| 1337 | if (displayOriginalFilename && displayName) { |
| 1338 | text = `[${displayName.replace(/[[\]]/g, "")}](${finalUrl})`; |
| 1339 | } else if (autoFormat) { |
| 1340 | text = `<${finalUrl}>`; |
| 1341 | } |
| 1342 | insertTextIntoChatInputBox(text); |
| 1343 | } |
| 1344 | } |
| 1345 | |
| 1346 | function pollNativeUploadProgress(): () => void { |
| 1347 | const native = Native; |
no outgoing calls
no test coverage detected