import type { TurboModule } from 'react-native'; import { TurboModuleRegistry } from 'react-native'; /** * TurboModule spec (codegen) for GeolocationPro. * * Design rules: * - Keep types permissive (`Record`) to avoid breaking rapid iteration. * - Preserve the existing public JS API. This spec only defines the native surface. * - Events remain delivered via the existing emitter contract (`addListener/removeListeners`). * * NOTE: This file is consumed by RN codegen when New Architecture is enabled. */ export interface Spec extends TurboModule { // EventEmitter contract (required by RN for native event modules) addListener(eventName: string): void; removeListeners(count: number): void; // ─── Geolocation core ──────────────────────────────────────────────────── getCurrentPosition(options: Object): Promise; watchPosition(options: Object): number; clearWatch(watchId: number): void; stopLocationObserving(): void; // Queue / offline delivery getPendingForJs(limit: number): Promise>; markDelivered(ids: string[]): Promise; purgeDelivered(): Promise; getQueueSize(): Promise; // Authorization requestAuthorization(level: string): Promise; getAuthorizationStatus(): Promise<{ status: string; always: boolean }>; // Config / lifecycle (background engine) ready(config: Object): Promise; setConfiguration(config: Object): Promise; setConfig(config: Object): Promise; getState(): Promise; start(): Promise; stop(): Promise; reset(): Promise; changePace(isMoving: boolean): Promise; setActivityPaused(paused: boolean): Promise; // Schedule / geofences / sync startSchedule(): Promise; stopSchedule(): Promise; startGeofences(): Promise; sync(): Promise>; httpSync(): Promise>; configureHttp(config: Object): Promise; // Persistence CRUD getLocations(): Promise>; destroyLocation(uuid: string): Promise; destroyLocations(): Promise; getCount(): Promise; insertLocation(params: Object): Promise; // Sessions createSession(name: string, activityType: string, extras: string | null): Promise; endSession(sessionId: string, data: Object): Promise; discardSession(sessionId: string): Promise; getPendingSessions(): Promise>; // Motion / auto-pause startMotionTracking(includePedometer: boolean): Promise; stopMotionTracking(): Promise; configureAutoPause(config: Object): Promise; // Diagnostics / logger configureLogger(config: Object): Promise; getDiagnostics(): Promise>; devLog(level: string, tag: string, message: string, data: Object | null): void; log(level: string, message: string, data: Object | null): Promise; getLog(query: Object): Promise; destroyLog(): Promise; uploadLog(url: string, query: Object): Promise; // iOS Live Activities (no-ops on unsupported platforms) setLiveActivityEnabled(enabled: boolean): void; getLiveActivityEnabled(): Promise; startLiveActivity(name: string, activityType: string): Promise; updateLiveActivity( distance: number, duration: number, pace: string, speed: number, calories: number, gpsStatus: string, isPaused: boolean, ): void; endLiveActivity(distance: number, duration: number, calories: number): Promise; // Platform-specific requestTemporaryFullAccuracy(purpose: string): Promise; isIgnoringBatteryOptimizations(): Promise; requestBatteryOptimizationPermission(): Promise; openOemBatterySettings(): Promise; // Time-based tracker startTimeBasedTracking(options: Object): number; stopTimeBasedTracking(watchId: number): Promise; pauseTimeBasedTracking(watchId: number): Promise; resumeTimeBasedTracking(watchId: number): Promise; setTimeBasedInterval(watchId: number, intervalMs: number): Promise; // Odometer getOdometer(): Promise; resetOdometer(): Promise; setOdometer(value: number): Promise; // Pedometer (passive — no notification) pedometerIsSupported(): Promise; pedometerStart(sessionId: string | null): Promise; pedometerStop(): Promise; pedometerGetSnapshot(): Promise; pedometerQuery(fromMs: number, toMs: number): Promise; pedometerOnAppForeground(): void; } export default TurboModuleRegistry.get('GeolocationPro');