SkateSpots/src/lib/platform.ts
SkateSpots 87f58cd84e feat(android): pass-the-app card (QR + share sheet + NFC tag)
About page renders ShareAppCard on Android only: a QR of the Zapstore listing,
a share-sheet button for the install link, and NfcWriteButton to write it to a
tag. Single-sourced APP_INSTALL_URL in lib/platform.ts (also used by the About
download button). No peer-to-peer APK transfer (needs native Wi-Fi Direct/BLE +
PackageInstaller + device QA); Zapstore handles install/update.
2026-10-26 11:41:51 +07:00

38 lines
1.3 KiB
TypeScript

import { Capacitor } from '@capacitor/core';
/**
* Is the app running inside a native (Capacitor) shell — iOS / Android / desktop
* WebView — rather than a plain web browser?
*
* This matters for networking: a native WebView is NOT subject to browser CORS
* rules, so it can talk to any Cashu mint directly (including mint.minibits.cash,
* which sends no CORS headers). In a plain browser we must use a CORS-enabled
* mint. `Capacitor.isNativePlatform()` is web-safe and simply returns `false`
* when there's no native runtime.
*/
export function isNativePlatform(): boolean {
try {
return Capacitor.isNativePlatform();
} catch {
return false;
}
}
/** 'ios' | 'android' | 'web' */
export function getPlatform(): string {
try {
return Capacitor.getPlatform();
} catch {
return 'web';
}
}
/** Canonical Zapstore listing for this app (install + updates). Android only. */
export const APP_INSTALL_URL = 'https://zapstore.dev/apps/org.skatespots.app';
/**
* SkateSpots platform Lightning address. Receives Sasquatch Pro passes AND
* marketplace listing fees — the same address, deliberately. Single source of
* truth: never re-type it elsewhere (a typo would send money nowhere).
*/
export const PLATFORM_LIGHTNING_ADDRESS = 'skatespots@minibits.cash';