@expofp/react-native-efp-crowdconnected 0.0.2-alpha.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/ExpofpCrowdconnected.podspec +26 -0
- package/LICENSE +20 -0
- package/README.md +169 -0
- package/android/build.gradle +86 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/java/com/expofpcrowdconnected/ExpoFpAzimuthProvider.kt +94 -0
- package/android/src/main/java/com/expofpcrowdconnected/ExpoFpCrowdConnectedLocationProviderSettings.kt +136 -0
- package/android/src/main/java/com/expofpcrowdconnected/ExpoFpPosition.kt +96 -0
- package/android/src/main/java/com/expofpcrowdconnected/ExpoFpProviderInfo.kt +27 -0
- package/android/src/main/java/com/expofpcrowdconnected/ExpofpCrowdconnectedPackage.kt +33 -0
- package/android/src/main/java/com/expofpcrowdconnected/RCTCrowdConnectedLocationProviderModule.kt +504 -0
- package/ios/ExpoFpLocationProvider/ExpoFpCrowdConnectedLocationProviderSettings.swift +116 -0
- package/ios/ExpoFpLocationProvider/ExpoFpCrowdConnectedNavigationType.swift +14 -0
- package/ios/ExpoFpLocationProvider/ExpoFpError.swift +28 -0
- package/ios/ExpoFpLocationProvider/ExpoFpFloorType.swift +39 -0
- package/ios/ExpoFpLocationProvider/ExpoFpLocationSettings.swift +18 -0
- package/ios/ExpoFpLocationProvider/ExpoFpPosition.swift +42 -0
- package/ios/ExpoFpLocationProvider/ExpoFpProviderInfo.swift +12 -0
- package/ios/Extensions/Encodable+Extensions.swift +28 -0
- package/ios/Extensions/LocationTrackingMode+Extensions.swift +16 -0
- package/ios/Extensions/NSDictionary+Extensions.swift +21 -0
- package/ios/RCTCrowdConnectedLocationProvider.m +24 -0
- package/ios/RCTCrowdConnectedLocationProvider.swift +252 -0
- package/lib/module/crowdconnected-location-provider-native-module.js +38 -0
- package/lib/module/crowdconnected-location-provider-native-module.js.map +1 -0
- package/lib/module/index.js +5 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/types.js +2 -0
- package/lib/module/types.js.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/crowdconnected-location-provider-native-module.d.ts +4 -0
- package/lib/typescript/src/crowdconnected-location-provider-native-module.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +3 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/types.d.ts +40 -0
- package/lib/typescript/src/types.d.ts.map +1 -0
- package/package.json +154 -0
- package/src/crowdconnected-location-provider-native-module.tsx +57 -0
- package/src/index.tsx +2 -0
- package/src/types.ts +49 -0
package/package.json
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@expofp/react-native-efp-crowdconnected",
|
|
3
|
+
"version": "0.0.2-alpha.1",
|
|
4
|
+
"description": "React Native wrapper for ExpoFP around CrowdConnected SDK",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"react-native",
|
|
7
|
+
"ios",
|
|
8
|
+
"android",
|
|
9
|
+
"expofp",
|
|
10
|
+
"crowdconnected"
|
|
11
|
+
],
|
|
12
|
+
"homepage": "https://github.com/expofp/react-native-crowdconnected#readme",
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/expofp/react-native-crowdconnected/issues"
|
|
15
|
+
},
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "git+https://github.com/expofp/react-native-crowdconnected.git"
|
|
19
|
+
},
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"author": "ExpoFP Dev Team <dev-team@expofp.com> (https://developer.expofp.com)",
|
|
22
|
+
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"source": "./src/index.tsx",
|
|
25
|
+
"types": "./lib/typescript/src/index.d.ts",
|
|
26
|
+
"default": "./lib/module/index.js"
|
|
27
|
+
},
|
|
28
|
+
"./package.json": "./package.json"
|
|
29
|
+
},
|
|
30
|
+
"main": "./lib/module/index.js",
|
|
31
|
+
"types": "./lib/typescript/src/index.d.ts",
|
|
32
|
+
"files": [
|
|
33
|
+
"src",
|
|
34
|
+
"lib",
|
|
35
|
+
"android",
|
|
36
|
+
"ios",
|
|
37
|
+
"cpp",
|
|
38
|
+
"*.podspec",
|
|
39
|
+
"react-native.config.js",
|
|
40
|
+
"!ios/build",
|
|
41
|
+
"!android/build",
|
|
42
|
+
"!android/gradle",
|
|
43
|
+
"!android/gradlew",
|
|
44
|
+
"!android/gradlew.bat",
|
|
45
|
+
"!android/local.properties",
|
|
46
|
+
"!**/__tests__",
|
|
47
|
+
"!**/__fixtures__",
|
|
48
|
+
"!**/__mocks__",
|
|
49
|
+
"!**/.*"
|
|
50
|
+
],
|
|
51
|
+
"workspaces": [
|
|
52
|
+
"example"
|
|
53
|
+
],
|
|
54
|
+
"scripts": {
|
|
55
|
+
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
|
|
56
|
+
"example": "yarn workspace react-native-expofp-crowdconnected-example",
|
|
57
|
+
"ios:list": "xcrun simctl list devices",
|
|
58
|
+
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
59
|
+
"prepare": "bob build",
|
|
60
|
+
"release": "release-it --only-version",
|
|
61
|
+
"test": "jest",
|
|
62
|
+
"typecheck": "tsc"
|
|
63
|
+
},
|
|
64
|
+
"jest": {
|
|
65
|
+
"modulePathIgnorePatterns": [
|
|
66
|
+
"<rootDir>/example/node_modules",
|
|
67
|
+
"<rootDir>/lib/"
|
|
68
|
+
],
|
|
69
|
+
"preset": "react-native"
|
|
70
|
+
},
|
|
71
|
+
"devDependencies": {
|
|
72
|
+
"@babel/core": "^7.0.0",
|
|
73
|
+
"@eslint/compat": "^1.3.2",
|
|
74
|
+
"@eslint/eslintrc": "^3.3.1",
|
|
75
|
+
"@eslint/js": "^9.35.0",
|
|
76
|
+
"@evilmartians/lefthook": "^1.12.3",
|
|
77
|
+
"@react-native-community/cli": "20.0.1",
|
|
78
|
+
"@react-native/babel-preset": "0.79.6",
|
|
79
|
+
"@react-native/eslint-config": "^0.79.6",
|
|
80
|
+
"@release-it/conventional-changelog": "^10.0.1",
|
|
81
|
+
"@types/jest": "^29.5.14",
|
|
82
|
+
"@types/react": "^19.0.0",
|
|
83
|
+
"del-cli": "^6.0.0",
|
|
84
|
+
"eslint": "^9.0.0",
|
|
85
|
+
"eslint-config-prettier": "^10.1.8",
|
|
86
|
+
"eslint-plugin-prettier": "^5.5.4",
|
|
87
|
+
"jest": "^29.7.0",
|
|
88
|
+
"prettier": "^3.6.2",
|
|
89
|
+
"react": "19.0.0",
|
|
90
|
+
"react-native": "0.79.6",
|
|
91
|
+
"react-native-builder-bob": "^0.40.13",
|
|
92
|
+
"release-it": "^19.0.4",
|
|
93
|
+
"turbo": "^2.5.6",
|
|
94
|
+
"typescript": "^5.9.2"
|
|
95
|
+
},
|
|
96
|
+
"peerDependencies": {
|
|
97
|
+
"react": "*",
|
|
98
|
+
"react-native": "*"
|
|
99
|
+
},
|
|
100
|
+
"packageManager": "yarn@3.6.1",
|
|
101
|
+
"publishConfig": {
|
|
102
|
+
"registry": "https://registry.npmjs.org/"
|
|
103
|
+
},
|
|
104
|
+
"codegenConfig": {
|
|
105
|
+
"name": "ExpofpCrowdconnectedSpec",
|
|
106
|
+
"type": "modules",
|
|
107
|
+
"jsSrcsDir": "src",
|
|
108
|
+
"android": {
|
|
109
|
+
"javaPackageName": "com.expofpcrowdconnected"
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
"create-react-native-library": {
|
|
113
|
+
"languages": "kotlin-objc",
|
|
114
|
+
"type": "turbo-module",
|
|
115
|
+
"version": "0.54.3"
|
|
116
|
+
},
|
|
117
|
+
"react-native-builder-bob": {
|
|
118
|
+
"source": "src",
|
|
119
|
+
"output": "lib",
|
|
120
|
+
"targets": [
|
|
121
|
+
[
|
|
122
|
+
"module",
|
|
123
|
+
{
|
|
124
|
+
"esm": true
|
|
125
|
+
}
|
|
126
|
+
],
|
|
127
|
+
[
|
|
128
|
+
"typescript",
|
|
129
|
+
{
|
|
130
|
+
"project": "tsconfig.build.json"
|
|
131
|
+
}
|
|
132
|
+
]
|
|
133
|
+
]
|
|
134
|
+
},
|
|
135
|
+
"release-it": {
|
|
136
|
+
"git": {
|
|
137
|
+
"commitMessage": "chore: release ${version}",
|
|
138
|
+
"tagName": "v${version}"
|
|
139
|
+
},
|
|
140
|
+
"npm": {
|
|
141
|
+
"publish": true
|
|
142
|
+
},
|
|
143
|
+
"github": {
|
|
144
|
+
"release": true
|
|
145
|
+
},
|
|
146
|
+
"plugins": {
|
|
147
|
+
"@release-it/conventional-changelog": {
|
|
148
|
+
"preset": {
|
|
149
|
+
"name": "angular"
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { NativeEventEmitter, NativeModules } from "react-native";
|
|
2
|
+
const { RCTCrowdConnectedLocationProvider } = NativeModules;
|
|
3
|
+
|
|
4
|
+
import type {
|
|
5
|
+
ICrowdConnectedLocationProviderNativeModule,
|
|
6
|
+
ICrowdConnectedLocationProvider,
|
|
7
|
+
ExpoFpPosition,
|
|
8
|
+
} from "./types";
|
|
9
|
+
|
|
10
|
+
const nativeEventEmitter = new NativeEventEmitter(
|
|
11
|
+
RCTCrowdConnectedLocationProvider,
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
// Export preload method from ExpofpModule
|
|
15
|
+
export const RCTCrowdConnectedLocationProviderNativeModule =
|
|
16
|
+
RCTCrowdConnectedLocationProvider as ICrowdConnectedLocationProviderNativeModule;
|
|
17
|
+
|
|
18
|
+
// https://reactnative.dev/docs/next/the-new-architecture/native-modules-custom-events
|
|
19
|
+
// https://www.callstack.com/blog/sending-events-to-javascript-from-your-native-module-in-react-native
|
|
20
|
+
export const CrowdConnectedLocationProvider: ICrowdConnectedLocationProvider = {
|
|
21
|
+
setup: RCTCrowdConnectedLocationProviderNativeModule.setup,
|
|
22
|
+
startUpdatingLocation:
|
|
23
|
+
RCTCrowdConnectedLocationProviderNativeModule.startUpdatingLocation,
|
|
24
|
+
stopUpdatingLocation:
|
|
25
|
+
RCTCrowdConnectedLocationProviderNativeModule.stopUpdatingLocation,
|
|
26
|
+
isLocationUpdating:
|
|
27
|
+
RCTCrowdConnectedLocationProviderNativeModule.isLocationUpdating,
|
|
28
|
+
onLocationChange: (callback) => {
|
|
29
|
+
const onLocationChange = (location: ExpoFpPosition) => {
|
|
30
|
+
callback(location);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const locationListener = nativeEventEmitter.addListener(
|
|
34
|
+
"onLocationChange",
|
|
35
|
+
onLocationChange,
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
return () => {
|
|
39
|
+
locationListener.remove();
|
|
40
|
+
};
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
onError: (callback) => {
|
|
44
|
+
const onLocationError = (error: string) => {
|
|
45
|
+
callback(new Error(error));
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const errorListener = nativeEventEmitter.addListener(
|
|
49
|
+
"onLocationError",
|
|
50
|
+
onLocationError,
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
return () => {
|
|
54
|
+
errorListener.remove();
|
|
55
|
+
};
|
|
56
|
+
},
|
|
57
|
+
};
|
package/src/index.tsx
ADDED
package/src/types.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// Module interface
|
|
2
|
+
|
|
3
|
+
// Methods from RCTCrowdConnectedLocationProvider
|
|
4
|
+
export interface ICrowdConnectedLocationProviderNativeModule {
|
|
5
|
+
setup(settings: ExpoFpLocationSettings): Promise<ExpoFpProviderInfo>;
|
|
6
|
+
startUpdatingLocation(): Promise<ExpoFpProviderInfo>;
|
|
7
|
+
stopUpdatingLocation(): Promise<ExpoFpProviderInfo>;
|
|
8
|
+
isLocationUpdating(): Promise<ExpoFpProviderInfo>;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface ICrowdConnectedLocationProvider {
|
|
12
|
+
setup(settings: ExpoFpLocationSettings): Promise<ExpoFpProviderInfo>;
|
|
13
|
+
startUpdatingLocation(): Promise<ExpoFpProviderInfo>;
|
|
14
|
+
stopUpdatingLocation(): Promise<ExpoFpProviderInfo>;
|
|
15
|
+
isLocationUpdating(): Promise<ExpoFpProviderInfo>;
|
|
16
|
+
onLocationChange(callback: LocationUpdateCallback): Unsubscribe;
|
|
17
|
+
onError(callback: ErrorCallback): Unsubscribe;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export type Unsubscribe = () => void;
|
|
21
|
+
|
|
22
|
+
export type LocationUpdateCallback = (location: ExpoFpPosition) => void;
|
|
23
|
+
export type ErrorCallback = (e: Error) => void;
|
|
24
|
+
|
|
25
|
+
export interface ExpoFpLocationSettings {
|
|
26
|
+
appKey: string;
|
|
27
|
+
token: string;
|
|
28
|
+
secret: string;
|
|
29
|
+
navigationType: "all" | "GEO" | "IPS";
|
|
30
|
+
isBackgroundUpdateEnabled: boolean;
|
|
31
|
+
isBluetoothEnabled: boolean;
|
|
32
|
+
isHeadingEnabled: boolean;
|
|
33
|
+
aliases?: Record<string, string>;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// TBD
|
|
37
|
+
export type ExpoFpPosition = {
|
|
38
|
+
x?: number;
|
|
39
|
+
y?: number;
|
|
40
|
+
z?: string | number;
|
|
41
|
+
angle?: number;
|
|
42
|
+
lat?: number;
|
|
43
|
+
lng?: number;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export type ExpoFpProviderInfo = {
|
|
47
|
+
deviceId?: string | null;
|
|
48
|
+
isLocationUpdating: boolean;
|
|
49
|
+
};
|