@bobfrankston/rmfmail 1.1.79 → 1.1.81

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/.commitmsg +20 -14
  2. package/client/android-bootstrap.bundle.js +5 -0
  3. package/client/android-bootstrap.bundle.js.map +2 -2
  4. package/client/app.bundle.js +32 -17
  5. package/client/app.bundle.js.map +3 -3
  6. package/client/app.js +8 -0
  7. package/client/app.js.map +1 -1
  8. package/client/app.ts +8 -0
  9. package/client/components/message-viewer.js +33 -20
  10. package/client/components/message-viewer.js.map +1 -1
  11. package/client/components/message-viewer.ts +32 -19
  12. package/client/compose/compose.bundle.js +5 -0
  13. package/client/compose/compose.bundle.js.map +2 -2
  14. package/client/lib/api-client.js +7 -0
  15. package/client/lib/api-client.js.map +1 -1
  16. package/client/lib/api-client.ts +8 -0
  17. package/client/lib/mailxapi.js +9 -0
  18. package/npmchanges.md +32 -0
  19. package/package.json +3 -3
  20. package/packages/mailx-service/index.d.ts +9 -0
  21. package/packages/mailx-service/index.d.ts.map +1 -1
  22. package/packages/mailx-service/index.js +26 -0
  23. package/packages/mailx-service/index.js.map +1 -1
  24. package/packages/mailx-service/index.ts +25 -0
  25. package/packages/mailx-service/jsonrpc.js +2 -0
  26. package/packages/mailx-service/jsonrpc.js.map +1 -1
  27. package/packages/mailx-service/jsonrpc.ts +2 -0
  28. package/packages/mailx-store-web/package.json +1 -1
  29. package/packages/mailx-store-web/web-service.d.ts +4 -0
  30. package/packages/mailx-store-web/web-service.d.ts.map +1 -1
  31. package/packages/mailx-store-web/web-service.js +3 -0
  32. package/packages/mailx-store-web/web-service.js.map +1 -1
  33. package/packages/mailx-store-web/web-service.ts +3 -0
  34. package/packages/mailx-types/mailx-api.d.ts +4 -0
  35. package/packages/mailx-types/mailx-api.d.ts.map +1 -1
  36. package/packages/mailx-types/mailx-api.ts +1 -0
  37. package/packages/mailx-types/package.json +1 -1
  38. /package/packages/mailx-imap/{node_modules.npmglobalize-stash-81260 → node_modules.npmglobalize-stash-76204}/.package-lock.json +0 -0
@@ -71,6 +71,7 @@ __export(api_client_exports, {
71
71
  moveMessages: () => moveMessages,
72
72
  onEvent: () => onEvent,
73
73
  onWsEvent: () => onWsEvent,
74
+ openAttachment: () => openAttachment,
74
75
  openInTextEditor: () => openInTextEditor,
75
76
  openInWord: () => openInWord,
76
77
  openLocalPath: () => openLocalPath,
@@ -503,6 +504,10 @@ function setupAccount(name, email, password) {
503
504
  async function getAttachment(accountId, uid, attachmentId, folderId) {
504
505
  return ipc().getAttachment(accountId, uid, attachmentId, folderId);
505
506
  }
507
+ async function openAttachment(accountId, uid, attachmentId, folderId) {
508
+ const fn = ipc().openAttachment;
509
+ return fn ? fn(accountId, uid, attachmentId, folderId) : void 0;
510
+ }
506
511
  async function getDeviceAccounts() {
507
512
  return ipc().getDeviceAccounts?.() ?? [];
508
513
  }
@@ -1661,27 +1666,33 @@ async function showMessage(accountId, uid, folderId, specialUse, isRetry = false
1661
1666
  chip.addEventListener("click", async (e) => {
1662
1667
  e.preventDefault();
1663
1668
  try {
1664
- const data = await getAttachment(accountId, uid, i, msg.folderId);
1665
1669
  const bridge = window._nativeBridge;
1666
1670
  if (bridge?.openAttachment) {
1667
- await bridge.openAttachment(att.filename, data.contentType, data.content);
1668
- } else {
1669
- const bytes = Uint8Array.from(atob(data.content), (c) => c.charCodeAt(0));
1670
- const blob = new Blob([bytes], { type: data.contentType });
1671
- const url = URL.createObjectURL(blob);
1672
- const a = document.createElement("a");
1673
- a.href = url;
1674
- a.download = att.filename || "attachment";
1675
- a.style.display = "none";
1676
- document.body.appendChild(a);
1677
- a.click();
1678
- setTimeout(() => {
1679
- a.remove();
1680
- URL.revokeObjectURL(url);
1681
- }, 5e3);
1671
+ const data2 = await getAttachment(accountId, uid, i, msg.folderId);
1672
+ await bridge.openAttachment(att.filename, data2.contentType, data2.content);
1673
+ return;
1682
1674
  }
1675
+ const res = await openAttachment(accountId, uid, i, msg.folderId);
1676
+ if (res)
1677
+ return;
1678
+ const data = await getAttachment(accountId, uid, i, msg.folderId);
1679
+ const bytes = Uint8Array.from(atob(data.content), (c) => c.charCodeAt(0));
1680
+ const blob = new Blob([bytes], { type: data.contentType });
1681
+ const url = URL.createObjectURL(blob);
1682
+ const a = document.createElement("a");
1683
+ a.href = url;
1684
+ a.download = att.filename || "attachment";
1685
+ a.style.display = "none";
1686
+ document.body.appendChild(a);
1687
+ a.click();
1688
+ setTimeout(() => {
1689
+ a.remove();
1690
+ URL.revokeObjectURL(url);
1691
+ }, 5e3);
1683
1692
  } catch (err) {
1684
- console.error(`Attachment download failed: ${err.message}`);
1693
+ const m = `Couldn't open "${att.filename}": ${err?.message || err}`;
1694
+ console.error(m);
1695
+ window.dispatchEvent(new CustomEvent("mailx-alert", { detail: { message: m, key: "attachment-open" } }));
1685
1696
  }
1686
1697
  });
1687
1698
  chip.draggable = true;
@@ -6667,6 +6678,10 @@ function showAlert(message, key, opts) {
6667
6678
  }
6668
6679
  }
6669
6680
  }
6681
+ window.addEventListener("mailx-alert", (e) => {
6682
+ const d = e.detail || {};
6683
+ if (d.message) showAlert(String(d.message), d.key);
6684
+ });
6670
6685
  function hideAlert() {
6671
6686
  if (alertBanner) {
6672
6687
  const key = alertBanner.dataset.key;