@livx.cc/appwrap 0.47.2 → 0.47.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@livx.cc/appwrap",
3
- "version": "0.47.2",
3
+ "version": "0.47.3",
4
4
  "description": "Wrap any PWA into a native app with native capabilities (appwrap runtime + @livx.cc/native-kit).",
5
5
  "license": "MIT",
6
6
  "author": "Elya Livshitz",
@@ -351,9 +351,20 @@ function createAssetServingClient(): android.webkit.WebViewClient {
351
351
  ? android.content.Intent.parseUri(url, android.content.Intent.URI_INTENT_SCHEME)
352
352
  : new android.content.Intent(android.content.Intent.ACTION_VIEW, android.net.Uri.parse(url));
353
353
  intent.addFlags(android.content.Intent.FLAG_ACTIVITY_NEW_TASK);
354
- view.getContext().startActivity(intent);
354
+ try {
355
+ view.getContext().startActivity(intent);
356
+ } catch (notInstalled) {
357
+ // Target app missing. intent: URLs carry `browser_fallback_url` for exactly this (Chrome
358
+ // semantics — e.g. "add to Google Calendar" falls back to the web calendar). Honor it via the
359
+ // OS browser rather than silently dropping the action.
360
+ const fallback = scheme === 'intent' && intent.getStringExtra('browser_fallback_url');
361
+ if (!fallback) throw notInstalled;
362
+ const fb = new android.content.Intent(android.content.Intent.ACTION_VIEW, android.net.Uri.parse(String(fallback)));
363
+ fb.addFlags(android.content.Intent.FLAG_ACTIVITY_NEW_TASK);
364
+ view.getContext().startActivity(fb);
365
+ }
355
366
  } catch (e) {
356
- // No installed app handles the scheme — swallow (better a no-op than an error page over the app).
367
+ // No installed app handles the scheme / no fallback — swallow (better a no-op than an error page).
357
368
  console.warn('[appwrap] no OS handler for external URL: ' + url + ' (' + e + ')');
358
369
  }
359
370
  return true;