@bobfrankston/rmfmail 1.2.36 → 1.2.38
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/lib/mailxapi.js +16 -4
- package/package.json +1 -1
package/client/lib/mailxapi.js
CHANGED
|
@@ -9,6 +9,18 @@
|
|
|
9
9
|
(function() {
|
|
10
10
|
"use strict";
|
|
11
11
|
|
|
12
|
+
// Reliable Android-host detection. navigator.userAgent is NOT dependable —
|
|
13
|
+
// on the Pixel's MAUI WebView it does NOT contain "Android", so the old
|
|
14
|
+
// `/Android/i.test(navigator.userAgent)` returned false and every
|
|
15
|
+
// openExternal / openContact / openCalendarEvent fell through to the desktop
|
|
16
|
+
// path and did nothing (Bob 2026-06-18, confirmed via [android-link] trace:
|
|
17
|
+
// "android=false"). The MAUI host injects `window._nativeBridge`
|
|
18
|
+
// (MainPage.xaml.cs) — that's the authoritative signal. UA kept as a backup.
|
|
19
|
+
function isAndroidHost() {
|
|
20
|
+
try { return !!(window._nativeBridge) || /Android/i.test(navigator.userAgent); }
|
|
21
|
+
catch (e) { return false; }
|
|
22
|
+
}
|
|
23
|
+
|
|
12
24
|
var _callbacks = {};
|
|
13
25
|
var _callbackId = 0;
|
|
14
26
|
var _eventHandlers = [];
|
|
@@ -321,7 +333,7 @@
|
|
|
321
333
|
// MAUI intercepts this scheme in OnNavigating and fires a
|
|
322
334
|
// native ACTION_VIEW intent on the mailto: URI — system
|
|
323
335
|
// Contacts registers for it on stock Android.
|
|
324
|
-
if (
|
|
336
|
+
if (isAndroidHost()) {
|
|
325
337
|
window.location.href = "mailxapi-intent://contact/" + encodeURIComponent(email);
|
|
326
338
|
return;
|
|
327
339
|
}
|
|
@@ -334,7 +346,7 @@
|
|
|
334
346
|
openCalendarEvent: function(htmlLink) {
|
|
335
347
|
if (!htmlLink) return;
|
|
336
348
|
try {
|
|
337
|
-
if (
|
|
349
|
+
if (isAndroidHost()) {
|
|
338
350
|
// MAUI dispatches this to the native Calendar app via
|
|
339
351
|
// ACTION_VIEW on the Google Calendar event URL.
|
|
340
352
|
window.location.href = "mailxapi-intent://calendar/" + encodeURIComponent(htmlLink);
|
|
@@ -354,8 +366,8 @@
|
|
|
354
366
|
openExternal: function(url) {
|
|
355
367
|
if (!url) return;
|
|
356
368
|
try {
|
|
357
|
-
console.log("[android-link] openExternal
|
|
358
|
-
if (
|
|
369
|
+
console.log("[android-link] openExternal url=" + url + " androidHost=" + isAndroidHost() + " bridge=" + !!(window._nativeBridge) + " ua=" + /Android/i.test(navigator.userAgent));
|
|
370
|
+
if (isAndroidHost()) {
|
|
359
371
|
console.log("[android-link] navigating top frame to mailxapi-intent://open/");
|
|
360
372
|
// Use the SAME mechanism the contact/calendar intents use: a
|
|
361
373
|
// top-frame location.href to mailxapi-intent://, which the MAUI
|