react-native-geo-activity-kit 2.0.4 → 2.0.5

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.
@@ -1,35 +1,47 @@
1
1
  "use strict";
2
2
 
3
- import { NativeModules, NativeEventEmitter } from 'react-native';
4
- const LINKING_ERROR = `The package 'react-native-geo-activity-kit' doesn't seem to be linked. Make sure: \n\n` + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
5
- const RNSensorModule = NativeModules.RNSensorModule ? NativeModules.RNSensorModule : new Proxy({}, {
3
+ import { NativeModules, NativeEventEmitter, Platform } from 'react-native';
4
+ // Fixed: Modern Type & Correct Import
5
+
6
+ const LINKING_ERROR = `The package 'react-native-geo-activity-kit' doesn't seem to be linked. Make sure: \n\n` + Platform.select({
7
+ ios: "- You have run 'pod install'\n",
8
+ default: ''
9
+ }) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
10
+
11
+ // 1. Point to the CORRECT Native Module Name
12
+ const GeoActivityKit = NativeModules.GeoActivityKit ? NativeModules.GeoActivityKit : new Proxy({}, {
6
13
  get() {
7
14
  throw new Error(LINKING_ERROR);
8
15
  }
9
16
  });
10
- const emitter = new NativeEventEmitter(RNSensorModule);
17
+ const emitter = new NativeEventEmitter(GeoActivityKit);
18
+
19
+ // 2. Define Types
20
+
21
+ // 3. Export the Object
11
22
  export default {
12
- // Service Control
13
- startForegroundService: (title, body) => RNSensorModule.startForegroundService(title, body),
14
- stopForegroundService: () => RNSensorModule.stopForegroundService(),
15
- updateServiceNotification: (title, body) => RNSensorModule.updateServiceNotification(title, body),
16
- // Sensors & Configuration
17
- startMotionDetector: (threshold = 0.8) => RNSensorModule.startMotionDetector(threshold),
18
- stopMotionDetector: () => RNSensorModule.stopMotionDetector(),
19
- setUpdateInterval: (ms = 100) => RNSensorModule.setUpdateInterval(ms),
20
- setLocationUpdateInterval: (ms = 90000) => RNSensorModule.setLocationUpdateInterval(ms),
21
- setStabilityThresholds: (start = 20, stop = 3000) => RNSensorModule.setStabilityThresholds(start, stop),
22
- // Alerts
23
- fireGeofenceAlert: (type, userName) => RNSensorModule.fireGeofenceAlert(type, userName),
24
- fireGenericAlert: (title, body, id) => RNSensorModule.fireGenericAlert(title, body, id),
25
- cancelGenericAlert: id => RNSensorModule.cancelGenericAlert(id),
26
- isAvailable: () => RNSensorModule.isAvailable(),
27
- // --- NEW GPS HARDWARE METHODS ---
28
- registerGpsListener: () => RNSensorModule.registerGpsListener(),
23
+ // --- Service Control ---
24
+ startForegroundService: (title, body, id) => GeoActivityKit.startForegroundService(title, body, id),
25
+ stopForegroundService: () => GeoActivityKit.stopForegroundService(),
26
+ updateServiceNotification: (title, body) => GeoActivityKit.updateServiceNotification(title, body),
27
+ // --- Motion & Intelligence ---
28
+ startMotionDetector: (confidence = 75) => GeoActivityKit.startMotionDetector(confidence),
29
+ stopMotionDetector: () => GeoActivityKit.stopMotionDetector(),
30
+ // --- Location Control ---
31
+ setLocationUpdateInterval: ms => GeoActivityKit.setLocationUpdateInterval(ms),
32
+ // --- Alerts & Notifications ---
33
+ fireGeofenceAlert: (type, userName) => GeoActivityKit.fireGeofenceAlert(type, userName),
34
+ fireGenericAlert: (title, body, id) => GeoActivityKit.fireGenericAlert(title, body, id),
35
+ cancelGenericAlert: id => GeoActivityKit.cancelGenericAlert(id),
36
+ // --- GPS Status ---
37
+ registerGpsListener: () => GeoActivityKit.registerGpsListener(),
38
+ // --- Event Listeners ---
39
+ // Note: We cast event to 'any' to avoid TS strict object checks,
40
+ // and return EventSubscription (modern) instead of EmitterSubscription (deprecated).
41
+
29
42
  addGpsStatusListener: cb => emitter.addListener('onGpsStatusChanged', event => cb(event)),
30
- // Listeners
31
- addMotionListener: cb => emitter.addListener('onMotionStateChanged', cb),
32
- addLocationLogListener: cb => emitter.addListener('onLocationLog', cb),
33
- addLocationErrorListener: cb => emitter.addListener('onLocationError', cb)
43
+ addMotionListener: cb => emitter.addListener('onMotionStateChanged', event => cb(event)),
44
+ addLocationLogListener: cb => emitter.addListener('onLocationLog', event => cb(event)),
45
+ addLocationErrorListener: cb => emitter.addListener('onLocationError', event => cb(event))
34
46
  };
35
47
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["NativeModules","NativeEventEmitter","LINKING_ERROR","RNSensorModule","Proxy","get","Error","emitter","startForegroundService","title","body","stopForegroundService","updateServiceNotification","startMotionDetector","threshold","stopMotionDetector","setUpdateInterval","ms","setLocationUpdateInterval","setStabilityThresholds","start","stop","fireGeofenceAlert","type","userName","fireGenericAlert","id","cancelGenericAlert","isAvailable","registerGpsListener","addGpsStatusListener","cb","addListener","event","addMotionListener","addLocationLogListener","addLocationErrorListener"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,aAAa,EAAEC,kBAAkB,QAAQ,cAAc;AAEhE,MAAMC,aAAa,GACjB,wFAAwF,GACxF,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,cAAc,GAAGH,aAAa,CAACG,cAAc,GAC/CH,aAAa,CAACG,cAAc,GAC5B,IAAIC,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACJ,aAAa,CAAC;EAChC;AACF,CACF,CAAC;AAEL,MAAMK,OAAO,GAAG,IAAIN,kBAAkB,CAACE,cAAc,CAAC;AAEtD,eAAe;EACb;EACAK,sBAAsB,EAAEA,CAACC,KAAa,EAAEC,IAAY,KAClDP,cAAc,CAACK,sBAAsB,CAACC,KAAK,EAAEC,IAAI,CAAC;EAEpDC,qBAAqB,EAAEA,CAAA,KACrBR,cAAc,CAACQ,qBAAqB,CAAC,CAAC;EAExCC,yBAAyB,EAAEA,CAACH,KAAa,EAAEC,IAAY,KACrDP,cAAc,CAACS,yBAAyB,CAACH,KAAK,EAAEC,IAAI,CAAC;EAEvD;EACAG,mBAAmB,EAAEA,CAACC,SAAiB,GAAG,GAAG,KAC3CX,cAAc,C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wBAAwB,EAAGL,EAAwB,IACjDxB,OAAO,CAACyB,WAAW,CAAC,iBAAiB,EAAED,EAAE;AAC7C,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["NativeModules","NativeEventEmitter","Platform","LINKING_ERROR","select","ios","default","GeoActivityKit","Proxy","get","Error","emitter","startForegroundService","title","body","id","stopForegroundService","updateServiceNotification","startMotionDetector","confidence","stopMotionDetector","setLocationUpdateInterval","ms","fireGeofenceAlert","type","userName","fireGenericAlert","cancelGenericAlert","registerGpsListener","addGpsStatusListener","cb","addListener","event","addMotionListener","addLocationLogListener","addLocationErrorListener"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,aAAa,EAAEC,kBAAkB,EAAEC,QAAQ,QAAQ,cAAc;AACnB;;AAEvD,MAAMC,aAAa,GACjB,wFAAwF,GACxFD,QAAQ,CAACE,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;;AAEjC;AACA,MAAMC,cAAc,GAAGP,aAAa,CAACO,cAAc,GAC/CP,aAAa,CAACO,cAAc,GAC5B,IAAIC,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACP,aAAa,CAAC;EAChC;AACF,CACF,CAAC;AAEL,MAAMQ,OAAO,GAAG,IAAIV,kBAAkB,CAACM,cAAc,CAAC;;AAEtD;;AAoBA;AACA,eAAe;EACb;EACAK,sBAAsB,EAAEA,CAACC,KAAa,EAAEC,IAAY,EAAEC,EAAU,KAC9DR,cAAc,CAACK,sBAAsB,CAACC,KAAK,EAAEC,IAAI,EAAEC,EAAE,CAAC;EAExDC,qBAAqB,EAAEA,CAAA,KACrBT,cAAc,CAACS,qBAAqB,CAAC,CAAC;EAExCC,yBAAyB,EAAEA,CAACJ,KAAa,EAAEC,IAAY,KACrDP,cAAc,CAACU,yBAAyB,CAACJ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37 @@
1
+ import type { EventSubscription } from 'react-native';
2
+ export interface LocationEvent {
3
+ latitude: number;
4
+ longitude: number;
5
+ accuracy: number;
6
+ timestamp: string;
7
+ is_mock: boolean;
8
+ }
9
+ export interface MotionEvent {
10
+ activity: 'STILL' | 'WALKING' | 'RUNNING' | 'ON_BICYCLE' | 'IN_VEHICLE' | 'UNKNOWN';
11
+ isMoving: boolean;
12
+ state: 'MOVING' | 'STATIONARY';
13
+ }
14
+ export interface ErrorEvent {
15
+ error: string;
16
+ message: string;
17
+ }
1
18
  declare const _default: {
2
- startForegroundService: (title: string, body: string) => Promise<boolean>;
19
+ startForegroundService: (title: string, body: string, id: number) => Promise<boolean>;
3
20
  stopForegroundService: () => Promise<boolean>;
4
21
  updateServiceNotification: (title: string, body: string) => Promise<boolean>;
5
- startMotionDetector: (threshold?: number) => any;
6
- stopMotionDetector: () => any;
7
- setUpdateInterval: (ms?: number) => any;
8
- setLocationUpdateInterval: (ms?: number) => any;
9
- setStabilityThresholds: (start?: number, stop?: number) => any;
10
- fireGeofenceAlert: (type: string, userName: string) => any;
11
- fireGenericAlert: (title: string, body: string, id: number) => any;
12
- cancelGenericAlert: (id: number) => any;
13
- isAvailable: () => any;
22
+ startMotionDetector: (confidence?: number) => Promise<boolean>;
23
+ stopMotionDetector: () => Promise<boolean>;
24
+ setLocationUpdateInterval: (ms: number) => Promise<void>;
25
+ fireGeofenceAlert: (type: "IN" | "OUT", userName: string) => Promise<boolean>;
26
+ fireGenericAlert: (title: string, body: string, id: number) => Promise<boolean>;
27
+ cancelGenericAlert: (id: number) => Promise<boolean>;
14
28
  registerGpsListener: () => Promise<boolean>;
15
29
  addGpsStatusListener: (cb: (event: {
16
30
  enabled: boolean;
17
- }) => void) => import("react-native").EventSubscription;
18
- addMotionListener: (cb: (event: any) => void) => import("react-native").EventSubscription;
19
- addLocationLogListener: (cb: (event: any) => void) => import("react-native").EventSubscription;
20
- addLocationErrorListener: (cb: (event: any) => void) => import("react-native").EventSubscription;
31
+ }) => void) => EventSubscription;
32
+ addMotionListener: (cb: (event: MotionEvent) => void) => EventSubscription;
33
+ addLocationLogListener: (cb: (event: LocationEvent) => void) => EventSubscription;
34
+ addLocationErrorListener: (cb: (event: ErrorEvent) => void) => EventSubscription;
21
35
  };
22
36
  export default _default;
23
37
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":";oCAsBkC,MAAM,QAAQ,MAAM,KAAG,OAAO,CAAC,OAAO,CAAC;iCAG5C,OAAO,CAAC,OAAO,CAAC;uCAGR,MAAM,QAAQ,MAAM,KAAG,OAAO,CAAC,OAAO,CAAC;sCAIzC,MAAM;;6BAKf,MAAM;qCAEE,MAAM;qCAGN,MAAM,SAAa,MAAM;8BAI/B,MAAM,YAAY,MAAM;8BAGxB,MAAM,QAAQ,MAAM,MAAM,MAAM;6BAGjC,MAAM;;+BAKN,OAAO,CAAC,OAAO,CAAC;+BAGd,CAAC,KAAK,EAAE;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,KAAK,IAAI;4BAIxC,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI;iCAGf,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI;mCAGlB,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI;;AAlDrD,wBAoDE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAuBtD,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,OAAO,GAAG,SAAS,GAAG,SAAS,GAAG,YAAY,GAAG,YAAY,GAAG,SAAS,CAAC;IACpF,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,QAAQ,GAAG,YAAY,CAAC;CAChC;AAED,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACjB;;oCAKiC,MAAM,QAAQ,MAAM,MAAM,MAAM,KAAG,OAAO,CAAC,OAAO,CAAC;iCAGxD,OAAO,CAAC,OAAO,CAAC;uCAGR,MAAM,QAAQ,MAAM,KAAG,OAAO,CAAC,OAAO,CAAC;uCAIxC,MAAM,KAAQ,OAAO,CAAC,OAAO,CAAC;8BAGxC,OAAO,CAAC,OAAO,CAAC;oCAIR,MAAM,KAAG,OAAO,CAAC,IAAI,CAAC;8BAI5B,IAAI,GAAG,KAAK,YAAY,MAAM,KAAG,OAAO,CAAC,OAAO,CAAC;8BAGjD,MAAM,QAAQ,MAAM,MAAM,MAAM,KAAG,OAAO,CAAC,OAAO,CAAC;6BAGpD,MAAM,KAAG,OAAO,CAAC,OAAO,CAAC;+BAIzB,OAAO,CAAC,OAAO,CAAC;+BAOd,CAAC,KAAK,EAAE;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,KAAK,IAAI,KAAG,iBAAiB;4BAG5D,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,KAAG,iBAAiB;iCAG3C,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,KAAG,iBAAiB;mCAGhD,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,KAAG,iBAAiB;;AAjDhF,wBAmDE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-geo-activity-kit",
3
- "version": "2.0.4",
3
+ "version": "2.0.5",
4
4
  "description": "Battery-efficient location tracking with motion detection and native notifications.",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
package/src/index.tsx CHANGED
@@ -1,12 +1,15 @@
1
- import { NativeModules, NativeEventEmitter } from 'react-native';
1
+ import { NativeModules, NativeEventEmitter, Platform } from 'react-native';
2
+ import type { EventSubscription } from 'react-native'; // ✅ Fixed: Modern Type & Correct Import
2
3
 
3
4
  const LINKING_ERROR =
4
5
  `The package 'react-native-geo-activity-kit' doesn't seem to be linked. Make sure: \n\n` +
6
+ Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
5
7
  '- You rebuilt the app after installing the package\n' +
6
8
  '- You are not using Expo Go\n';
7
9
 
8
- const RNSensorModule = NativeModules.RNSensorModule
9
- ? NativeModules.RNSensorModule
10
+ // 1. Point to the CORRECT Native Module Name
11
+ const GeoActivityKit = NativeModules.GeoActivityKit
12
+ ? NativeModules.GeoActivityKit
10
13
  : new Proxy(
11
14
  {},
12
15
  {
@@ -16,58 +19,78 @@ const RNSensorModule = NativeModules.RNSensorModule
16
19
  }
17
20
  );
18
21
 
19
- const emitter = new NativeEventEmitter(RNSensorModule);
20
-
22
+ const emitter = new NativeEventEmitter(GeoActivityKit);
23
+
24
+ // 2. Define Types
25
+ export interface LocationEvent {
26
+ latitude: number;
27
+ longitude: number;
28
+ accuracy: number;
29
+ timestamp: string;
30
+ is_mock: boolean;
31
+ }
32
+
33
+ export interface MotionEvent {
34
+ activity: 'STILL' | 'WALKING' | 'RUNNING' | 'ON_BICYCLE' | 'IN_VEHICLE' | 'UNKNOWN';
35
+ isMoving: boolean;
36
+ state: 'MOVING' | 'STATIONARY';
37
+ }
38
+
39
+ export interface ErrorEvent {
40
+ error: string;
41
+ message: string;
42
+ }
43
+
44
+ // 3. Export the Object
21
45
  export default {
22
- // Service Control
23
- startForegroundService: (title: string, body: string): Promise<boolean> =>
24
- RNSensorModule.startForegroundService(title, body),
46
+ // --- Service Control ---
47
+ startForegroundService: (title: string, body: string, id: number): Promise<boolean> =>
48
+ GeoActivityKit.startForegroundService(title, body, id),
25
49
 
26
50
  stopForegroundService: (): Promise<boolean> =>
27
- RNSensorModule.stopForegroundService(),
51
+ GeoActivityKit.stopForegroundService(),
28
52
 
29
53
  updateServiceNotification: (title: string, body: string): Promise<boolean> =>
30
- RNSensorModule.updateServiceNotification(title, body),
31
-
32
- // Sensors & Configuration
33
- startMotionDetector: (threshold: number = 0.8) =>
34
- RNSensorModule.startMotionDetector(threshold),
35
-
36
- stopMotionDetector: () => RNSensorModule.stopMotionDetector(),
37
-
38
- setUpdateInterval: (ms: number = 100) => RNSensorModule.setUpdateInterval(ms),
54
+ GeoActivityKit.updateServiceNotification(title, body),
39
55
 
40
- setLocationUpdateInterval: (ms: number = 90000) =>
41
- RNSensorModule.setLocationUpdateInterval(ms),
56
+ // --- Motion & Intelligence ---
57
+ startMotionDetector: (confidence: number = 75): Promise<boolean> =>
58
+ GeoActivityKit.startMotionDetector(confidence),
42
59
 
43
- setStabilityThresholds: (start: number = 20, stop: number = 3000) =>
44
- RNSensorModule.setStabilityThresholds(start, stop),
60
+ stopMotionDetector: (): Promise<boolean> =>
61
+ GeoActivityKit.stopMotionDetector(),
45
62
 
46
- // Alerts
47
- fireGeofenceAlert: (type: string, userName: string) =>
48
- RNSensorModule.fireGeofenceAlert(type, userName),
63
+ // --- Location Control ---
64
+ setLocationUpdateInterval: (ms: number): Promise<void> =>
65
+ GeoActivityKit.setLocationUpdateInterval(ms),
49
66
 
50
- fireGenericAlert: (title: string, body: string, id: number) =>
51
- RNSensorModule.fireGenericAlert(title, body, id),
67
+ // --- Alerts & Notifications ---
68
+ fireGeofenceAlert: (type: 'IN' | 'OUT', userName: string): Promise<boolean> =>
69
+ GeoActivityKit.fireGeofenceAlert(type, userName),
52
70
 
53
- cancelGenericAlert: (id: number) => RNSensorModule.cancelGenericAlert(id),
71
+ fireGenericAlert: (title: string, body: string, id: number): Promise<boolean> =>
72
+ GeoActivityKit.fireGenericAlert(title, body, id),
54
73
 
55
- isAvailable: () => RNSensorModule.isAvailable(),
74
+ cancelGenericAlert: (id: number): Promise<boolean> =>
75
+ GeoActivityKit.cancelGenericAlert(id),
56
76
 
57
- // --- NEW GPS HARDWARE METHODS ---
77
+ // --- GPS Status ---
58
78
  registerGpsListener: (): Promise<boolean> =>
59
- RNSensorModule.registerGpsListener(),
79
+ GeoActivityKit.registerGpsListener(),
60
80
 
61
- addGpsStatusListener: (cb: (event: { enabled: boolean }) => void) =>
81
+ // --- Event Listeners ---
82
+ // Note: We cast event to 'any' to avoid TS strict object checks,
83
+ // and return EventSubscription (modern) instead of EmitterSubscription (deprecated).
84
+
85
+ addGpsStatusListener: (cb: (event: { enabled: boolean }) => void): EventSubscription =>
62
86
  emitter.addListener('onGpsStatusChanged', (event: any) => cb(event)),
63
87
 
64
- // Listeners
65
- addMotionListener: (cb: (event: any) => void) =>
66
- emitter.addListener('onMotionStateChanged', cb),
88
+ addMotionListener: (cb: (event: MotionEvent) => void): EventSubscription =>
89
+ emitter.addListener('onMotionStateChanged', (event: any) => cb(event)),
67
90
 
68
- addLocationLogListener: (cb: (event: any) => void) =>
69
- emitter.addListener('onLocationLog', cb),
91
+ addLocationLogListener: (cb: (event: LocationEvent) => void): EventSubscription =>
92
+ emitter.addListener('onLocationLog', (event: any) => cb(event)),
70
93
 
71
- addLocationErrorListener: (cb: (event: any) => void) =>
72
- emitter.addListener('onLocationError', cb),
73
- };
94
+ addLocationErrorListener: (cb: (event: ErrorEvent) => void): EventSubscription =>
95
+ emitter.addListener('onLocationError', (event: any) => cb(event)),
96
+ };