NativeServices.js
Source file: apps/mobile/src/NativeServices.js
Module: app-mobile
Size: 34 lines
SHA-256: 90be763363beb6a16bb30d78284b5c66fd4d76556be058044605566a658cffa4
Responsibility
Runs the real customer UI with native or fail-closed device and backend services; no simulated success.
Declared entry points
No explicitly named class/function declarations detected; check script entry point and invocation.
Imports and dependencies
No direct import declarations detected in this file.
Behaviour and audit locations
- Line 2:
* corresponding official Capacitor SDK and HSLG API integration are available. - Line 6:
async getConnectionStatus(){return window.HSLGCapacitorDevice?.getConnectionStatus?.() || {connected:navigator.onLine};}, - Line 7:
async checkService(){if(!window.HSLGCapacitorDevice?.checkService)throw new Error('Production service health URL is not configured.');return window.HSLGCapacitorDevice.ch - Line 8:
onNetworkChange(listener){return window.HSLGCapacitorDevice?.onNetworkChange?.(listener) || (()=>{});}, - Line 9:
onIncomingUrl(listener){return window.HSLGCapacitorDevice?.onIncomingUrl?.(listener) || (()=>{});}, - Line 10:
async scanQr(){if(!window.HSLGCapacitorDevice?.scanQr)throw new Error('Native QR scanner SDK is not installed.');return window.HSLGCapacitorDevice.scanQr();}, - Line 12:
async haptic(kind){if(!window.HSLGCapacitorDevice)throw new Error("Native Haptics not initialised.");return window.HSLGCapacitorDevice.haptic(kind);}, - Line 13:
async deviceStatus(){if(!window.HSLGCapacitorDevice)throw new Error("Capacitor has not initialised.");return window.HSLGCapacitorDevice.diagnostics();},
Service outputs and failure policy
This runtime object supplies the shared UI with genuine services where available and explicit errors elsewhere. The live menu/event/offer providers currently return empty data; social login, reservations, foreground NFC and order submission reject unsupported actions. Account actions delegate to the native coordinator only if configured. It must never import DemoServices.js or return a fabricated payment receipt. This is the correct place to expose a new native-backed service after its dedicated adapter and failure states are tested.
Relationship to the system
This page is the file-level source reference, not the architecture rationale. Read the module explanation, the corresponding architecture decision and user guide before changing behaviour. Names and line locations above are extracted from this exact source version; they are reference points, not proof that an external service or a phone feature works.
Change verification
Review the entry points and errors in this file, then run the module’s associated tests, source dependency gate, history gate and documentation coverage check. If the file changes an API response, user interaction, data model, deployment or third-party dependency, revise those human explanations and disaster recovery/licensing when relevant. Do not infer actual native or external API operation from source presence.