react-native-geo-activity-kit 1.2.5 → 2.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/lib/module/index.js +22 -45
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/index.d.ts +23 -36
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/index.tsx +54 -73
package/lib/module/index.js
CHANGED
|
@@ -1,52 +1,29 @@
|
|
|
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
|
-
|
|
3
|
+
import { NativeModules, Platform } from 'react-native';
|
|
4
|
+
const LINKING_ERROR = `The package 'react-native-geo-activity-kit' doesn't seem to be linked. Make sure: \n\n` + Platform.select({
|
|
5
|
+
ios: "- You have run 'pod install'\n",
|
|
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({}, {
|
|
6
9
|
get() {
|
|
7
10
|
throw new Error(LINKING_ERROR);
|
|
8
11
|
}
|
|
9
12
|
});
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
// --- GPS STATUS ---
|
|
27
|
-
registerGpsListener: () => RNSensorModule.registerGpsListener(),
|
|
28
|
-
addGpsStatusListener: cb => emitter.addListener('onGpsStatusChanged', event => cb(event)),
|
|
29
|
-
// --- EVENT LISTENERS ---
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Returns:
|
|
33
|
-
* {
|
|
34
|
-
* activity: "WALKING" | "STILL" | "IN_VEHICLE" ...,
|
|
35
|
-
* isMoving: boolean,
|
|
36
|
-
* state: "MOVING" | "STATIONARY" (Legacy support)
|
|
37
|
-
* }
|
|
38
|
-
*/
|
|
39
|
-
addMotionListener: cb => emitter.addListener('onMotionStateChanged', cb),
|
|
40
|
-
/**
|
|
41
|
-
* Returns:
|
|
42
|
-
* {
|
|
43
|
-
* latitude: number,
|
|
44
|
-
* longitude: number,
|
|
45
|
-
* accuracy: number,
|
|
46
|
-
* is_mock: boolean (NEW: Detects Fake GPS)
|
|
47
|
-
* }
|
|
48
|
-
*/
|
|
49
|
-
addLocationLogListener: cb => emitter.addListener('onLocationLog', cb),
|
|
50
|
-
addLocationErrorListener: cb => emitter.addListener('onLocationError', cb)
|
|
51
|
-
};
|
|
13
|
+
export function startForegroundService(title, body, id) {
|
|
14
|
+
return GeoActivityKit.startForegroundService(title, body, id);
|
|
15
|
+
}
|
|
16
|
+
export function stopForegroundService() {
|
|
17
|
+
return GeoActivityKit.stopForegroundService();
|
|
18
|
+
}
|
|
19
|
+
export function startMotionDetector(confidence) {
|
|
20
|
+
return GeoActivityKit.startMotionDetector(confidence);
|
|
21
|
+
}
|
|
22
|
+
export function stopMotionDetector() {
|
|
23
|
+
return GeoActivityKit.stopMotionDetector();
|
|
24
|
+
}
|
|
25
|
+
export function setLocationUpdateInterval(intervalMs) {
|
|
26
|
+
return GeoActivityKit.setLocationUpdateInterval(intervalMs);
|
|
27
|
+
}
|
|
28
|
+
export default GeoActivityKit;
|
|
52
29
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeModules","
|
|
1
|
+
{"version":3,"names":["NativeModules","Platform","LINKING_ERROR","select","ios","default","GeoActivityKit","Proxy","get","Error","startForegroundService","title","body","id","stopForegroundService","startMotionDetector","confidence","stopMotionDetector","setLocationUpdateInterval","intervalMs"],"sourceRo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-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Returns:
|
|
26
|
-
* {
|
|
27
|
-
* latitude: number,
|
|
28
|
-
* longitude: number,
|
|
29
|
-
* accuracy: number,
|
|
30
|
-
* is_mock: boolean (NEW: Detects Fake GPS)
|
|
31
|
-
* }
|
|
32
|
-
*/
|
|
33
|
-
addLocationLogListener: (cb: (event: any) => void) => import("react-native").EventSubscription;
|
|
34
|
-
addLocationErrorListener: (cb: (event: any) => void) => import("react-native").EventSubscription;
|
|
35
|
-
};
|
|
36
|
-
export default _default;
|
|
1
|
+
declare const GeoActivityKit: any;
|
|
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
|
+
}
|
|
18
|
+
export declare function startForegroundService(title: string, body: string, id: number): Promise<boolean>;
|
|
19
|
+
export declare function stopForegroundService(): Promise<boolean>;
|
|
20
|
+
export declare function startMotionDetector(confidence: number): Promise<boolean>;
|
|
21
|
+
export declare function stopMotionDetector(): Promise<boolean>;
|
|
22
|
+
export declare function setLocationUpdateInterval(intervalMs: number): Promise<void>;
|
|
23
|
+
export default GeoActivityKit;
|
|
37
24
|
//# 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":"AAQA,QAAA,MAAM,cAAc,KASf,CAAC;AAEN,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,EACJ,OAAO,GACP,SAAS,GACT,SAAS,GACT,YAAY,GACZ,YAAY,GACZ,SAAS,CAAC;IACd,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;AAED,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,GACT,OAAO,CAAC,OAAO,CAAC,CAElB;AAED,wBAAgB,qBAAqB,IAAI,OAAO,CAAC,OAAO,CAAC,CAExD;AAED,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAExE;AAED,wBAAgB,kBAAkB,IAAI,OAAO,CAAC,OAAO,CAAC,CAErD;AAED,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE3E;AAED,eAAe,cAAc,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-geo-activity-kit",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
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,13 @@
|
|
|
1
|
-
import { NativeModules,
|
|
1
|
+
import { NativeModules, Platform } 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: '' }) +
|
|
5
6
|
'- You rebuilt the app after installing the package\n' +
|
|
6
7
|
'- You are not using Expo Go\n';
|
|
7
8
|
|
|
8
|
-
const
|
|
9
|
-
? NativeModules.
|
|
9
|
+
const GeoActivityKit = NativeModules.GeoActivityKit
|
|
10
|
+
? NativeModules.GeoActivityKit
|
|
10
11
|
: new Proxy(
|
|
11
12
|
{},
|
|
12
13
|
{
|
|
@@ -16,73 +17,53 @@ const RNSensorModule = NativeModules.RNSensorModule
|
|
|
16
17
|
}
|
|
17
18
|
);
|
|
18
19
|
|
|
19
|
-
|
|
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
|
-
* }
|
|
70
|
-
*/
|
|
71
|
-
addMotionListener: (cb: (event: any) => void) =>
|
|
72
|
-
emitter.addListener('onMotionStateChanged', cb),
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Returns:
|
|
76
|
-
* {
|
|
77
|
-
* latitude: number,
|
|
78
|
-
* longitude: number,
|
|
79
|
-
* accuracy: number,
|
|
80
|
-
* is_mock: boolean (NEW: Detects Fake GPS)
|
|
81
|
-
* }
|
|
82
|
-
*/
|
|
83
|
-
addLocationLogListener: (cb: (event: any) => void) =>
|
|
84
|
-
emitter.addListener('onLocationLog', cb),
|
|
85
|
-
|
|
86
|
-
addLocationErrorListener: (cb: (event: any) => void) =>
|
|
87
|
-
emitter.addListener('onLocationError', cb),
|
|
88
|
-
};
|
|
20
|
+
export interface LocationEvent {
|
|
21
|
+
latitude: number;
|
|
22
|
+
longitude: number;
|
|
23
|
+
accuracy: number;
|
|
24
|
+
timestamp: string;
|
|
25
|
+
is_mock: boolean;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface MotionEvent {
|
|
29
|
+
activity:
|
|
30
|
+
| 'STILL'
|
|
31
|
+
| 'WALKING'
|
|
32
|
+
| 'RUNNING'
|
|
33
|
+
| 'ON_BICYCLE'
|
|
34
|
+
| 'IN_VEHICLE'
|
|
35
|
+
| 'UNKNOWN';
|
|
36
|
+
isMoving: boolean;
|
|
37
|
+
state: 'MOVING' | 'STATIONARY';
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface ErrorEvent {
|
|
41
|
+
error: string;
|
|
42
|
+
message: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function startForegroundService(
|
|
46
|
+
title: string,
|
|
47
|
+
body: string,
|
|
48
|
+
id: number
|
|
49
|
+
): Promise<boolean> {
|
|
50
|
+
return GeoActivityKit.startForegroundService(title, body, id);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function stopForegroundService(): Promise<boolean> {
|
|
54
|
+
return GeoActivityKit.stopForegroundService();
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function startMotionDetector(confidence: number): Promise<boolean> {
|
|
58
|
+
return GeoActivityKit.startMotionDetector(confidence);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export function stopMotionDetector(): Promise<boolean> {
|
|
62
|
+
return GeoActivityKit.stopMotionDetector();
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export function setLocationUpdateInterval(intervalMs: number): Promise<void> {
|
|
66
|
+
return GeoActivityKit.setLocationUpdateInterval(intervalMs);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export default GeoActivityKit;
|