@bobfrankston/rmfmail 1.2.205 → 1.2.208

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.
package/bin/mailx.ts CHANGED
@@ -2709,6 +2709,10 @@ RFC 5322 with CRLF line endings. Bodies are quoted-printable encoded (readable i
2709
2709
  // and emits this when Word writes; compose.ts listens and reloads Quill.
2710
2710
  imapManager.on("wordEditUpdated", (payload: { editId: string; html: string }) => {
2711
2711
  handle.send({ _event: "wordEditUpdated", type: "wordEditUpdated", ...payload });
2712
+ // Bring compose back to the front after a Word save — the service's
2713
+ // old mailx-host focusMainWindow call was a silent no-op (the helper
2714
+ // never existed); this native msger command is the real mechanism.
2715
+ handle.send({ _msgerWindow: "focus" });
2712
2716
  });
2713
2717
  // Cloud-write/read failures from mailx-settings → push to UI as a banner so
2714
2718
  // silent fall-back-to-local can no longer swallow Drive errors.
@@ -2794,6 +2798,11 @@ RFC 5322 with CRLF line endings. Bodies are quoted-printable encoded (readable i
2794
2798
  handle.send({ _event: "openMailto", type: "openMailto",
2795
2799
  to: data.to, cc: data.cc, bcc: data.bcc,
2796
2800
  subject: data.subject, body: data.body, inReplyTo: data.inReplyTo });
2801
+ // The user just clicked a mailto link in ANOTHER app —
2802
+ // bring our window to the front so the compose is visible.
2803
+ // _msgerWindow is a msger-native control message (consumed
2804
+ // by the Rust side, never forwarded to the page).
2805
+ handle.send({ _msgerWindow: "focus" });
2797
2806
  }, 50);
2798
2807
  });
2799
2808
  } catch (e: any) {
@@ -2826,6 +2835,12 @@ RFC 5322 with CRLF line endings. Bodies are quoted-printable encoded (readable i
2826
2835
  handle.send({ _event: "openShare", type: "openShare",
2827
2836
  title: data.title, text: data.text, url: data.url,
2828
2837
  attachments, skipped });
2838
+ // The share sheet was on top of another app — bring our
2839
+ // window to the front so the compose the share opened is
2840
+ // actually visible (Bob 2026-07-30: "should've brought
2841
+ // the new window to the front"). Native msger command —
2842
+ // see the mailto block above.
2843
+ handle.send({ _msgerWindow: "focus" });
2829
2844
  }, 50);
2830
2845
  });
2831
2846
  } catch (e: any) {
@@ -2668,6 +2668,7 @@ __export(web_settings_exports, {
2668
2668
  loadDeviceState: () => loadDeviceState,
2669
2669
  loadPreferences: () => loadPreferences,
2670
2670
  loadSettings: () => loadSettings,
2671
+ primeSharedConfigs: () => primeSharedConfigs,
2671
2672
  saveAccounts: () => saveAccounts,
2672
2673
  saveAllowlist: () => saveAllowlist,
2673
2674
  saveAutocomplete: () => saveAutocomplete,
@@ -2940,21 +2941,36 @@ async function stashPrevIdb(filename, aboutToBecome) {
2940
2941
  } catch {
2941
2942
  }
2942
2943
  }
2943
- function refreshSharedFile(filename, cached) {
2944
+ async function pullSharedFile(filename, force) {
2944
2945
  const now = Date.now();
2945
- if (now - (__lastSharedRefresh.get(filename) || 0) < SHARED_REFRESH_MS)
2946
- return;
2946
+ if (!force && now - (__lastSharedRefresh.get(filename) || 0) < SHARED_REFRESH_MS)
2947
+ return false;
2947
2948
  __lastSharedRefresh.set(filename, now);
2948
- void (async () => {
2949
+ try {
2950
+ const fresh = await gDriveRead(filename);
2951
+ if (!fresh)
2952
+ return false;
2953
+ const cached = await idbRead(filename);
2954
+ if (fresh === cached)
2955
+ return false;
2956
+ await idbWrite(filename, fresh);
2957
+ console.log(`[settings] ${filename} refreshed from GDrive (shared copy changed)`);
2958
+ return true;
2959
+ } catch {
2960
+ }
2961
+ return false;
2962
+ }
2963
+ function refreshSharedFile(filename, _cached) {
2964
+ void pullSharedFile(filename, false);
2965
+ }
2966
+ async function primeSharedConfigs(force = true) {
2967
+ for (const f of SHARED_FILES) {
2949
2968
  try {
2950
- const fresh = await gDriveRead(filename);
2951
- if (fresh && fresh !== cached) {
2952
- await idbWrite(filename, fresh);
2953
- console.log(`[settings] ${filename} refreshed from GDrive (shared copy changed)`);
2954
- }
2955
- } catch {
2969
+ await pullSharedFile(f, force);
2970
+ } catch (e) {
2971
+ console.warn(`[settings] prime ${f}: ${e?.message || e}`);
2956
2972
  }
2957
- })();
2973
+ }
2958
2974
  }
2959
2975
  async function loadAccounts() {
2960
2976
  const cached = await idbRead("accounts.jsonc");
@@ -3180,7 +3196,7 @@ async function loadDeviceState() {
3180
3196
  }
3181
3197
  return {};
3182
3198
  }
3183
- var IDB_NAME2, IDB_VERSION, STORE_NAME2, gDriveFolderId, gDriveFolderName, gDriveFolderPath, gDriveFolderOwner, tokenProvider, PROVIDERS, DEFAULT_PREFERENCES, DEFAULT_ALLOWLIST, PREV_KEEP, SHARED_REFRESH_MS, __lastSharedRefresh, ALLOWLIST_KEYS, DEVICE_ID_KEY;
3199
+ var IDB_NAME2, IDB_VERSION, STORE_NAME2, gDriveFolderId, gDriveFolderName, gDriveFolderPath, gDriveFolderOwner, tokenProvider, PROVIDERS, DEFAULT_PREFERENCES, DEFAULT_ALLOWLIST, PREV_KEEP, SHARED_REFRESH_MS, SHARED_FILES, __lastSharedRefresh, ALLOWLIST_KEYS, DEVICE_ID_KEY;
3184
3200
  var init_web_settings = __esm({
3185
3201
  "packages/mailx-store-web/web-settings.js"() {
3186
3202
  "use strict";
@@ -3257,6 +3273,7 @@ var init_web_settings = __esm({
3257
3273
  };
3258
3274
  PREV_KEEP = 5;
3259
3275
  SHARED_REFRESH_MS = 5 * 6e4;
3276
+ SHARED_FILES = ["allowlist.jsonc", "preferences.jsonc"];
3260
3277
  __lastSharedRefresh = /* @__PURE__ */ new Map();
3261
3278
  ALLOWLIST_KEYS = ["senders", "domains", "recipients", "flaggedSenders", "flaggedDomains"];
3262
3279
  DEVICE_ID_KEY = "mailx-device-id";
@@ -11401,6 +11418,7 @@ async function initAndroidOnce() {
11401
11418
  } catch (e) {
11402
11419
  console.warn(`[android] List debug: ${e.message}`);
11403
11420
  }
11421
+ primeSharedConfigs().catch((e) => console.warn(`[android] prime shared configs: ${e?.message || e}`));
11404
11422
  narrate("Loading accounts from Google Drive\u2026");
11405
11423
  const gdriveAccounts = await loadAccountsFromCloud();
11406
11424
  console.log(`[android] GDrive returned ${gdriveAccounts.length} accounts: ${gdriveAccounts.map((a) => a.id).join(",")}`);
@@ -11475,6 +11493,7 @@ async function initAndroidOnce() {
11475
11493
  }
11476
11494
  syncManager.syncAll().catch((e) => console.error(`[android] Resume sync error: ${e.message}`));
11477
11495
  service.maybeRefreshContactsConfig().catch((e) => console.error(`[android] resume contacts.jsonc check: ${e?.message || e}`));
11496
+ primeSharedConfigs(false).catch((e) => console.error(`[android] resume shared config check: ${e?.message || e}`));
11478
11497
  }
11479
11498
  });
11480
11499
  console.log("[android] Initialization complete");