@symbiote-native/location 0.1.2 → 0.1.3

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.
Files changed (68) hide show
  1. package/README.md +60 -32
  2. package/build/angular/index.d.ts +1 -0
  3. package/build/angular/index.js +3 -3
  4. package/build/angular/services/location-permissions.service.d.ts +12 -0
  5. package/build/angular/services/location-permissions.service.js +104 -0
  6. package/build/core/geolocation-polyfill.d.ts +2 -0
  7. package/build/core/geolocation-polyfill.js +52 -0
  8. package/build/core/index.d.ts +1 -0
  9. package/build/core/index.js +1 -0
  10. package/build/core/location-permission-api.d.ts +13 -0
  11. package/build/core/location-permission-api.js +15 -0
  12. package/build/core/location.d.ts +0 -3
  13. package/build/core/location.js +1 -13
  14. package/build/core/native-module.d.ts +1 -0
  15. package/build/react/index.d.ts +2 -0
  16. package/build/react/index.js +2 -0
  17. package/build/react/use-location-permissions.d.ts +11 -0
  18. package/build/react/use-location-permissions.js +6 -0
  19. package/build/solid/index.d.ts +2 -0
  20. package/build/solid/index.js +2 -0
  21. package/build/solid/use-location-permissions.d.ts +12 -0
  22. package/build/solid/use-location-permissions.js +6 -0
  23. package/build/svelte/index.d.ts +2 -0
  24. package/build/svelte/index.js +2 -0
  25. package/build/svelte/use-location-permissions.svelte.d.ts +11 -0
  26. package/build/svelte/use-location-permissions.svelte.js +6 -0
  27. package/build/vue/index.d.ts +2 -0
  28. package/build/vue/index.js +2 -0
  29. package/build/vue/use-location-permissions.d.ts +12 -0
  30. package/build/vue/use-location-permissions.js +6 -0
  31. package/build-ngc/angular/index.d.ts +1 -0
  32. package/build-ngc/angular/index.js +3 -3
  33. package/build-ngc/angular/index.js.map +1 -1
  34. package/build-ngc/angular/services/location-permissions.service.d.ts +19 -0
  35. package/build-ngc/angular/services/location-permissions.service.js +39 -0
  36. package/build-ngc/angular/services/location-permissions.service.js.map +1 -0
  37. package/build-ngc/core/geolocation-polyfill.d.ts +2 -0
  38. package/build-ngc/core/geolocation-polyfill.js +53 -0
  39. package/build-ngc/core/geolocation-polyfill.js.map +1 -0
  40. package/build-ngc/core/index.d.ts +1 -0
  41. package/build-ngc/core/index.js +1 -0
  42. package/build-ngc/core/index.js.map +1 -1
  43. package/build-ngc/core/location-permission-api.d.ts +13 -0
  44. package/build-ngc/core/location-permission-api.js +16 -0
  45. package/build-ngc/core/location-permission-api.js.map +1 -0
  46. package/build-ngc/core/location.d.ts +0 -3
  47. package/build-ngc/core/location.js +1 -13
  48. package/build-ngc/core/location.js.map +1 -1
  49. package/build-ngc/core/native-module.d.ts +1 -0
  50. package/build-ngc/core/native-module.js.map +1 -1
  51. package/package.json +23 -23
  52. package/src/angular/index.ts +7 -3
  53. package/src/angular/services/location-permissions.service.ts +40 -0
  54. package/src/core/geolocation-polyfill.ts +82 -0
  55. package/src/core/index.ts +1 -0
  56. package/src/core/location-permission-api.ts +26 -0
  57. package/src/core/location.ts +1 -16
  58. package/src/core/native-module.ts +1 -0
  59. package/src/react/index.ts +6 -0
  60. package/src/react/use-location-permissions.ts +25 -0
  61. package/src/solid/index.ts +6 -0
  62. package/src/solid/use-location-permissions.ts +26 -0
  63. package/src/svelte/index.ts +6 -0
  64. package/src/svelte/svelte-ambient.d.ts +3 -0
  65. package/src/svelte/svelte-compile.test-helper.ts +7 -0
  66. package/src/svelte/use-location-permissions.svelte.ts +25 -0
  67. package/src/vue/index.ts +6 -0
  68. package/src/vue/use-location-permissions.ts +26 -0
@@ -1,5 +1,5 @@
1
- // @symbiote-native/location/angular: the Angular entry over the framework-agnostic core. Same
2
- // reasoning as the React/Vue entries — no per-instance state or event stream to wrap in a
3
- // service, so this is a plain re-export.
1
+ // @symbiote-native/location/angular: the core plus the permission services, the location
2
+ // streams need no service wrapper
4
3
  export * from '../core';
4
+ export { ForegroundPermissionsService, BackgroundPermissionsService, MotionActivityPermissionsService, } from './services/location-permissions.service';
5
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/angular/index.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,0FAA0F;AAC1F,yCAAyC;AACzC,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/angular/index.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,kCAAkC;AAClC,cAAc,SAAS,CAAC;AACxB,OAAO,EACL,4BAA4B,EAC5B,4BAA4B,EAC5B,gCAAgC,GACjC,MAAM,yCAAyC,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { PermissionsServiceBase } from '@symbiote-native/angular';
2
+ import type { ILocationPermissionResponse } from '../../core';
3
+ import type { PermissionResponse } from 'expo-modules-core';
4
+ import * as i0 from "@angular/core";
5
+ export declare class ForegroundPermissionsService extends PermissionsServiceBase<ILocationPermissionResponse> {
6
+ constructor();
7
+ static ɵfac: i0.ɵɵFactoryDeclaration<ForegroundPermissionsService, never>;
8
+ static ɵprov: i0.ɵɵInjectableDeclaration<ForegroundPermissionsService>;
9
+ }
10
+ export declare class BackgroundPermissionsService extends PermissionsServiceBase<PermissionResponse> {
11
+ constructor();
12
+ static ɵfac: i0.ɵɵFactoryDeclaration<BackgroundPermissionsService, never>;
13
+ static ɵprov: i0.ɵɵInjectableDeclaration<BackgroundPermissionsService>;
14
+ }
15
+ export declare class MotionActivityPermissionsService extends PermissionsServiceBase<PermissionResponse> {
16
+ constructor();
17
+ static ɵfac: i0.ɵɵFactoryDeclaration<MotionActivityPermissionsService, never>;
18
+ static ɵprov: i0.ɵɵInjectableDeclaration<MotionActivityPermissionsService>;
19
+ }
@@ -0,0 +1,39 @@
1
+ import { Injectable } from '@angular/core';
2
+ import { backgroundPermissionMethods, foregroundPermissionMethods, motionActivityPermissionMethods, } from '../../core/location-permission-api';
3
+ import { PermissionsServiceBase } from '@symbiote-native/angular';
4
+ import * as i0 from "@angular/core";
5
+ // Angular twin of `../../react`'s location permission hooks
6
+ export class ForegroundPermissionsService extends PermissionsServiceBase {
7
+ constructor() {
8
+ super(foregroundPermissionMethods.getMethod, foregroundPermissionMethods.requestMethod);
9
+ }
10
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: ForegroundPermissionsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
11
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: ForegroundPermissionsService, providedIn: 'root' });
12
+ }
13
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: ForegroundPermissionsService, decorators: [{
14
+ type: Injectable,
15
+ args: [{ providedIn: 'root' }]
16
+ }], ctorParameters: () => [] });
17
+ export class BackgroundPermissionsService extends PermissionsServiceBase {
18
+ constructor() {
19
+ super(backgroundPermissionMethods.getMethod, backgroundPermissionMethods.requestMethod);
20
+ }
21
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: BackgroundPermissionsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
22
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: BackgroundPermissionsService, providedIn: 'root' });
23
+ }
24
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: BackgroundPermissionsService, decorators: [{
25
+ type: Injectable,
26
+ args: [{ providedIn: 'root' }]
27
+ }], ctorParameters: () => [] });
28
+ export class MotionActivityPermissionsService extends PermissionsServiceBase {
29
+ constructor() {
30
+ super(motionActivityPermissionMethods.getMethod, motionActivityPermissionMethods.requestMethod);
31
+ }
32
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: MotionActivityPermissionsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
33
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: MotionActivityPermissionsService, providedIn: 'root' });
34
+ }
35
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: MotionActivityPermissionsService, decorators: [{
36
+ type: Injectable,
37
+ args: [{ providedIn: 'root' }]
38
+ }], ctorParameters: () => [] });
39
+ //# sourceMappingURL=location-permissions.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"location-permissions.service.js","sourceRoot":"","sources":["../../../src/angular/services/location-permissions.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EACL,2BAA2B,EAC3B,2BAA2B,EAC3B,+BAA+B,GAChC,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;;AAIlE,4DAA4D;AAE5D,MAAM,OAAO,4BAA6B,SAAQ,sBAAmD;IACnG;QACE,KAAK,CACH,2BAA2B,CAAC,SAAS,EACrC,2BAA2B,CAAC,aAAa,CAC1C,CAAC;IACJ,CAAC;uGANU,4BAA4B;2GAA5B,4BAA4B,cADf,MAAM;;2FACnB,4BAA4B;kBADxC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;AAWlC,MAAM,OAAO,4BAA6B,SAAQ,sBAA0C;IAC1F;QACE,KAAK,CACH,2BAA2B,CAAC,SAAS,EACrC,2BAA2B,CAAC,aAAa,CAC1C,CAAC;IACJ,CAAC;uGANU,4BAA4B;2GAA5B,4BAA4B,cADf,MAAM;;2FACnB,4BAA4B;kBADxC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;AAWlC,MAAM,OAAO,gCAAiC,SAAQ,sBAA0C;IAC9F;QACE,KAAK,CACH,+BAA+B,CAAC,SAAS,EACzC,+BAA+B,CAAC,aAAa,CAC9C,CAAC;IACJ,CAAC;uGANU,gCAAgC;2GAAhC,gCAAgC,cADnB,MAAM;;2FACnB,gCAAgC;kBAD5C,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE"}
@@ -0,0 +1,2 @@
1
+ /** Polyfills `navigator.geolocation` for interop with the React Native and Web geolocation API. */
2
+ export declare function installWebGeolocationPolyfill(): void;
@@ -0,0 +1,53 @@
1
+ import { Platform } from 'expo-modules-core';
2
+ import { expoLocation } from './native-module';
3
+ import { locationSubscriber } from './subscribers';
4
+ import { LocationAccuracy } from './types';
5
+ function convertGeolocationOptions(options) {
6
+ return {
7
+ accuracy: options.enableHighAccuracy
8
+ ? LocationAccuracy.High
9
+ : LocationAccuracy.Balanced,
10
+ };
11
+ }
12
+ async function requestCurrentPosition(success, error, options) {
13
+ try {
14
+ await expoLocation.requestPermissionsAsync();
15
+ success(await expoLocation.getCurrentPositionAsync(convertGeolocationOptions(options)));
16
+ }
17
+ catch (cause) {
18
+ error(cause);
19
+ }
20
+ }
21
+ // Returns undefined like the web API, the async work runs detached and reports through `error`
22
+ function getCurrentPosition(success, error = () => { }, options = {}) {
23
+ void requestCurrentPosition(success, error, options);
24
+ }
25
+ function watchPosition(success, error = () => { }, options = {}) {
26
+ const watchId = locationSubscriber.registerCallback(success);
27
+ expoLocation
28
+ .watchPositionImplAsync(watchId, convertGeolocationOptions(options))
29
+ .catch((cause) => {
30
+ locationSubscriber.unregisterCallback(watchId);
31
+ error({ watchId, message: cause.message, code: cause.code });
32
+ });
33
+ return watchId;
34
+ }
35
+ function clearWatch(watchId) {
36
+ locationSubscriber.unregisterCallback(watchId);
37
+ }
38
+ /** Polyfills `navigator.geolocation` for interop with the React Native and Web geolocation API. */
39
+ export function installWebGeolocationPolyfill() {
40
+ if (Platform.OS === 'web')
41
+ return;
42
+ if (!Reflect.has(globalThis, 'window'))
43
+ Reflect.set(globalThis, 'window', globalThis);
44
+ const windowObject = Reflect.get(globalThis, 'window');
45
+ if (!Reflect.has(windowObject, 'navigator'))
46
+ Reflect.set(windowObject, 'navigator', {});
47
+ Reflect.set(Reflect.get(windowObject, 'navigator'), 'geolocation', {
48
+ getCurrentPosition,
49
+ watchPosition,
50
+ clearWatch,
51
+ });
52
+ }
53
+ //# sourceMappingURL=geolocation-polyfill.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"geolocation-polyfill.js","sourceRoot":"","sources":["../../src/core/geolocation-polyfill.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAU3C,SAAS,yBAAyB,CAChC,OAA4B;IAE5B,OAAO;QACL,QAAQ,EAAE,OAAO,CAAC,kBAAkB;YAClC,CAAC,CAAC,gBAAgB,CAAC,IAAI;YACvB,CAAC,CAAC,gBAAgB,CAAC,QAAQ;KAC9B,CAAC;AACJ,CAAC;AAED,KAAK,UAAU,sBAAsB,CACnC,OAAoC,EACpC,KAAgC,EAChC,OAA4B;IAE5B,IAAI,CAAC;QACH,MAAM,YAAY,CAAC,uBAAuB,EAAE,CAAC;QAC7C,OAAO,CACL,MAAM,YAAY,CAAC,uBAAuB,CACxC,yBAAyB,CAAC,OAAO,CAAC,CACnC,CACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,KAAK,CAAC,KAAK,CAAC,CAAC;IACf,CAAC;AACH,CAAC;AAED,+FAA+F;AAC/F,SAAS,kBAAkB,CACzB,OAAoC,EACpC,QAAmC,GAAG,EAAE,GAAE,CAAC,EAC3C,UAA+B,EAAE;IAEjC,KAAK,sBAAsB,CAAC,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;AACvD,CAAC;AAED,SAAS,aAAa,CACpB,OAAoC,EACpC,QAAmC,GAAG,EAAE,GAAE,CAAC,EAC3C,UAA+B,EAAE;IAEjC,MAAM,OAAO,GAAG,kBAAkB,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAC7D,YAAY;SACT,sBAAsB,CAAC,OAAO,EAAE,yBAAyB,CAAC,OAAO,CAAC,CAAC;SACnE,KAAK,CAAC,CAAC,KAAwB,EAAE,EAAE;QAClC,kBAAkB,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;QAC/C,KAAK,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;IAC/D,CAAC,CAAC,CAAC;IACL,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,SAAS,UAAU,CAAC,OAAe;IACjC,kBAAkB,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;AACjD,CAAC;AAED,mGAAmG;AACnG,MAAM,UAAU,6BAA6B;IAC3C,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK;QAAE,OAAO;IAClC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,QAAQ,CAAC;QACpC,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;IAChD,MAAM,YAAY,GAAW,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;IAC/D,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,WAAW,CAAC;QACzC,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,WAAW,EAAE,EAAE,CAAC,CAAC;IAC7C,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,WAAW,CAAC,EAAE,aAAa,EAAE;QACjE,kBAAkB;QAClB,aAAa;QACb,UAAU;KACX,CAAC,CAAC;AACL,CAAC"}
@@ -1,5 +1,6 @@
1
1
  export { PermissionStatus, type PermissionHookOptions, type PermissionExpiration, } from 'expo-modules-core';
2
2
  export { getCurrentWatchId } from './subscribers';
3
+ export { installWebGeolocationPolyfill } from './geolocation-polyfill';
3
4
  export * from './location';
4
5
  export * from './types';
5
6
  export { LocationAccuracy as Accuracy, LocationActivityType as ActivityType, LocationGeofencingEventType as GeofencingEventType, LocationGeofencingRegionState as GeofencingRegionState, } from './types';
@@ -1,5 +1,6 @@
1
1
  export { PermissionStatus, } from 'expo-modules-core';
2
2
  export { getCurrentWatchId } from './subscribers';
3
+ export { installWebGeolocationPolyfill } from './geolocation-polyfill';
3
4
  export * from './location';
4
5
  export * from './types';
5
6
  export { LocationAccuracy as Accuracy, LocationActivityType as ActivityType, LocationGeofencingEventType as GeofencingEventType, LocationGeofencingRegionState as GeofencingRegionState, } from './types';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,GAGjB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAElD,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AAExB,OAAO,EACL,gBAAgB,IAAI,QAAQ,EAC5B,oBAAoB,IAAI,YAAY,EACpC,2BAA2B,IAAI,mBAAmB,EAClD,6BAA6B,IAAI,qBAAqB,GACvD,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,GAGjB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,6BAA6B,EAAE,MAAM,wBAAwB,CAAC;AAEvE,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AAExB,OAAO,EACL,gBAAgB,IAAI,QAAQ,EAC5B,oBAAoB,IAAI,YAAY,EACpC,2BAA2B,IAAI,mBAAmB,EAClD,6BAA6B,IAAI,qBAAqB,GACvD,MAAM,SAAS,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { getBackgroundPermissionsAsync, getForegroundPermissionsAsync, getMotionActivityPermissionsAsync, requestBackgroundPermissionsAsync, requestForegroundPermissionsAsync, requestMotionActivityPermissionsAsync } from './location';
2
+ export declare const foregroundPermissionMethods: {
3
+ getMethod: typeof getForegroundPermissionsAsync;
4
+ requestMethod: typeof requestForegroundPermissionsAsync;
5
+ };
6
+ export declare const backgroundPermissionMethods: {
7
+ getMethod: typeof getBackgroundPermissionsAsync;
8
+ requestMethod: typeof requestBackgroundPermissionsAsync;
9
+ };
10
+ export declare const motionActivityPermissionMethods: {
11
+ getMethod: typeof getMotionActivityPermissionsAsync;
12
+ requestMethod: typeof requestMotionActivityPermissionsAsync;
13
+ };
@@ -0,0 +1,16 @@
1
+ // `methods` every adapter's location permission hooks bind to the shared
2
+ // `@symbiote-native/{react,vue,solid,svelte}` `createPermissionHook` factory
3
+ import { getBackgroundPermissionsAsync, getForegroundPermissionsAsync, getMotionActivityPermissionsAsync, requestBackgroundPermissionsAsync, requestForegroundPermissionsAsync, requestMotionActivityPermissionsAsync, } from './location';
4
+ export const foregroundPermissionMethods = {
5
+ getMethod: getForegroundPermissionsAsync,
6
+ requestMethod: requestForegroundPermissionsAsync,
7
+ };
8
+ export const backgroundPermissionMethods = {
9
+ getMethod: getBackgroundPermissionsAsync,
10
+ requestMethod: requestBackgroundPermissionsAsync,
11
+ };
12
+ export const motionActivityPermissionMethods = {
13
+ getMethod: getMotionActivityPermissionsAsync,
14
+ requestMethod: requestMotionActivityPermissionsAsync,
15
+ };
16
+ //# sourceMappingURL=location-permission-api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"location-permission-api.js","sourceRoot":"","sources":["../../src/core/location-permission-api.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,6EAA6E;AAE7E,OAAO,EACL,6BAA6B,EAC7B,6BAA6B,EAC7B,iCAAiC,EACjC,iCAAiC,EACjC,iCAAiC,EACjC,qCAAqC,GACtC,MAAM,YAAY,CAAC;AAEpB,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,SAAS,EAAE,6BAA6B;IACxC,aAAa,EAAE,iCAAiC;CACjD,CAAC;AAEF,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,SAAS,EAAE,6BAA6B;IACxC,aAAa,EAAE,iCAAiC;CACjD,CAAC;AAEF,MAAM,CAAC,MAAM,+BAA+B,GAAG;IAC7C,SAAS,EAAE,iCAAiC;IAC5C,aAAa,EAAE,qCAAqC;CACrD,CAAC"}
@@ -12,14 +12,11 @@ export declare function geocodeAsync(address: string): Promise<ILocationGeocoded
12
12
  export declare function reverseGeocodeAsync(location: Pick<ILocationGeocodedLocation, 'latitude' | 'longitude'>): Promise<ILocationGeocodedAddress[]>;
13
13
  export declare function getForegroundPermissionsAsync(): Promise<ILocationPermissionResponse>;
14
14
  export declare function requestForegroundPermissionsAsync(): Promise<ILocationPermissionResponse>;
15
- export declare const useForegroundPermissions: (options?: import("expo-modules-core").PermissionHookOptions<object> | undefined) => [ILocationPermissionResponse | null, () => Promise<ILocationPermissionResponse>, () => Promise<ILocationPermissionResponse>];
16
15
  export declare function getBackgroundPermissionsAsync(): Promise<PermissionResponse>;
17
16
  export declare function requestBackgroundPermissionsAsync(): Promise<PermissionResponse>;
18
- export declare const useBackgroundPermissions: (options?: import("expo-modules-core").PermissionHookOptions<object> | undefined) => [PermissionResponse | null, () => Promise<PermissionResponse>, () => Promise<PermissionResponse>];
19
17
  export declare function hasServicesEnabledAsync(): Promise<boolean>;
20
18
  export declare function getMotionActivityPermissionsAsync(): Promise<PermissionResponse>;
21
19
  export declare function requestMotionActivityPermissionsAsync(): Promise<PermissionResponse>;
22
- export declare const useMotionActivityPermissions: (options?: import("expo-modules-core").PermissionHookOptions<object> | undefined) => [PermissionResponse | null, () => Promise<PermissionResponse>, () => Promise<PermissionResponse>];
23
20
  /** No location permission required — uses Play Services activity recognition / the iOS motion
24
21
  * coprocessor directly. */
25
22
  export declare function getMotionActivityAsync(): Promise<IMotionActivityObject>;
@@ -1,4 +1,4 @@
1
- import { createPermissionHook, Platform } from 'expo-modules-core';
1
+ import { Platform } from 'expo-modules-core';
2
2
  import { expoLocation } from './native-module';
3
3
  import { headingSubscriber, locationErrorSubscriber, locationSubscriber, motionActivitySubscriber, } from './subscribers';
4
4
  import { LocationAccuracy } from './types';
@@ -85,20 +85,12 @@ export async function getForegroundPermissionsAsync() {
85
85
  export async function requestForegroundPermissionsAsync() {
86
86
  return expoLocation.requestForegroundPermissionsAsync();
87
87
  }
88
- export const useForegroundPermissions = createPermissionHook({
89
- getMethod: getForegroundPermissionsAsync,
90
- requestMethod: requestForegroundPermissionsAsync,
91
- });
92
88
  export async function getBackgroundPermissionsAsync() {
93
89
  return expoLocation.getBackgroundPermissionsAsync();
94
90
  }
95
91
  export async function requestBackgroundPermissionsAsync() {
96
92
  return expoLocation.requestBackgroundPermissionsAsync();
97
93
  }
98
- export const useBackgroundPermissions = createPermissionHook({
99
- getMethod: getBackgroundPermissionsAsync,
100
- requestMethod: requestBackgroundPermissionsAsync,
101
- });
102
94
  export async function hasServicesEnabledAsync() {
103
95
  return expoLocation.hasServicesEnabledAsync();
104
96
  }
@@ -108,10 +100,6 @@ export async function getMotionActivityPermissionsAsync() {
108
100
  export async function requestMotionActivityPermissionsAsync() {
109
101
  return expoLocation.requestMotionActivityPermissionsAsync();
110
102
  }
111
- export const useMotionActivityPermissions = createPermissionHook({
112
- getMethod: getMotionActivityPermissionsAsync,
113
- requestMethod: requestMotionActivityPermissionsAsync,
114
- });
115
103
  /** No location permission required — uses Play Services activity recognition / the iOS motion
116
104
  * coprocessor directly. */
117
105
  export async function getMotionActivityAsync() {
@@ -1 +1 @@
1
- {"version":3,"file":"location.js","sourceRoot":"","sources":["../../src/core/location.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AA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;;qFAEqF;AACrF,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,QAAgB,EAChB,UAA6B,EAAE;IAE/B,mBAAmB,CAAC,QAAQ,CAAC,CAAC;IAC9B,kBAAkB,CAAC,OAAO,CAAC,CAAC;IAC5B,MAAM,YAAY,CAAC,oBAAoB,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;AACjE,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,QAAgB;IACxD,mBAAmB,CAAC,QAAQ,CAAC,CAAC;IAC9B,MAAM,YAAY,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC;AACnD,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAC7C,QAAgB;IAEhB,mBAAmB,CAAC,QAAQ,CAAC,CAAC;IAC9B,OAAO,YAAY,CAAC,yBAAyB,CAAC,QAAQ,CAAC,CAAC;AAC1D,CAAC"}
@@ -4,6 +4,7 @@ export type INativeLocationModule = {
4
4
  addListener(eventName: string, listener: (event: unknown) => void): EventSubscription;
5
5
  getProviderStatusAsync(): Promise<ILocationProviderStatus>;
6
6
  enableNetworkProviderAsync(): Promise<void>;
7
+ requestPermissionsAsync(): Promise<void>;
7
8
  getCurrentPositionAsync(options: ILocationOptions): Promise<ILocationObject>;
8
9
  getLastKnownPositionAsync(options: ILocationLastKnownOptions): Promise<ILocationObject | null>;
9
10
  watchPositionImplAsync(watchId: number, options: ILocationOptions): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"native-module.js","sourceRoot":"","sources":["../../src/core/native-module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAA0B,MAAM,mBAAmB,CAAC;AAchF,MAAM,yBAAyB,GAAG,cAAc,CAAC;AA6CjD,MAAM,CAAC,MAAM,YAAY,GAAG,mBAAmB,CAC7C,yBAAyB,CAC1B,CAAC"}
1
+ {"version":3,"file":"native-module.js","sourceRoot":"","sources":["../../src/core/native-module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAA0B,MAAM,mBAAmB,CAAC;AAchF,MAAM,yBAAyB,GAAG,cAAc,CAAC;AA8CjD,MAAM,CAAC,MAAM,YAAY,GAAG,mBAAmB,CAC7C,yBAAyB,CAC1B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@symbiote-native/location",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "expo-location wrapped for SymbioteNative — one framework-agnostic core, built once and reachable from the React, Vue, Svelte, Solid, and Angular adapters. Foreground/background position and heading, geocoding, motion activity, and geofencing.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -36,20 +36,20 @@
36
36
  "default": "./build/core/index.js"
37
37
  },
38
38
  "./vue": {
39
- "types": "./build/core/index.d.ts",
40
- "default": "./build/core/index.js"
39
+ "types": "./build/vue/index.d.ts",
40
+ "default": "./build/vue/index.js"
41
41
  },
42
42
  "./react": {
43
- "types": "./build/core/index.d.ts",
44
- "default": "./build/core/index.js"
43
+ "types": "./build/react/index.d.ts",
44
+ "default": "./build/react/index.js"
45
45
  },
46
46
  "./svelte": {
47
- "types": "./build/core/index.d.ts",
48
- "default": "./build/core/index.js"
47
+ "types": "./build/svelte/index.d.ts",
48
+ "default": "./build/svelte/index.js"
49
49
  },
50
50
  "./solid": {
51
- "types": "./build/core/index.d.ts",
52
- "default": "./build/core/index.js"
51
+ "types": "./build/solid/index.d.ts",
52
+ "default": "./build/solid/index.js"
53
53
  },
54
54
  "./angular": {
55
55
  "types": "./build-ngc/angular/index.d.ts",
@@ -71,7 +71,7 @@
71
71
  },
72
72
  "dependencies": {
73
73
  "expo-location": "57.0.15",
74
- "expo-modules-core": "57.0.5"
74
+ "expo-modules-core": "57.0.20"
75
75
  },
76
76
  "peerDependencies": {
77
77
  "@angular/core": ">=20",
@@ -81,12 +81,12 @@
81
81
  "solid-js": ">=1.9.0",
82
82
  "svelte": ">=5.56.0",
83
83
  "vue": ">=3.5.0",
84
- "@symbiote-native/angular": "^3.1.2",
85
- "@symbiote-native/engine": "^1.3.1",
86
- "@symbiote-native/react": "^3.0.4",
87
- "@symbiote-native/solid": "^3.0.4",
88
- "@symbiote-native/svelte": "^3.0.4",
89
- "@symbiote-native/vue": "^3.0.4"
84
+ "@symbiote-native/angular": "^3.2.0",
85
+ "@symbiote-native/engine": "^1.5.0",
86
+ "@symbiote-native/react": "^3.2.0",
87
+ "@symbiote-native/solid": "^3.1.0",
88
+ "@symbiote-native/svelte": "^3.1.0",
89
+ "@symbiote-native/vue": "^3.2.0"
90
90
  },
91
91
  "peerDependenciesMeta": {
92
92
  "@symbiote-native/angular": {
@@ -134,13 +134,13 @@
134
134
  "solid-js": "^1.9.14",
135
135
  "svelte": "^5.56.0",
136
136
  "typescript": "~6.0.0",
137
- "@symbiote-native/angular": "3.1.2",
138
- "@symbiote-native/engine": "1.3.1",
139
- "@symbiote-native/react": "3.0.4",
140
- "@symbiote-native/solid": "3.0.4",
141
- "@symbiote-native/svelte": "3.0.4",
142
- "@symbiote-native/test-utils": "0.4.4",
143
- "@symbiote-native/vue": "3.0.4"
137
+ "@symbiote-native/angular": "3.2.0",
138
+ "@symbiote-native/engine": "1.5.0",
139
+ "@symbiote-native/react": "3.2.0",
140
+ "@symbiote-native/solid": "3.1.0",
141
+ "@symbiote-native/svelte": "3.1.0",
142
+ "@symbiote-native/test-utils": "0.4.6",
143
+ "@symbiote-native/vue": "3.2.0"
144
144
  },
145
145
  "scripts": {
146
146
  "typecheck": "tsc --build",
@@ -1,4 +1,8 @@
1
- // @symbiote-native/location/angular: the Angular entry over the framework-agnostic core. Same
2
- // reasoning as the React/Vue entries — no per-instance state or event stream to wrap in a
3
- // service, so this is a plain re-export.
1
+ // @symbiote-native/location/angular: the core plus the permission services, the location
2
+ // streams need no service wrapper
4
3
  export * from '../core';
4
+ export {
5
+ ForegroundPermissionsService,
6
+ BackgroundPermissionsService,
7
+ MotionActivityPermissionsService,
8
+ } from './services/location-permissions.service';
@@ -0,0 +1,40 @@
1
+ import { Injectable } from '@angular/core';
2
+ import {
3
+ backgroundPermissionMethods,
4
+ foregroundPermissionMethods,
5
+ motionActivityPermissionMethods,
6
+ } from '../../core/location-permission-api';
7
+ import { PermissionsServiceBase } from '@symbiote-native/angular';
8
+ import type { ILocationPermissionResponse } from '../../core';
9
+ import type { PermissionResponse } from 'expo-modules-core';
10
+
11
+ // Angular twin of `../../react`'s location permission hooks
12
+ @Injectable({ providedIn: 'root' })
13
+ export class ForegroundPermissionsService extends PermissionsServiceBase<ILocationPermissionResponse> {
14
+ constructor() {
15
+ super(
16
+ foregroundPermissionMethods.getMethod,
17
+ foregroundPermissionMethods.requestMethod,
18
+ );
19
+ }
20
+ }
21
+
22
+ @Injectable({ providedIn: 'root' })
23
+ export class BackgroundPermissionsService extends PermissionsServiceBase<PermissionResponse> {
24
+ constructor() {
25
+ super(
26
+ backgroundPermissionMethods.getMethod,
27
+ backgroundPermissionMethods.requestMethod,
28
+ );
29
+ }
30
+ }
31
+
32
+ @Injectable({ providedIn: 'root' })
33
+ export class MotionActivityPermissionsService extends PermissionsServiceBase<PermissionResponse> {
34
+ constructor() {
35
+ super(
36
+ motionActivityPermissionMethods.getMethod,
37
+ motionActivityPermissionMethods.requestMethod,
38
+ );
39
+ }
40
+ }
@@ -0,0 +1,82 @@
1
+ import { Platform } from 'expo-modules-core';
2
+ import { expoLocation } from './native-module';
3
+ import { locationSubscriber } from './subscribers';
4
+ import { LocationAccuracy } from './types';
5
+ import type { ILocationObject, ILocationOptions } from './types';
6
+
7
+ type IGeolocationSuccessCallback = (data: ILocationObject) => void;
8
+ type IGeolocationErrorCallback = (error: unknown) => void;
9
+ type IGeolocationOptions = { enableHighAccuracy?: boolean };
10
+
11
+ // Native watch failures carry a `code` beyond `Error`
12
+ type INativeWatchError = { message?: string; code?: string };
13
+
14
+ function convertGeolocationOptions(
15
+ options: IGeolocationOptions,
16
+ ): ILocationOptions {
17
+ return {
18
+ accuracy: options.enableHighAccuracy
19
+ ? LocationAccuracy.High
20
+ : LocationAccuracy.Balanced,
21
+ };
22
+ }
23
+
24
+ async function requestCurrentPosition(
25
+ success: IGeolocationSuccessCallback,
26
+ error: IGeolocationErrorCallback,
27
+ options: IGeolocationOptions,
28
+ ): Promise<void> {
29
+ try {
30
+ await expoLocation.requestPermissionsAsync();
31
+ success(
32
+ await expoLocation.getCurrentPositionAsync(
33
+ convertGeolocationOptions(options),
34
+ ),
35
+ );
36
+ } catch (cause) {
37
+ error(cause);
38
+ }
39
+ }
40
+
41
+ // Returns undefined like the web API, the async work runs detached and reports through `error`
42
+ function getCurrentPosition(
43
+ success: IGeolocationSuccessCallback,
44
+ error: IGeolocationErrorCallback = () => {},
45
+ options: IGeolocationOptions = {},
46
+ ): void {
47
+ void requestCurrentPosition(success, error, options);
48
+ }
49
+
50
+ function watchPosition(
51
+ success: IGeolocationSuccessCallback,
52
+ error: IGeolocationErrorCallback = () => {},
53
+ options: IGeolocationOptions = {},
54
+ ): number {
55
+ const watchId = locationSubscriber.registerCallback(success);
56
+ expoLocation
57
+ .watchPositionImplAsync(watchId, convertGeolocationOptions(options))
58
+ .catch((cause: INativeWatchError) => {
59
+ locationSubscriber.unregisterCallback(watchId);
60
+ error({ watchId, message: cause.message, code: cause.code });
61
+ });
62
+ return watchId;
63
+ }
64
+
65
+ function clearWatch(watchId: number): void {
66
+ locationSubscriber.unregisterCallback(watchId);
67
+ }
68
+
69
+ /** Polyfills `navigator.geolocation` for interop with the React Native and Web geolocation API. */
70
+ export function installWebGeolocationPolyfill(): void {
71
+ if (Platform.OS === 'web') return;
72
+ if (!Reflect.has(globalThis, 'window'))
73
+ Reflect.set(globalThis, 'window', globalThis);
74
+ const windowObject: object = Reflect.get(globalThis, 'window');
75
+ if (!Reflect.has(windowObject, 'navigator'))
76
+ Reflect.set(windowObject, 'navigator', {});
77
+ Reflect.set(Reflect.get(windowObject, 'navigator'), 'geolocation', {
78
+ getCurrentPosition,
79
+ watchPosition,
80
+ clearWatch,
81
+ });
82
+ }
package/src/core/index.ts CHANGED
@@ -5,6 +5,7 @@ export {
5
5
  } from 'expo-modules-core';
6
6
 
7
7
  export { getCurrentWatchId } from './subscribers';
8
+ export { installWebGeolocationPolyfill } from './geolocation-polyfill';
8
9
 
9
10
  export * from './location';
10
11
  export * from './types';
@@ -0,0 +1,26 @@
1
+ // `methods` every adapter's location permission hooks bind to the shared
2
+ // `@symbiote-native/{react,vue,solid,svelte}` `createPermissionHook` factory
3
+
4
+ import {
5
+ getBackgroundPermissionsAsync,
6
+ getForegroundPermissionsAsync,
7
+ getMotionActivityPermissionsAsync,
8
+ requestBackgroundPermissionsAsync,
9
+ requestForegroundPermissionsAsync,
10
+ requestMotionActivityPermissionsAsync,
11
+ } from './location';
12
+
13
+ export const foregroundPermissionMethods = {
14
+ getMethod: getForegroundPermissionsAsync,
15
+ requestMethod: requestForegroundPermissionsAsync,
16
+ };
17
+
18
+ export const backgroundPermissionMethods = {
19
+ getMethod: getBackgroundPermissionsAsync,
20
+ requestMethod: requestBackgroundPermissionsAsync,
21
+ };
22
+
23
+ export const motionActivityPermissionMethods = {
24
+ getMethod: getMotionActivityPermissionsAsync,
25
+ requestMethod: requestMotionActivityPermissionsAsync,
26
+ };
@@ -1,4 +1,4 @@
1
- import { createPermissionHook, Platform } from 'expo-modules-core';
1
+ import { Platform } from 'expo-modules-core';
2
2
  import { expoLocation } from './native-module';
3
3
  import {
4
4
  headingSubscriber,
@@ -147,11 +147,6 @@ export async function requestForegroundPermissionsAsync(): Promise<ILocationPerm
147
147
  return expoLocation.requestForegroundPermissionsAsync();
148
148
  }
149
149
 
150
- export const useForegroundPermissions = createPermissionHook({
151
- getMethod: getForegroundPermissionsAsync,
152
- requestMethod: requestForegroundPermissionsAsync,
153
- });
154
-
155
150
  export async function getBackgroundPermissionsAsync(): Promise<PermissionResponse> {
156
151
  return expoLocation.getBackgroundPermissionsAsync();
157
152
  }
@@ -160,11 +155,6 @@ export async function requestBackgroundPermissionsAsync(): Promise<PermissionRes
160
155
  return expoLocation.requestBackgroundPermissionsAsync();
161
156
  }
162
157
 
163
- export const useBackgroundPermissions = createPermissionHook({
164
- getMethod: getBackgroundPermissionsAsync,
165
- requestMethod: requestBackgroundPermissionsAsync,
166
- });
167
-
168
158
  export async function hasServicesEnabledAsync(): Promise<boolean> {
169
159
  return expoLocation.hasServicesEnabledAsync();
170
160
  }
@@ -177,11 +167,6 @@ export async function requestMotionActivityPermissionsAsync(): Promise<Permissio
177
167
  return expoLocation.requestMotionActivityPermissionsAsync();
178
168
  }
179
169
 
180
- export const useMotionActivityPermissions = createPermissionHook({
181
- getMethod: getMotionActivityPermissionsAsync,
182
- requestMethod: requestMotionActivityPermissionsAsync,
183
- });
184
-
185
170
  /** No location permission required — uses Play Services activity recognition / the iOS motion
186
171
  * coprocessor directly. */
187
172
  export async function getMotionActivityAsync(): Promise<IMotionActivityObject> {
@@ -21,6 +21,7 @@ export type INativeLocationModule = {
21
21
  ): EventSubscription;
22
22
  getProviderStatusAsync(): Promise<ILocationProviderStatus>;
23
23
  enableNetworkProviderAsync(): Promise<void>;
24
+ requestPermissionsAsync(): Promise<void>;
24
25
  getCurrentPositionAsync(options: ILocationOptions): Promise<ILocationObject>;
25
26
  getLastKnownPositionAsync(
26
27
  options: ILocationLastKnownOptions,
@@ -0,0 +1,6 @@
1
+ export * from '../core';
2
+ export {
3
+ useForegroundPermissions,
4
+ useBackgroundPermissions,
5
+ useMotionActivityPermissions,
6
+ } from './use-location-permissions';