HSLG Media

CapacitorDeviceServices.ts

CapacitorDeviceServices.ts

Source file: apps/mobile/native-adapters/CapacitorDeviceServices.ts

Module: app-mobile

Size: 132 lines

SHA-256: 6cbd93784da7ce09d27e8be531a1bae6d3e0b8fd21bea773df0df442ec886642

Responsibility

Runs the real customer UI with native or fail-closed device and backend services; no simulated success.

Declared entry points

  • apiBase — source line 11.
  • healthUrl — source line 12.
  • timeoutMs — source line 13.
  • requireNative — source line 17.
  • requires — source line 18.
  • createCapacitorDeviceServices — source line 20.
  • configured — source line 21.
  • disposed — source line 22.
  • keyboardVisible — source line 23.
  • addOwned — source line 25.
  • handle — source line 26.
  • self — source line 29.
  • status — source line 32.
  • active — source line 37.
  • controller — source line 46.
  • timer — source line 47.
  • result — source line 49.
  • payload — source line 51.
  • active — source line 57.
  • result — source line 69.
  • native — source line 82.
  • service — source line 87.

Imports and dependencies

  • Line 2: import { Capacitor } from '@capacitor/core';
  • Line 3: import { Network } from '@capacitor/network';
  • Line 4: import { App } from '@capacitor/app';
  • Line 5: import { Haptics, ImpactStyle, NotificationType } from '@capacitor/haptics';
  • Line 6: import { Keyboard } from '@capacitor/keyboard';
  • Line 7: import { ScreenOrientation } from '@capacitor/screen-orientation';
  • Line 8: import { SplashScreen } from '@capacitor/splash-screen';
  • Line 9: import { CapacitorBarcodeScanner, CapacitorBarcodeScannerTypeHint, CapacitorBarcodeScannerCameraDirection } from '@capacitor/barcode-scanner';

Behaviour and audit locations

  • Line 1: /** Real Capacitor device services. Never imported by the WordPress presenter. */
  • Line 2: import { Capacitor } from '@capacitor/core';
  • Line 3: import { Network } from '@capacitor/network';
  • Line 4: import { App } from '@capacitor/app';
  • Line 5: import { Haptics, ImpactStyle, NotificationType } from '@capacitor/haptics';
  • Line 6: import { Keyboard } from '@capacitor/keyboard';
  • Line 7: import { ScreenOrientation } from '@capacitor/screen-orientation';
  • Line 8: import { SplashScreen } from '@capacitor/splash-screen';

Plugin callbacks and their limits

The adapter uses Capacitor Network for device state, App for incoming and cold-start links, Barcode Scanner for QR camera input, Haptics for tactile outcomes, Keyboard for CSS size/visibility updates, Screen Orientation for a best-effort portrait lock and Splash Screen after initialization. It distinguishes network state from an HTTPS API health check with a timeout. The QR result returns scanned text or cancellation; the destination router must validate it. Registered callbacks have removal functions. Source implementation is not proof of installation or permission handling on a real Android phone.

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.