react-native-geo-activity-kit 2.0.2 → 2.0.4
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/lib/module/index.js
CHANGED
|
@@ -1,29 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { NativeModules,
|
|
4
|
-
const LINKING_ERROR = `The package 'react-native-geo-activity-kit' doesn't seem to be linked. Make sure: \n\n` +
|
|
5
|
-
|
|
6
|
-
default: ''
|
|
7
|
-
}) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
|
|
8
|
-
const GeoActivityKit = NativeModules.GeoActivityKit ? NativeModules.GeoActivityKit : new Proxy({}, {
|
|
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({}, {
|
|
9
6
|
get() {
|
|
10
7
|
throw new Error(LINKING_ERROR);
|
|
11
8
|
}
|
|
12
9
|
});
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
10
|
+
const emitter = new NativeEventEmitter(RNSensorModule);
|
|
11
|
+
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(),
|
|
29
|
+
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)
|
|
34
|
+
};
|
|
29
35
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeModules","
|
|
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","addL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it;
|
|
1
|
+
declare const _default: {
|
|
2
|
+
startForegroundService: (title: string, body: string) => Promise<boolean>;
|
|
3
|
+
stopForegroundService: () => Promise<boolean>;
|
|
4
|
+
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;
|
|
14
|
+
registerGpsListener: () => Promise<boolean>;
|
|
15
|
+
addGpsStatusListener: (cb: (event: {
|
|
16
|
+
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;
|
|
21
|
+
};
|
|
22
|
+
export default _default;
|
|
24
23
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"
|
|
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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-geo-activity-kit",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.4",
|
|
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,13 +1,12 @@
|
|
|
1
|
-
import { NativeModules,
|
|
1
|
+
import { NativeModules, NativeEventEmitter } from 'react-native';
|
|
2
2
|
|
|
3
3
|
const LINKING_ERROR =
|
|
4
4
|
`The package 'react-native-geo-activity-kit' doesn't seem to be linked. Make sure: \n\n` +
|
|
5
|
-
Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
|
|
6
5
|
'- You rebuilt the app after installing the package\n' +
|
|
7
6
|
'- You are not using Expo Go\n';
|
|
8
7
|
|
|
9
|
-
const
|
|
10
|
-
? NativeModules.
|
|
8
|
+
const RNSensorModule = NativeModules.RNSensorModule
|
|
9
|
+
? NativeModules.RNSensorModule
|
|
11
10
|
: new Proxy(
|
|
12
11
|
{},
|
|
13
12
|
{
|
|
@@ -17,53 +16,58 @@ const GeoActivityKit = NativeModules.GeoActivityKit
|
|
|
17
16
|
}
|
|
18
17
|
);
|
|
19
18
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
)
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
19
|
+
const emitter = new NativeEventEmitter(RNSensorModule);
|
|
20
|
+
|
|
21
|
+
export default {
|
|
22
|
+
// Service Control
|
|
23
|
+
startForegroundService: (title: string, body: string): Promise<boolean> =>
|
|
24
|
+
RNSensorModule.startForegroundService(title, body),
|
|
25
|
+
|
|
26
|
+
stopForegroundService: (): Promise<boolean> =>
|
|
27
|
+
RNSensorModule.stopForegroundService(),
|
|
28
|
+
|
|
29
|
+
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),
|
|
39
|
+
|
|
40
|
+
setLocationUpdateInterval: (ms: number = 90000) =>
|
|
41
|
+
RNSensorModule.setLocationUpdateInterval(ms),
|
|
42
|
+
|
|
43
|
+
setStabilityThresholds: (start: number = 20, stop: number = 3000) =>
|
|
44
|
+
RNSensorModule.setStabilityThresholds(start, stop),
|
|
45
|
+
|
|
46
|
+
// Alerts
|
|
47
|
+
fireGeofenceAlert: (type: string, userName: string) =>
|
|
48
|
+
RNSensorModule.fireGeofenceAlert(type, userName),
|
|
49
|
+
|
|
50
|
+
fireGenericAlert: (title: string, body: string, id: number) =>
|
|
51
|
+
RNSensorModule.fireGenericAlert(title, body, id),
|
|
52
|
+
|
|
53
|
+
cancelGenericAlert: (id: number) => RNSensorModule.cancelGenericAlert(id),
|
|
54
|
+
|
|
55
|
+
isAvailable: () => RNSensorModule.isAvailable(),
|
|
56
|
+
|
|
57
|
+
// --- NEW GPS HARDWARE METHODS ---
|
|
58
|
+
registerGpsListener: (): Promise<boolean> =>
|
|
59
|
+
RNSensorModule.registerGpsListener(),
|
|
60
|
+
|
|
61
|
+
addGpsStatusListener: (cb: (event: { enabled: boolean }) => void) =>
|
|
62
|
+
emitter.addListener('onGpsStatusChanged', (event: any) => cb(event)),
|
|
63
|
+
|
|
64
|
+
// Listeners
|
|
65
|
+
addMotionListener: (cb: (event: any) => void) =>
|
|
66
|
+
emitter.addListener('onMotionStateChanged', cb),
|
|
67
|
+
|
|
68
|
+
addLocationLogListener: (cb: (event: any) => void) =>
|
|
69
|
+
emitter.addListener('onLocationLog', cb),
|
|
70
|
+
|
|
71
|
+
addLocationErrorListener: (cb: (event: any) => void) =>
|
|
72
|
+
emitter.addListener('onLocationError', cb),
|
|
73
|
+
};
|