foreground-location 0.0.1
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/ForegroundLocation.podspec +17 -0
- package/Package.swift +28 -0
- package/README.md +931 -0
- package/android/build.gradle +74 -0
- package/android/src/main/AndroidManifest.xml +30 -0
- package/android/src/main/java/in/xconcepts/foreground/location/APIService.java +449 -0
- package/android/src/main/java/in/xconcepts/foreground/location/ForeGroundLocation.java +58 -0
- package/android/src/main/java/in/xconcepts/foreground/location/ForeGroundLocationPlugin.java +650 -0
- package/android/src/main/java/in/xconcepts/foreground/location/LocationForegroundService.java +526 -0
- package/android/src/main/res/.gitkeep +0 -0
- package/dist/esm/definitions.d.ts +240 -0
- package/dist/esm/definitions.js +26 -0
- package/dist/esm/definitions.js.map +1 -0
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.js +7 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/web.d.ts +16 -0
- package/dist/esm/web.js +97 -0
- package/dist/esm/web.js.map +1 -0
- package/dist/plugin.cjs.js +138 -0
- package/dist/plugin.cjs.js.map +1 -0
- package/dist/plugin.js +141 -0
- package/dist/plugin.js.map +1 -0
- package/docs/CHANGES-SUMMARY.md +69 -0
- package/docs/setup-and-examples.md +2851 -0
- package/ios/Sources/ForeGroundLocationPlugin/ForeGroundLocation.swift +75 -0
- package/ios/Sources/ForeGroundLocationPlugin/ForeGroundLocationPlugin.swift +125 -0
- package/ios/Tests/ForeGroundLocationPluginTests/ForeGroundLocationPluginTests.swift +36 -0
- package/package.json +82 -0
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import type { PermissionState, PluginListenerHandle } from '@capacitor/core';
|
|
2
|
+
export type { PermissionState, PluginListenerHandle };
|
|
3
|
+
export interface ForeGroundLocationPlugin {
|
|
4
|
+
/**
|
|
5
|
+
* Check current permission status
|
|
6
|
+
* @since 1.0.0
|
|
7
|
+
*/
|
|
8
|
+
checkPermissions(): Promise<LocationPermissionStatus>;
|
|
9
|
+
/**
|
|
10
|
+
* Request location permissions
|
|
11
|
+
* @since 1.0.0
|
|
12
|
+
*/
|
|
13
|
+
requestPermissions(): Promise<LocationPermissionStatus>;
|
|
14
|
+
/**
|
|
15
|
+
* Start foreground location service
|
|
16
|
+
* @since 1.0.0
|
|
17
|
+
*/
|
|
18
|
+
startForegroundLocationService(options: LocationServiceOptions): Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* Stop foreground location service
|
|
21
|
+
* @since 1.0.0
|
|
22
|
+
*/
|
|
23
|
+
stopForegroundLocationService(): Promise<void>;
|
|
24
|
+
/**
|
|
25
|
+
* Check if location service is running
|
|
26
|
+
* @since 1.0.0
|
|
27
|
+
*/
|
|
28
|
+
isServiceRunning(): Promise<{
|
|
29
|
+
isRunning: boolean;
|
|
30
|
+
}>;
|
|
31
|
+
/**
|
|
32
|
+
* Get current location once
|
|
33
|
+
* @since 1.0.0
|
|
34
|
+
*/
|
|
35
|
+
getCurrentLocation(): Promise<LocationResult>;
|
|
36
|
+
/**
|
|
37
|
+
* Update location service settings
|
|
38
|
+
* @since 1.0.0
|
|
39
|
+
*/
|
|
40
|
+
updateLocationSettings(options: LocationServiceOptions): Promise<void>;
|
|
41
|
+
/**
|
|
42
|
+
* Get API service status
|
|
43
|
+
* @since 1.0.0
|
|
44
|
+
*/
|
|
45
|
+
getApiServiceStatus(): Promise<ApiServiceStatus>;
|
|
46
|
+
/**
|
|
47
|
+
* Clear API service buffers
|
|
48
|
+
* @since 1.0.0
|
|
49
|
+
*/
|
|
50
|
+
clearApiBuffers(): Promise<void>;
|
|
51
|
+
/**
|
|
52
|
+
* Reset API service circuit breaker
|
|
53
|
+
* @since 1.0.0
|
|
54
|
+
*/
|
|
55
|
+
resetApiCircuitBreaker(): Promise<void>;
|
|
56
|
+
/**
|
|
57
|
+
* Listen for location updates
|
|
58
|
+
* @since 1.0.0
|
|
59
|
+
*/
|
|
60
|
+
addListener(eventName: 'locationUpdate', listenerFunc: (location: LocationResult) => void): Promise<PluginListenerHandle>;
|
|
61
|
+
/**
|
|
62
|
+
* Listen for service status changes
|
|
63
|
+
* @since 1.0.0
|
|
64
|
+
*/
|
|
65
|
+
addListener(eventName: 'serviceStatusChanged', listenerFunc: (status: ServiceStatus) => void): Promise<PluginListenerHandle>;
|
|
66
|
+
/**
|
|
67
|
+
* Remove all listeners
|
|
68
|
+
* @since 1.0.0
|
|
69
|
+
*/
|
|
70
|
+
removeAllListeners(): Promise<void>;
|
|
71
|
+
}
|
|
72
|
+
export interface LocationServiceOptions {
|
|
73
|
+
/**
|
|
74
|
+
* Update interval in milliseconds
|
|
75
|
+
* @default 60000
|
|
76
|
+
* @minimum 1000
|
|
77
|
+
*/
|
|
78
|
+
interval?: number;
|
|
79
|
+
/**
|
|
80
|
+
* Fastest update interval in milliseconds
|
|
81
|
+
* @default 30000
|
|
82
|
+
* @minimum 1000
|
|
83
|
+
*/
|
|
84
|
+
fastestInterval?: number;
|
|
85
|
+
/**
|
|
86
|
+
* Location accuracy priority
|
|
87
|
+
* @default 'HIGH_ACCURACY'
|
|
88
|
+
*/
|
|
89
|
+
priority?: 'HIGH_ACCURACY' | 'BALANCED_POWER' | 'LOW_POWER' | 'NO_POWER';
|
|
90
|
+
/**
|
|
91
|
+
* Notification configuration for foreground service (REQUIRED)
|
|
92
|
+
*/
|
|
93
|
+
notification: {
|
|
94
|
+
/**
|
|
95
|
+
* Notification title (REQUIRED)
|
|
96
|
+
*/
|
|
97
|
+
title: string;
|
|
98
|
+
/**
|
|
99
|
+
* Notification text/content (REQUIRED)
|
|
100
|
+
*/
|
|
101
|
+
text: string;
|
|
102
|
+
/**
|
|
103
|
+
* Optional notification icon resource name
|
|
104
|
+
*/
|
|
105
|
+
icon?: string;
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* Enable high accuracy mode
|
|
109
|
+
* @default true
|
|
110
|
+
*/
|
|
111
|
+
enableHighAccuracy?: boolean;
|
|
112
|
+
/**
|
|
113
|
+
* Minimum distance in meters to trigger update
|
|
114
|
+
*/
|
|
115
|
+
distanceFilter?: number;
|
|
116
|
+
/**
|
|
117
|
+
* API service configuration (optional)
|
|
118
|
+
* If provided, location data will be sent to the specified API endpoint in batches
|
|
119
|
+
*/
|
|
120
|
+
api?: ApiServiceConfig;
|
|
121
|
+
}
|
|
122
|
+
export interface ApiServiceConfig {
|
|
123
|
+
/**
|
|
124
|
+
* API endpoint URL (REQUIRED if api config is provided)
|
|
125
|
+
*/
|
|
126
|
+
url: string;
|
|
127
|
+
/**
|
|
128
|
+
* HTTP method to use
|
|
129
|
+
* @default 'POST'
|
|
130
|
+
*/
|
|
131
|
+
type?: 'GET' | 'POST' | 'PUT' | 'PATCH';
|
|
132
|
+
/**
|
|
133
|
+
* HTTP headers to include in API requests
|
|
134
|
+
*/
|
|
135
|
+
header?: Record<string, string>;
|
|
136
|
+
/**
|
|
137
|
+
* Additional parameters to include in API request body
|
|
138
|
+
*/
|
|
139
|
+
additionalParams?: Record<string, any>;
|
|
140
|
+
/**
|
|
141
|
+
* Interval in minutes for sending batched location data to API
|
|
142
|
+
* @default 5
|
|
143
|
+
* @minimum 1
|
|
144
|
+
*/
|
|
145
|
+
apiInterval?: number;
|
|
146
|
+
}
|
|
147
|
+
export interface ApiServiceStatus {
|
|
148
|
+
/**
|
|
149
|
+
* Whether API service is enabled and configured
|
|
150
|
+
*/
|
|
151
|
+
isEnabled: boolean;
|
|
152
|
+
/**
|
|
153
|
+
* Number of location points in buffer waiting to be sent
|
|
154
|
+
*/
|
|
155
|
+
bufferSize: number;
|
|
156
|
+
/**
|
|
157
|
+
* Whether API service is healthy (not in circuit breaker state)
|
|
158
|
+
*/
|
|
159
|
+
isHealthy: boolean;
|
|
160
|
+
}
|
|
161
|
+
export interface LocationResult {
|
|
162
|
+
/**
|
|
163
|
+
* Latitude in decimal degrees
|
|
164
|
+
*/
|
|
165
|
+
latitude: number;
|
|
166
|
+
/**
|
|
167
|
+
* Longitude in decimal degrees
|
|
168
|
+
*/
|
|
169
|
+
longitude: number;
|
|
170
|
+
/**
|
|
171
|
+
* Accuracy of the location in meters
|
|
172
|
+
*/
|
|
173
|
+
accuracy: number;
|
|
174
|
+
/**
|
|
175
|
+
* Altitude in meters (if available)
|
|
176
|
+
*/
|
|
177
|
+
altitude?: number;
|
|
178
|
+
/**
|
|
179
|
+
* Bearing in degrees (if available)
|
|
180
|
+
*/
|
|
181
|
+
bearing?: number;
|
|
182
|
+
/**
|
|
183
|
+
* Speed in meters per second (if available)
|
|
184
|
+
*/
|
|
185
|
+
speed?: number;
|
|
186
|
+
/**
|
|
187
|
+
* Timestamp in ISO 8601 format
|
|
188
|
+
*/
|
|
189
|
+
timestamp: string;
|
|
190
|
+
}
|
|
191
|
+
export interface LocationPermissionStatus {
|
|
192
|
+
/**
|
|
193
|
+
* Fine and coarse location permission status
|
|
194
|
+
*/
|
|
195
|
+
location: PermissionState;
|
|
196
|
+
/**
|
|
197
|
+
* Background location permission status (Android 10+)
|
|
198
|
+
*/
|
|
199
|
+
backgroundLocation: PermissionState;
|
|
200
|
+
/**
|
|
201
|
+
* Notification permission status (Android 13+)
|
|
202
|
+
*/
|
|
203
|
+
notifications: PermissionState;
|
|
204
|
+
}
|
|
205
|
+
export interface ServiceStatus {
|
|
206
|
+
/**
|
|
207
|
+
* Whether the service is currently running
|
|
208
|
+
*/
|
|
209
|
+
isRunning: boolean;
|
|
210
|
+
/**
|
|
211
|
+
* Error message if service failed
|
|
212
|
+
*/
|
|
213
|
+
error?: string;
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Plugin error codes for consistent error handling
|
|
217
|
+
*/
|
|
218
|
+
export declare const ERROR_CODES: {
|
|
219
|
+
/**
|
|
220
|
+
* Location permission denied or not granted
|
|
221
|
+
*/
|
|
222
|
+
readonly PERMISSION_DENIED: "PERMISSION_DENIED";
|
|
223
|
+
/**
|
|
224
|
+
* Invalid notification configuration
|
|
225
|
+
*/
|
|
226
|
+
readonly INVALID_NOTIFICATION: "INVALID_NOTIFICATION";
|
|
227
|
+
/**
|
|
228
|
+
* Invalid parameters provided
|
|
229
|
+
*/
|
|
230
|
+
readonly INVALID_PARAMETERS: "INVALID_PARAMETERS";
|
|
231
|
+
/**
|
|
232
|
+
* Location services disabled
|
|
233
|
+
*/
|
|
234
|
+
readonly LOCATION_SERVICES_DISABLED: "LOCATION_SERVICES_DISABLED";
|
|
235
|
+
/**
|
|
236
|
+
* Feature not supported on current platform
|
|
237
|
+
*/
|
|
238
|
+
readonly UNSUPPORTED_PLATFORM: "UNSUPPORTED_PLATFORM";
|
|
239
|
+
};
|
|
240
|
+
export declare type ErrorCode = typeof ERROR_CODES[keyof typeof ERROR_CODES];
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plugin error codes for consistent error handling
|
|
3
|
+
*/
|
|
4
|
+
export const ERROR_CODES = {
|
|
5
|
+
/**
|
|
6
|
+
* Location permission denied or not granted
|
|
7
|
+
*/
|
|
8
|
+
PERMISSION_DENIED: 'PERMISSION_DENIED',
|
|
9
|
+
/**
|
|
10
|
+
* Invalid notification configuration
|
|
11
|
+
*/
|
|
12
|
+
INVALID_NOTIFICATION: 'INVALID_NOTIFICATION',
|
|
13
|
+
/**
|
|
14
|
+
* Invalid parameters provided
|
|
15
|
+
*/
|
|
16
|
+
INVALID_PARAMETERS: 'INVALID_PARAMETERS',
|
|
17
|
+
/**
|
|
18
|
+
* Location services disabled
|
|
19
|
+
*/
|
|
20
|
+
LOCATION_SERVICES_DISABLED: 'LOCATION_SERVICES_DISABLED',
|
|
21
|
+
/**
|
|
22
|
+
* Feature not supported on current platform
|
|
23
|
+
*/
|
|
24
|
+
UNSUPPORTED_PLATFORM: 'UNSUPPORTED_PLATFORM'
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=definitions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAqQA;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB;;OAEG;IACH,iBAAiB,EAAE,mBAAmB;IAEtC;;OAEG;IACH,oBAAoB,EAAE,sBAAsB;IAE5C;;OAEG;IACH,kBAAkB,EAAE,oBAAoB;IAExC;;OAEG;IACH,0BAA0B,EAAE,4BAA4B;IAExD;;OAEG;IACH,oBAAoB,EAAE,sBAAsB;CACpC,CAAC","sourcesContent":["import type { PermissionState, PluginListenerHandle } from '@capacitor/core';\n\n// Re-export Capacitor types for user convenience\nexport type { PermissionState, PluginListenerHandle };\n\nexport interface ForeGroundLocationPlugin {\n /**\n * Check current permission status\n * @since 1.0.0\n */\n checkPermissions(): Promise<LocationPermissionStatus>;\n\n /**\n * Request location permissions\n * @since 1.0.0\n */\n requestPermissions(): Promise<LocationPermissionStatus>;\n\n /**\n * Start foreground location service\n * @since 1.0.0\n */\n startForegroundLocationService(options: LocationServiceOptions): Promise<void>;\n\n /**\n * Stop foreground location service\n * @since 1.0.0\n */\n stopForegroundLocationService(): Promise<void>;\n\n /**\n * Check if location service is running\n * @since 1.0.0\n */\n isServiceRunning(): Promise<{ isRunning: boolean }>;\n\n /**\n * Get current location once\n * @since 1.0.0\n */\n getCurrentLocation(): Promise<LocationResult>;\n\n /**\n * Update location service settings\n * @since 1.0.0\n */\n updateLocationSettings(options: LocationServiceOptions): Promise<void>;\n\n /**\n * Get API service status\n * @since 1.0.0\n */\n getApiServiceStatus(): Promise<ApiServiceStatus>;\n\n /**\n * Clear API service buffers\n * @since 1.0.0\n */\n clearApiBuffers(): Promise<void>;\n\n /**\n * Reset API service circuit breaker\n * @since 1.0.0\n */\n resetApiCircuitBreaker(): Promise<void>;\n\n /**\n * Listen for location updates\n * @since 1.0.0\n */\n addListener(\n eventName: 'locationUpdate',\n listenerFunc: (location: LocationResult) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Listen for service status changes\n * @since 1.0.0\n */\n addListener(\n eventName: 'serviceStatusChanged',\n listenerFunc: (status: ServiceStatus) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Remove all listeners\n * @since 1.0.0\n */\n removeAllListeners(): Promise<void>;\n}\n\nexport interface LocationServiceOptions {\n /**\n * Update interval in milliseconds\n * @default 60000\n * @minimum 1000\n */\n interval?: number;\n\n /**\n * Fastest update interval in milliseconds\n * @default 30000\n * @minimum 1000\n */\n fastestInterval?: number;\n\n /**\n * Location accuracy priority\n * @default 'HIGH_ACCURACY'\n */\n priority?: 'HIGH_ACCURACY' | 'BALANCED_POWER' | 'LOW_POWER' | 'NO_POWER';\n\n /**\n * Notification configuration for foreground service (REQUIRED)\n */\n notification: {\n /**\n * Notification title (REQUIRED)\n */\n title: string;\n /**\n * Notification text/content (REQUIRED)\n */\n text: string;\n /**\n * Optional notification icon resource name\n */\n icon?: string;\n };\n\n /**\n * Enable high accuracy mode\n * @default true\n */\n enableHighAccuracy?: boolean;\n\n /**\n * Minimum distance in meters to trigger update\n */\n distanceFilter?: number;\n\n /**\n * API service configuration (optional)\n * If provided, location data will be sent to the specified API endpoint in batches\n */\n api?: ApiServiceConfig;\n}\n\nexport interface ApiServiceConfig {\n /**\n * API endpoint URL (REQUIRED if api config is provided)\n */\n url: string;\n\n /**\n * HTTP method to use\n * @default 'POST'\n */\n type?: 'GET' | 'POST' | 'PUT' | 'PATCH';\n\n /**\n * HTTP headers to include in API requests\n */\n header?: Record<string, string>;\n\n /**\n * Additional parameters to include in API request body\n */\n additionalParams?: Record<string, any>;\n\n /**\n * Interval in minutes for sending batched location data to API\n * @default 5\n * @minimum 1\n */\n apiInterval?: number;\n}\n\nexport interface ApiServiceStatus {\n /**\n * Whether API service is enabled and configured\n */\n isEnabled: boolean;\n\n /**\n * Number of location points in buffer waiting to be sent\n */\n bufferSize: number;\n\n /**\n * Whether API service is healthy (not in circuit breaker state)\n */\n isHealthy: boolean;\n}\n\nexport interface LocationResult {\n /**\n * Latitude in decimal degrees\n */\n latitude: number;\n\n /**\n * Longitude in decimal degrees\n */\n longitude: number;\n\n /**\n * Accuracy of the location in meters\n */\n accuracy: number;\n\n /**\n * Altitude in meters (if available)\n */\n altitude?: number;\n\n /**\n * Bearing in degrees (if available)\n */\n bearing?: number;\n\n /**\n * Speed in meters per second (if available)\n */\n speed?: number;\n\n /**\n * Timestamp in ISO 8601 format\n */\n timestamp: string;\n}\n\nexport interface LocationPermissionStatus {\n /**\n * Fine and coarse location permission status\n */\n location: PermissionState;\n\n /**\n * Background location permission status (Android 10+)\n */\n backgroundLocation: PermissionState;\n\n /**\n * Notification permission status (Android 13+)\n */\n notifications: PermissionState;\n}\n\nexport interface ServiceStatus {\n /**\n * Whether the service is currently running\n */\n isRunning: boolean;\n\n /**\n * Error message if service failed\n */\n error?: string;\n}\n\n/**\n * Plugin error codes for consistent error handling\n */\nexport const ERROR_CODES = {\n /**\n * Location permission denied or not granted\n */\n PERMISSION_DENIED: 'PERMISSION_DENIED',\n\n /**\n * Invalid notification configuration\n */\n INVALID_NOTIFICATION: 'INVALID_NOTIFICATION',\n\n /**\n * Invalid parameters provided\n */\n INVALID_PARAMETERS: 'INVALID_PARAMETERS',\n\n /**\n * Location services disabled\n */\n LOCATION_SERVICES_DISABLED: 'LOCATION_SERVICES_DISABLED',\n\n /**\n * Feature not supported on current platform\n */\n UNSUPPORTED_PLATFORM: 'UNSUPPORTED_PLATFORM'\n} as const;\n\nexport type ErrorCode = typeof ERROR_CODES[keyof typeof ERROR_CODES];\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { registerPlugin } from '@capacitor/core';
|
|
2
|
+
const ForeGroundLocation = registerPlugin('ForeGroundLocation', {
|
|
3
|
+
web: () => import('./web').then((m) => new m.ForeGroundLocationWeb()),
|
|
4
|
+
});
|
|
5
|
+
export * from './definitions';
|
|
6
|
+
export { ForeGroundLocation };
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,kBAAkB,GAAG,cAAc,CAA2B,oBAAoB,EAAE;IACxF,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,qBAAqB,EAAE,CAAC;CACtE,CAAC,CAAC;AAEH,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,kBAAkB,EAAE,CAAC","sourcesContent":["import { registerPlugin } from '@capacitor/core';\n\nimport type { ForeGroundLocationPlugin } from './definitions';\n\nconst ForeGroundLocation = registerPlugin<ForeGroundLocationPlugin>('ForeGroundLocation', {\n web: () => import('./web').then((m) => new m.ForeGroundLocationWeb()),\n});\n\nexport * from './definitions';\nexport { ForeGroundLocation };\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { WebPlugin } from '@capacitor/core';
|
|
2
|
+
import type { ForeGroundLocationPlugin, LocationPermissionStatus, LocationResult, ApiServiceStatus } from './definitions';
|
|
3
|
+
export declare class ForeGroundLocationWeb extends WebPlugin implements ForeGroundLocationPlugin {
|
|
4
|
+
checkPermissions(): Promise<LocationPermissionStatus>;
|
|
5
|
+
requestPermissions(): Promise<LocationPermissionStatus>;
|
|
6
|
+
startForegroundLocationService(): Promise<void>;
|
|
7
|
+
stopForegroundLocationService(): Promise<void>;
|
|
8
|
+
isServiceRunning(): Promise<{
|
|
9
|
+
isRunning: boolean;
|
|
10
|
+
}>;
|
|
11
|
+
getCurrentLocation(): Promise<LocationResult>;
|
|
12
|
+
updateLocationSettings(): Promise<void>;
|
|
13
|
+
getApiServiceStatus(): Promise<ApiServiceStatus>;
|
|
14
|
+
clearApiBuffers(): Promise<void>;
|
|
15
|
+
resetApiCircuitBreaker(): Promise<void>;
|
|
16
|
+
}
|
package/dist/esm/web.js
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { WebPlugin } from '@capacitor/core';
|
|
2
|
+
export class ForeGroundLocationWeb extends WebPlugin {
|
|
3
|
+
async checkPermissions() {
|
|
4
|
+
if (typeof navigator === 'undefined') {
|
|
5
|
+
throw this.unavailable('Navigator not available');
|
|
6
|
+
}
|
|
7
|
+
if (!navigator.permissions) {
|
|
8
|
+
throw this.unavailable('Permissions API not available in this browser');
|
|
9
|
+
}
|
|
10
|
+
if (!navigator.geolocation) {
|
|
11
|
+
throw this.unavailable('Geolocation API not available in this browser');
|
|
12
|
+
}
|
|
13
|
+
try {
|
|
14
|
+
const permission = await navigator.permissions.query({ name: 'geolocation' });
|
|
15
|
+
return {
|
|
16
|
+
location: permission.state,
|
|
17
|
+
backgroundLocation: 'denied',
|
|
18
|
+
notifications: 'denied'
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
catch (error) {
|
|
22
|
+
// Fallback for browsers that support geolocation but not permissions query
|
|
23
|
+
return {
|
|
24
|
+
location: 'prompt',
|
|
25
|
+
backgroundLocation: 'denied',
|
|
26
|
+
notifications: 'denied'
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
async requestPermissions() {
|
|
31
|
+
throw this.unimplemented('Background location service not supported on web. Use getCurrentLocation() for one-time location access.');
|
|
32
|
+
}
|
|
33
|
+
async startForegroundLocationService() {
|
|
34
|
+
throw this.unimplemented('Foreground location service not supported on web. Use getCurrentLocation() for one-time location access.');
|
|
35
|
+
}
|
|
36
|
+
async stopForegroundLocationService() {
|
|
37
|
+
throw this.unimplemented('Foreground location service not supported on web.');
|
|
38
|
+
}
|
|
39
|
+
async isServiceRunning() {
|
|
40
|
+
return { isRunning: false };
|
|
41
|
+
}
|
|
42
|
+
async getCurrentLocation() {
|
|
43
|
+
if (typeof navigator === 'undefined') {
|
|
44
|
+
throw this.unavailable('Navigator not available');
|
|
45
|
+
}
|
|
46
|
+
if (!navigator.geolocation) {
|
|
47
|
+
throw this.unavailable('Geolocation API not available in this browser');
|
|
48
|
+
}
|
|
49
|
+
return new Promise((resolve, reject) => {
|
|
50
|
+
navigator.geolocation.getCurrentPosition((position) => {
|
|
51
|
+
resolve({
|
|
52
|
+
latitude: position.coords.latitude,
|
|
53
|
+
longitude: position.coords.longitude,
|
|
54
|
+
accuracy: position.coords.accuracy,
|
|
55
|
+
altitude: position.coords.altitude || undefined,
|
|
56
|
+
bearing: position.coords.heading || undefined,
|
|
57
|
+
speed: position.coords.speed || undefined,
|
|
58
|
+
timestamp: new Date(position.timestamp).toISOString(),
|
|
59
|
+
});
|
|
60
|
+
}, (error) => {
|
|
61
|
+
let errorMessage = 'Location error';
|
|
62
|
+
switch (error.code) {
|
|
63
|
+
case error.PERMISSION_DENIED:
|
|
64
|
+
errorMessage = 'Location permission denied';
|
|
65
|
+
break;
|
|
66
|
+
case error.POSITION_UNAVAILABLE:
|
|
67
|
+
errorMessage = 'Location position unavailable';
|
|
68
|
+
break;
|
|
69
|
+
case error.TIMEOUT:
|
|
70
|
+
errorMessage = 'Location request timed out';
|
|
71
|
+
break;
|
|
72
|
+
default:
|
|
73
|
+
errorMessage = `Location error: ${error.message}`;
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
reject(errorMessage);
|
|
77
|
+
}, {
|
|
78
|
+
enableHighAccuracy: true,
|
|
79
|
+
timeout: 10000,
|
|
80
|
+
maximumAge: 300000,
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
async updateLocationSettings() {
|
|
85
|
+
throw this.unimplemented('Location service settings not supported on web.');
|
|
86
|
+
}
|
|
87
|
+
async getApiServiceStatus() {
|
|
88
|
+
throw this.unimplemented('API service not supported on web.');
|
|
89
|
+
}
|
|
90
|
+
async clearApiBuffers() {
|
|
91
|
+
throw this.unimplemented('API service not supported on web.');
|
|
92
|
+
}
|
|
93
|
+
async resetApiCircuitBreaker() {
|
|
94
|
+
throw this.unimplemented('API service not supported on web.');
|
|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,MAAM;oBACR,KAAK,KAAK,CAAC,OAAO;wBAChB,YAAY,GAAG,4BAA4B,CAAC;wBAC5C,MAAM;oBACR;wBACE,YAAY,GAAG,mBAAmB,KAAK,CAAC,OAAO,EAAE,CAAC;wBAClD,MAAM;iBACT;gBACD,MAAM,CAAC,YAAY,CAAC,CAAC;YACvB,CAAC,EACD;gBACE,kBAAkB,EAAE,IAAI;gBACxB,OAAO,EAAE,KAAK;gBACd,UAAU,EAAE,MAAM;aACnB,CACF,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,sBAAsB;QAC1B,MAAM,IAAI,CAAC,aAAa,CAAC,iDAAiD,CAAC,CAAC;IAC9E,CAAC;IAED,KAAK,CAAC,mBAAmB;QACvB,MAAM,IAAI,CAAC,aAAa,CAAC,mCAAmC,CAAC,CAAC;IAChE,CAAC;IAED,KAAK,CAAC,eAAe;QACnB,MAAM,IAAI,CAAC,aAAa,CAAC,mCAAmC,CAAC,CAAC;IAChE,CAAC;IAED,KAAK,CAAC,sBAAsB;QAC1B,MAAM,IAAI,CAAC,aAAa,CAAC,mCAAmC,CAAC,CAAC;IAChE,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type {\n ForeGroundLocationPlugin,\n LocationPermissionStatus,\n LocationResult,\n ApiServiceStatus\n} from './definitions';\n\nexport class ForeGroundLocationWeb extends WebPlugin implements ForeGroundLocationPlugin {\n\n async checkPermissions(): Promise<LocationPermissionStatus> {\n if (typeof navigator === 'undefined') {\n throw this.unavailable('Navigator not available');\n }\n\n if (!navigator.permissions) {\n throw this.unavailable('Permissions API not available in this browser');\n }\n\n if (!navigator.geolocation) {\n throw this.unavailable('Geolocation API not available in this browser');\n }\n\n try {\n const permission = await navigator.permissions.query({ name: 'geolocation' as PermissionName });\n return {\n location: permission.state as any,\n backgroundLocation: 'denied',\n notifications: 'denied'\n };\n } catch (error) {\n // Fallback for browsers that support geolocation but not permissions query\n return {\n location: 'prompt',\n backgroundLocation: 'denied',\n notifications: 'denied'\n };\n }\n }\n\n async requestPermissions(): Promise<LocationPermissionStatus> {\n throw this.unimplemented('Background location service not supported on web. Use getCurrentLocation() for one-time location access.');\n }\n\n async startForegroundLocationService(): Promise<void> {\n throw this.unimplemented('Foreground location service not supported on web. Use getCurrentLocation() for one-time location access.');\n }\n\n async stopForegroundLocationService(): Promise<void> {\n throw this.unimplemented('Foreground location service not supported on web.');\n }\n\n async isServiceRunning(): Promise<{ isRunning: boolean }> {\n return { isRunning: false };\n }\n\n async getCurrentLocation(): Promise<LocationResult> {\n if (typeof navigator === 'undefined') {\n throw this.unavailable('Navigator not available');\n }\n\n if (!navigator.geolocation) {\n throw this.unavailable('Geolocation API not available in this browser');\n }\n\n return new Promise((resolve, reject) => {\n navigator.geolocation.getCurrentPosition(\n (position) => {\n resolve({\n latitude: position.coords.latitude,\n longitude: position.coords.longitude,\n accuracy: position.coords.accuracy,\n altitude: position.coords.altitude || undefined,\n bearing: position.coords.heading || undefined,\n speed: position.coords.speed || undefined,\n timestamp: new Date(position.timestamp).toISOString(),\n });\n },\n (error) => {\n let errorMessage = 'Location error';\n switch (error.code) {\n case error.PERMISSION_DENIED:\n errorMessage = 'Location permission denied';\n break;\n case error.POSITION_UNAVAILABLE:\n errorMessage = 'Location position unavailable';\n break;\n case error.TIMEOUT:\n errorMessage = 'Location request timed out';\n break;\n default:\n errorMessage = `Location error: ${error.message}`;\n break;\n }\n reject(errorMessage);\n },\n {\n enableHighAccuracy: true,\n timeout: 10000,\n maximumAge: 300000,\n }\n );\n });\n }\n\n async updateLocationSettings(): Promise<void> {\n throw this.unimplemented('Location service settings not supported on web.');\n }\n\n async getApiServiceStatus(): Promise<ApiServiceStatus> {\n throw this.unimplemented('API service not supported on web.');\n }\n\n async clearApiBuffers(): Promise<void> {\n throw this.unimplemented('API service not supported on web.');\n }\n\n async resetApiCircuitBreaker(): Promise<void> {\n throw this.unimplemented('API service not supported on web.');\n }\n}\n"]}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var core = require('@capacitor/core');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Plugin error codes for consistent error handling
|
|
7
|
+
*/
|
|
8
|
+
const ERROR_CODES = {
|
|
9
|
+
/**
|
|
10
|
+
* Location permission denied or not granted
|
|
11
|
+
*/
|
|
12
|
+
PERMISSION_DENIED: 'PERMISSION_DENIED',
|
|
13
|
+
/**
|
|
14
|
+
* Invalid notification configuration
|
|
15
|
+
*/
|
|
16
|
+
INVALID_NOTIFICATION: 'INVALID_NOTIFICATION',
|
|
17
|
+
/**
|
|
18
|
+
* Invalid parameters provided
|
|
19
|
+
*/
|
|
20
|
+
INVALID_PARAMETERS: 'INVALID_PARAMETERS',
|
|
21
|
+
/**
|
|
22
|
+
* Location services disabled
|
|
23
|
+
*/
|
|
24
|
+
LOCATION_SERVICES_DISABLED: 'LOCATION_SERVICES_DISABLED',
|
|
25
|
+
/**
|
|
26
|
+
* Feature not supported on current platform
|
|
27
|
+
*/
|
|
28
|
+
UNSUPPORTED_PLATFORM: 'UNSUPPORTED_PLATFORM'
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const ForeGroundLocation = core.registerPlugin('ForeGroundLocation', {
|
|
32
|
+
web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.ForeGroundLocationWeb()),
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
class ForeGroundLocationWeb extends core.WebPlugin {
|
|
36
|
+
async checkPermissions() {
|
|
37
|
+
if (typeof navigator === 'undefined') {
|
|
38
|
+
throw this.unavailable('Navigator not available');
|
|
39
|
+
}
|
|
40
|
+
if (!navigator.permissions) {
|
|
41
|
+
throw this.unavailable('Permissions API not available in this browser');
|
|
42
|
+
}
|
|
43
|
+
if (!navigator.geolocation) {
|
|
44
|
+
throw this.unavailable('Geolocation API not available in this browser');
|
|
45
|
+
}
|
|
46
|
+
try {
|
|
47
|
+
const permission = await navigator.permissions.query({ name: 'geolocation' });
|
|
48
|
+
return {
|
|
49
|
+
location: permission.state,
|
|
50
|
+
backgroundLocation: 'denied',
|
|
51
|
+
notifications: 'denied'
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
// Fallback for browsers that support geolocation but not permissions query
|
|
56
|
+
return {
|
|
57
|
+
location: 'prompt',
|
|
58
|
+
backgroundLocation: 'denied',
|
|
59
|
+
notifications: 'denied'
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
async requestPermissions() {
|
|
64
|
+
throw this.unimplemented('Background location service not supported on web. Use getCurrentLocation() for one-time location access.');
|
|
65
|
+
}
|
|
66
|
+
async startForegroundLocationService() {
|
|
67
|
+
throw this.unimplemented('Foreground location service not supported on web. Use getCurrentLocation() for one-time location access.');
|
|
68
|
+
}
|
|
69
|
+
async stopForegroundLocationService() {
|
|
70
|
+
throw this.unimplemented('Foreground location service not supported on web.');
|
|
71
|
+
}
|
|
72
|
+
async isServiceRunning() {
|
|
73
|
+
return { isRunning: false };
|
|
74
|
+
}
|
|
75
|
+
async getCurrentLocation() {
|
|
76
|
+
if (typeof navigator === 'undefined') {
|
|
77
|
+
throw this.unavailable('Navigator not available');
|
|
78
|
+
}
|
|
79
|
+
if (!navigator.geolocation) {
|
|
80
|
+
throw this.unavailable('Geolocation API not available in this browser');
|
|
81
|
+
}
|
|
82
|
+
return new Promise((resolve, reject) => {
|
|
83
|
+
navigator.geolocation.getCurrentPosition((position) => {
|
|
84
|
+
resolve({
|
|
85
|
+
latitude: position.coords.latitude,
|
|
86
|
+
longitude: position.coords.longitude,
|
|
87
|
+
accuracy: position.coords.accuracy,
|
|
88
|
+
altitude: position.coords.altitude || undefined,
|
|
89
|
+
bearing: position.coords.heading || undefined,
|
|
90
|
+
speed: position.coords.speed || undefined,
|
|
91
|
+
timestamp: new Date(position.timestamp).toISOString(),
|
|
92
|
+
});
|
|
93
|
+
}, (error) => {
|
|
94
|
+
let errorMessage = 'Location error';
|
|
95
|
+
switch (error.code) {
|
|
96
|
+
case error.PERMISSION_DENIED:
|
|
97
|
+
errorMessage = 'Location permission denied';
|
|
98
|
+
break;
|
|
99
|
+
case error.POSITION_UNAVAILABLE:
|
|
100
|
+
errorMessage = 'Location position unavailable';
|
|
101
|
+
break;
|
|
102
|
+
case error.TIMEOUT:
|
|
103
|
+
errorMessage = 'Location request timed out';
|
|
104
|
+
break;
|
|
105
|
+
default:
|
|
106
|
+
errorMessage = `Location error: ${error.message}`;
|
|
107
|
+
break;
|
|
108
|
+
}
|
|
109
|
+
reject(errorMessage);
|
|
110
|
+
}, {
|
|
111
|
+
enableHighAccuracy: true,
|
|
112
|
+
timeout: 10000,
|
|
113
|
+
maximumAge: 300000,
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
async updateLocationSettings() {
|
|
118
|
+
throw this.unimplemented('Location service settings not supported on web.');
|
|
119
|
+
}
|
|
120
|
+
async getApiServiceStatus() {
|
|
121
|
+
throw this.unimplemented('API service not supported on web.');
|
|
122
|
+
}
|
|
123
|
+
async clearApiBuffers() {
|
|
124
|
+
throw this.unimplemented('API service not supported on web.');
|
|
125
|
+
}
|
|
126
|
+
async resetApiCircuitBreaker() {
|
|
127
|
+
throw this.unimplemented('API service not supported on web.');
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
var web = /*#__PURE__*/Object.freeze({
|
|
132
|
+
__proto__: null,
|
|
133
|
+
ForeGroundLocationWeb: ForeGroundLocationWeb
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
exports.ERROR_CODES = ERROR_CODES;
|
|
137
|
+
exports.ForeGroundLocation = ForeGroundLocation;
|
|
138
|
+
//# sourceMappingURL=plugin.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.cjs.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["/**\r\n * Plugin error codes for consistent error handling\r\n */\r\nexport const ERROR_CODES = {\r\n /**\r\n * Location permission denied or not granted\r\n */\r\n PERMISSION_DENIED: 'PERMISSION_DENIED',\r\n /**\r\n * Invalid notification configuration\r\n */\r\n INVALID_NOTIFICATION: 'INVALID_NOTIFICATION',\r\n /**\r\n * Invalid parameters provided\r\n */\r\n INVALID_PARAMETERS: 'INVALID_PARAMETERS',\r\n /**\r\n * Location services disabled\r\n */\r\n LOCATION_SERVICES_DISABLED: 'LOCATION_SERVICES_DISABLED',\r\n /**\r\n * Feature not supported on current platform\r\n */\r\n UNSUPPORTED_PLATFORM: 'UNSUPPORTED_PLATFORM'\r\n};\r\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\r\nconst ForeGroundLocation = registerPlugin('ForeGroundLocation', {\r\n web: () => import('./web').then((m) => new m.ForeGroundLocationWeb()),\r\n});\r\nexport * from './definitions';\r\nexport { ForeGroundLocation };\r\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\r\nexport class ForeGroundLocationWeb extends WebPlugin {\r\n async checkPermissions() {\r\n if (typeof navigator === 'undefined') {\r\n throw this.unavailable('Navigator not available');\r\n }\r\n if (!navigator.permissions) {\r\n throw this.unavailable('Permissions API not available in this browser');\r\n }\r\n if (!navigator.geolocation) {\r\n throw this.unavailable('Geolocation API not available in this browser');\r\n }\r\n try {\r\n const permission = await navigator.permissions.query({ name: 'geolocation' });\r\n return {\r\n location: permission.state,\r\n backgroundLocation: 'denied',\r\n notifications: 'denied'\r\n };\r\n }\r\n catch (error) {\r\n // Fallback for browsers that support geolocation but not permissions query\r\n return {\r\n location: 'prompt',\r\n backgroundLocation: 'denied',\r\n notifications: 'denied'\r\n };\r\n }\r\n }\r\n async requestPermissions() {\r\n throw this.unimplemented('Background location service not supported on web. Use getCurrentLocation() for one-time location access.');\r\n }\r\n async startForegroundLocationService() {\r\n throw this.unimplemented('Foreground location service not supported on web. Use getCurrentLocation() for one-time location access.');\r\n }\r\n async stopForegroundLocationService() {\r\n throw this.unimplemented('Foreground location service not supported on web.');\r\n }\r\n async isServiceRunning() {\r\n return { isRunning: false };\r\n }\r\n async getCurrentLocation() {\r\n if (typeof navigator === 'undefined') {\r\n throw this.unavailable('Navigator not available');\r\n }\r\n if (!navigator.geolocation) {\r\n throw this.unavailable('Geolocation API not available in this browser');\r\n }\r\n return new Promise((resolve, reject) => {\r\n navigator.geolocation.getCurrentPosition((position) => {\r\n resolve({\r\n latitude: position.coords.latitude,\r\n longitude: position.coords.longitude,\r\n accuracy: position.coords.accuracy,\r\n altitude: position.coords.altitude || undefined,\r\n bearing: position.coords.heading || undefined,\r\n speed: position.coords.speed || undefined,\r\n timestamp: new Date(position.timestamp).toISOString(),\r\n });\r\n }, (error) => {\r\n let errorMessage = 'Location error';\r\n switch (error.code) {\r\n case error.PERMISSION_DENIED:\r\n errorMessage = 'Location permission denied';\r\n break;\r\n case error.POSITION_UNAVAILABLE:\r\n errorMessage = 'Location position unavailable';\r\n break;\r\n case error.TIMEOUT:\r\n errorMessage = 'Location request timed out';\r\n break;\r\n default:\r\n errorMessage = `Location error: ${error.message}`;\r\n break;\r\n }\r\n reject(errorMessage);\r\n }, {\r\n enableHighAccuracy: true,\r\n timeout: 10000,\r\n maximumAge: 300000,\r\n });\r\n });\r\n }\r\n async updateLocationSettings() {\r\n throw this.unimplemented('Location service settings not supported on web.');\r\n }\r\n async getApiServiceStatus() {\r\n throw this.unimplemented('API service not supported on web.');\r\n }\r\n async clearApiBuffers() {\r\n throw this.unimplemented('API service not supported on web.');\r\n }\r\n async resetApiCircuitBreaker() {\r\n throw this.unimplemented('API service not supported on web.');\r\n }\r\n}\r\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AAAA;AACA;AACA;AACY,MAAC,WAAW,GAAG;AAC3B;AACA;AACA;AACA,IAAI,iBAAiB,EAAE,mBAAmB;AAC1C;AACA;AACA;AACA,IAAI,oBAAoB,EAAE,sB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