@bobfrankston/rmfmail 1.0.489 → 1.0.491

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/client/app.js CHANGED
@@ -2989,6 +2989,50 @@ document.getElementById("btn-shortcuts")?.addEventListener("click", () => {
2989
2989
  settingsDropdown.hidden = true;
2990
2990
  openShortcutsDialog();
2991
2991
  });
2992
+ // ── Check for updates (Settings menu item) ──
2993
+ // On phone narrow tier the toolbar Update menu is collapsed away — give the
2994
+ // user an explicit, non-reloading path to trigger the update poll. The
2995
+ // AppUpdater banner appears at the bottom of the WebView if a newer version
2996
+ // is available; otherwise the status bar reports "up to date".
2997
+ document.getElementById("btn-settings-checkupdate")?.addEventListener("click", () => {
2998
+ const settingsDropdown = document.getElementById("settings-dropdown");
2999
+ if (settingsDropdown)
3000
+ settingsDropdown.hidden = true;
3001
+ const statusSync = document.getElementById("status-sync");
3002
+ if (statusSync)
3003
+ statusSync.textContent = "Checking for updates…";
3004
+ const isAndroid = window.mailxapi?.platform === "android";
3005
+ if (isAndroid) {
3006
+ // Bridge fires the C# AppUpdater.CheckForUpdate, which injects the
3007
+ // bottom banner if a newer version is on rmf39.aaz.lt/mailx.
3008
+ const f = document.createElement("iframe");
3009
+ f.style.display = "none";
3010
+ f.src = "mailxapi://checkUpdate";
3011
+ document.body.appendChild(f);
3012
+ setTimeout(() => f.remove(), 100);
3013
+ // Status hint resets after a few seconds in case nothing happens
3014
+ // (already up to date, or fetch failed silently).
3015
+ setTimeout(() => {
3016
+ if (statusSync && statusSync.textContent === "Checking for updates…") {
3017
+ statusSync.textContent = "Up to date or check pending — see banner if available";
3018
+ setTimeout(() => { if (statusSync.textContent?.startsWith("Up to date"))
3019
+ statusSync.textContent = ""; }, 6000);
3020
+ }
3021
+ }, 4000);
3022
+ }
3023
+ else {
3024
+ // Desktop: same path as the toolbar btn-update.
3025
+ const ipc = window.mailxapi || window.opener?.mailxapi;
3026
+ if (ipc?.performUpdate) {
3027
+ if (statusSync)
3028
+ statusSync.textContent = "Updating… mailx will restart when done";
3029
+ ipc.performUpdate();
3030
+ }
3031
+ else if (statusSync) {
3032
+ statusSync.textContent = "Update not available in this mode";
3033
+ }
3034
+ }
3035
+ });
2992
3036
  // ── About dialog ──
2993
3037
  document.getElementById("btn-about")?.addEventListener("click", () => {
2994
3038
  const settingsDropdown = document.getElementById("settings-dropdown");