@situm/react-native 3.0.0-beta.0 → 3.0.0-beta.2
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/README.md +60 -506
- package/android/.gradle/5.6.4/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/android/.idea/android.iml +9 -0
- package/android/.idea/gradle.xml +13 -0
- package/android/.idea/modules.xml +8 -0
- package/android/.idea/vcs.xml +6 -0
- package/android/.idea/workspace.xml +63 -0
- package/android/local.properties +8 -0
- package/lib/commonjs/index.js +12 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/sdk/types/index.d.js +349 -0
- package/lib/commonjs/sdk/types/index.d.js.map +1 -1
- package/lib/commonjs/utils/requestPermission.js +2 -2
- package/lib/commonjs/utils/requestPermission.js.map +1 -1
- package/lib/commonjs/wayfinding/components/MapView.js +97 -12
- package/lib/commonjs/wayfinding/components/MapView.js.map +1 -1
- package/lib/commonjs/wayfinding/hooks/index.js +40 -80
- package/lib/commonjs/wayfinding/hooks/index.js.map +1 -1
- package/lib/commonjs/wayfinding/store/index.js +8 -28
- package/lib/commonjs/wayfinding/store/index.js.map +1 -1
- package/lib/commonjs/wayfinding/utils/mapper.js +6 -4
- package/lib/commonjs/wayfinding/utils/mapper.js.map +1 -1
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/sdk/types/index.d.js +373 -1
- package/lib/module/sdk/types/index.d.js.map +1 -1
- package/lib/module/utils/requestPermission.js +2 -2
- package/lib/module/utils/requestPermission.js.map +1 -1
- package/lib/module/wayfinding/components/MapView.js +97 -11
- package/lib/module/wayfinding/components/MapView.js.map +1 -1
- package/lib/module/wayfinding/hooks/index.js +8 -49
- package/lib/module/wayfinding/hooks/index.js.map +1 -1
- package/lib/module/wayfinding/store/index.js +3 -24
- package/lib/module/wayfinding/store/index.js.map +1 -1
- package/lib/module/wayfinding/utils/mapper.js +6 -4
- package/lib/module/wayfinding/utils/mapper.js.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/wayfinding/components/MapView.d.ts +5 -2
- package/lib/typescript/src/wayfinding/components/MapView.d.ts.map +1 -1
- package/lib/typescript/src/wayfinding/hooks/index.d.ts +3 -12
- package/lib/typescript/src/wayfinding/hooks/index.d.ts.map +1 -1
- package/lib/typescript/src/wayfinding/store/index.d.ts +3 -62
- package/lib/typescript/src/wayfinding/store/index.d.ts.map +1 -1
- package/lib/typescript/src/wayfinding/utils/mapper.d.ts +3 -2
- package/lib/typescript/src/wayfinding/utils/mapper.d.ts.map +1 -1
- package/package.json +12 -9
- package/src/index.ts +1 -0
- package/src/sdk/types/index.d.ts +80 -0
- package/src/utils/requestPermission.ts +2 -2
- package/src/wayfinding/components/MapView.tsx +329 -217
- package/src/wayfinding/hooks/index.ts +17 -78
- package/src/wayfinding/store/index.tsx +13 -80
- package/src/wayfinding/types/index.d.ts +10 -11
- package/src/wayfinding/utils/mapper.ts +16 -13
|
@@ -1,75 +1,16 @@
|
|
|
1
1
|
import React, { MutableRefObject } from "react";
|
|
2
|
-
import { Building, Poi } from "
|
|
3
|
-
export interface Location {
|
|
4
|
-
position?: Position;
|
|
5
|
-
accuracy?: number;
|
|
6
|
-
bearing?: {
|
|
7
|
-
degrees: number;
|
|
8
|
-
degreesClockwise: number;
|
|
9
|
-
};
|
|
10
|
-
hasBearing?: boolean;
|
|
11
|
-
status: PositioningStatus;
|
|
12
|
-
}
|
|
13
|
-
export interface Position {
|
|
14
|
-
coordinate: {
|
|
15
|
-
latitude: number;
|
|
16
|
-
longitude: number;
|
|
17
|
-
};
|
|
18
|
-
cartesianCoordinate: {
|
|
19
|
-
x: number;
|
|
20
|
-
y: number;
|
|
21
|
-
};
|
|
22
|
-
isIndoor?: boolean;
|
|
23
|
-
isOutdoor?: boolean;
|
|
24
|
-
buildingIdentifier?: string;
|
|
25
|
-
floorIdentifier?: string;
|
|
26
|
-
}
|
|
27
|
-
export declare enum PositioningStatus {
|
|
28
|
-
STARTING = "STARTING",
|
|
29
|
-
CALCULATING = "CALCULATING",
|
|
30
|
-
POSITIONING = "POSITIONING",
|
|
31
|
-
USER_NOT_IN_BUILDING = "USER_NOT_IN_BUILDING",
|
|
32
|
-
STOPPED = "STOPPED"
|
|
33
|
-
}
|
|
34
|
-
export interface SDKNavigation {
|
|
35
|
-
currentIndication?: any;
|
|
36
|
-
distanceToGoal?: number;
|
|
37
|
-
points?: any;
|
|
38
|
-
routeStep?: any;
|
|
39
|
-
segments?: any;
|
|
40
|
-
route?: Directions;
|
|
41
|
-
type?: NavigationUpdateType;
|
|
42
|
-
status: NavigationStatus;
|
|
43
|
-
}
|
|
44
|
-
export declare enum NavigationStatus {
|
|
45
|
-
START = "start",
|
|
46
|
-
STOP = "stop",
|
|
47
|
-
UPDATE = "update"
|
|
48
|
-
}
|
|
49
|
-
export declare enum NavigationUpdateType {
|
|
50
|
-
progress = "PROGRESS",
|
|
51
|
-
userOutsideRoute = "OUT_OF_ROUTE",
|
|
52
|
-
destinationReached = "DESTINATION_REACHED"
|
|
53
|
-
}
|
|
2
|
+
import { Building, Location, LocationStatusName, Poi, SDKError, SDKNavigation } from "../../sdk/types/index.d";
|
|
54
3
|
export type Directions = any;
|
|
55
|
-
export type NavigateToPoiType = {
|
|
56
|
-
navigationTo: number;
|
|
57
|
-
type?: string;
|
|
58
|
-
};
|
|
59
4
|
interface User {
|
|
60
5
|
email?: string;
|
|
61
6
|
apiKey?: string;
|
|
62
7
|
}
|
|
63
|
-
export interface SDKError {
|
|
64
|
-
code?: number;
|
|
65
|
-
message: string;
|
|
66
|
-
}
|
|
67
8
|
export interface State {
|
|
68
9
|
webViewRef: MutableRefObject<undefined>;
|
|
69
10
|
sdkInitialized: boolean;
|
|
70
11
|
user?: User;
|
|
71
12
|
location?: Location;
|
|
72
|
-
buildings: Building[];
|
|
13
|
+
buildings: Building[] | null;
|
|
73
14
|
currentBuilding: Building;
|
|
74
15
|
pois: Poi[];
|
|
75
16
|
directions?: Directions;
|
|
@@ -86,7 +27,7 @@ export declare const selectWebViewRef: (state: State) => React.MutableRefObject<
|
|
|
86
27
|
export declare const selectIsSDKInitialized: (state: State) => boolean;
|
|
87
28
|
export declare const selectUser: (state: State) => User;
|
|
88
29
|
export declare const selectLocation: (state: State) => Location;
|
|
89
|
-
export declare const selectLocationStatus: (state: State) =>
|
|
30
|
+
export declare const selectLocationStatus: (state: State) => LocationStatusName;
|
|
90
31
|
export declare const selectBuildings: (state: State) => Building[];
|
|
91
32
|
export declare const selectCurrentBuilding: (state: State) => Building;
|
|
92
33
|
export declare const selectPois: (state: State) => Poi[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/wayfinding/store/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAiB,gBAAgB,EAAc,MAAM,OAAO,CAAC;AAE3E,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/wayfinding/store/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAiB,gBAAgB,EAAc,MAAM,OAAO,CAAC;AAE3E,OAAO,EACL,QAAQ,EACR,QAAQ,EACR,kBAAkB,EAElB,GAAG,EACH,QAAQ,EACR,aAAa,EACd,MAAM,yBAAyB,CAAC;AAIjC,MAAM,MAAM,UAAU,GAAG,GAAG,CAAC;AAE7B,UAAU,IAAI;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,KAAK;IACpB,UAAU,EAAE,gBAAgB,CAAC,SAAS,CAAC,CAAC;IACxC,cAAc,EAAE,OAAO,CAAC;IACxB,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,SAAS,EAAE,QA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3B,KAAK,CAAC,iBAAiB,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC,CAiBH,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { Location, NavigateToPoiType, SDKNavigation } from "../../sdk/types/index.d";
|
|
1
2
|
import { Navigation } from "..";
|
|
2
|
-
import { Directions
|
|
3
|
+
import { Directions } from "../store/index";
|
|
3
4
|
declare const Mapper: {
|
|
4
5
|
location: (location: Location) => string;
|
|
5
6
|
locationStatus: (locationStatus: Location["status"]) => string;
|
|
@@ -7,7 +8,7 @@ declare const Mapper: {
|
|
|
7
8
|
navigation: (navigation: Navigation) => string;
|
|
8
9
|
navigateToPoi: (navigate: NavigateToPoiType) => string;
|
|
9
10
|
cancelNavigation: () => string;
|
|
10
|
-
selectPoi: (poiId: number) => string;
|
|
11
|
+
selectPoi: (poiId: number | null) => string;
|
|
11
12
|
followUser: (follow: boolean) => string;
|
|
12
13
|
initialConfiguration: (style: any, enablePoiClustering: any, showPoiNames: any, minZoom: any, maxZoom: any, initialZoom: any, useDashboardTheme: any) => string;
|
|
13
14
|
routeToResult: (navigation: any) => Navigation;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapper.d.ts","sourceRoot":"","sources":["../../../../../src/wayfinding/utils/mapper.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"mapper.d.ts","sourceRoot":"","sources":["../../../../../src/wayfinding/utils/mapper.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,QAAQ,EACR,iBAAiB,EACjB,aAAa,EACd,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAe,UAAU,EAAE,MAAM,IAAI,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAK5C,QAAA,MAAM,MAAM;yBACW,QAAQ;qCAiBI,QAAQ,CAAC,QAAQ,CAAC;wBAG/B,UAAU;6BAGL,UAAU;8BAGT,iBAAiB;;uBAKxB,MAAM,GAAG,IAAI;yBAGX,OAAO;kCAGnB,GAAG,uBACW,GAAG,gBACV,GAAG,WACR,GAAG,WACH,GAAG,eACC,GAAG,qBACG,GAAG;gCA0BI,GAAG,KAAG,UAAU;qCA2BX,aAAa,KAAG,UAAU;CAmB5D,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@situm/react-native",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.2",
|
|
4
|
+
"description": "Set of utilities that allow any developer to build React Native location based apps using Situm's indoor positioning system.",
|
|
4
5
|
"private": false,
|
|
5
|
-
"repository": "https://github.com/situmtech/
|
|
6
|
+
"repository": "https://github.com/situmtech/react-native",
|
|
6
7
|
"author": "Situm Technologies <mobile@situm.com>",
|
|
7
8
|
"license": "MIT",
|
|
8
9
|
"bugs": {
|
|
9
|
-
"url": "https://github.com/situmtech/
|
|
10
|
+
"url": "https://github.com/situmtech/react-native/issues"
|
|
10
11
|
},
|
|
11
|
-
"homepage": "https://github.com/situmtech/
|
|
12
|
+
"homepage": "https://github.com/situmtech/react-native#readme",
|
|
12
13
|
"publishConfig": {
|
|
13
14
|
"registry": "https://registry.npmjs.org/"
|
|
14
15
|
},
|
|
@@ -16,7 +17,7 @@
|
|
|
16
17
|
"module": "lib/module/index",
|
|
17
18
|
"types": "lib/typescript/index.d.ts",
|
|
18
19
|
"react-native": "src/index",
|
|
19
|
-
"source": "src/index
|
|
20
|
+
"source": "src/index",
|
|
20
21
|
"files": [
|
|
21
22
|
"src",
|
|
22
23
|
"lib",
|
|
@@ -38,14 +39,15 @@
|
|
|
38
39
|
"scripts": {
|
|
39
40
|
"android": "react-native run-android",
|
|
40
41
|
"ios": "react-native run-ios",
|
|
41
|
-
"test": "yarn lint && yarn test:jest",
|
|
42
|
+
"test": "yarn typescript && yarn lint && yarn test:jest",
|
|
42
43
|
"test:jest": "jest",
|
|
43
44
|
"typescript": "tsc --noEmit",
|
|
44
45
|
"lint:fix": "eslint \"src/**/*.{js,ts,tsx}\" --fix",
|
|
45
46
|
"lint": "eslint \"src/**/*.{js,jsx,ts,tsx}\"",
|
|
46
47
|
"prepare": "bob build",
|
|
47
48
|
"example": "yarn --cwd example",
|
|
48
|
-
"bootstrap": "yarn example && yarn && yarn example pods"
|
|
49
|
+
"bootstrap": "yarn example && yarn && yarn example pods",
|
|
50
|
+
"doc": "typedoc --out ./docs/types ./src --tsconfig ./tsconfig.json"
|
|
49
51
|
},
|
|
50
52
|
"keywords": [
|
|
51
53
|
"react-native",
|
|
@@ -85,6 +87,7 @@
|
|
|
85
87
|
"react-native": "^0.72.1",
|
|
86
88
|
"react-native-builder-bob": "^0.20.4",
|
|
87
89
|
"react-test-renderer": "18.2.0",
|
|
90
|
+
"typedoc": "^0.24.8",
|
|
88
91
|
"typescript": "^5.0.4"
|
|
89
92
|
},
|
|
90
93
|
"dependencies": {
|
|
@@ -124,7 +127,7 @@
|
|
|
124
127
|
]
|
|
125
128
|
},
|
|
126
129
|
"sdkVersions": {
|
|
127
|
-
"android": "
|
|
128
|
-
"ios": "2.
|
|
130
|
+
"android": "3.0.1@aar",
|
|
131
|
+
"ios": "2.61.1"
|
|
129
132
|
}
|
|
130
133
|
}
|
package/src/index.ts
CHANGED
package/src/sdk/types/index.d.ts
CHANGED
|
@@ -216,6 +216,7 @@ export type Point = {
|
|
|
216
216
|
isIndoor: boolean;
|
|
217
217
|
isOutdoor: boolean;
|
|
218
218
|
};
|
|
219
|
+
|
|
219
220
|
export type DirectionPoint = {
|
|
220
221
|
floorIdentifier: Floor["floorIdentifier"];
|
|
221
222
|
buildingIdentifier: Building["buildingIdentifier"];
|
|
@@ -598,6 +599,85 @@ export type RealTimeData = {
|
|
|
598
599
|
locations: Location[];
|
|
599
600
|
};
|
|
600
601
|
|
|
602
|
+
export interface Location {
|
|
603
|
+
position?: Position;
|
|
604
|
+
accuracy?: number;
|
|
605
|
+
bearing?: {
|
|
606
|
+
degrees: number;
|
|
607
|
+
degreesClockwise: number;
|
|
608
|
+
};
|
|
609
|
+
hasBearing?: boolean;
|
|
610
|
+
status: LocationStatusName;
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
export interface Position {
|
|
614
|
+
coordinate: {
|
|
615
|
+
latitude: number;
|
|
616
|
+
longitude: number;
|
|
617
|
+
};
|
|
618
|
+
cartesianCoordinate: {
|
|
619
|
+
x: number;
|
|
620
|
+
y: number;
|
|
621
|
+
};
|
|
622
|
+
isIndoor?: boolean;
|
|
623
|
+
isOutdoor?: boolean;
|
|
624
|
+
buildingIdentifier?: string;
|
|
625
|
+
floorIdentifier?: string;
|
|
626
|
+
}
|
|
627
|
+
export interface LocationStatus {
|
|
628
|
+
statusName: LocationStatusName;
|
|
629
|
+
statusCode: number;
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
export enum LocationStatusName {
|
|
633
|
+
STARTING = "STARTING",
|
|
634
|
+
CALCULATING = "CALCULATING",
|
|
635
|
+
// This status will always be sent to mapviewer-web, in case we recieve
|
|
636
|
+
// a location from SDK.
|
|
637
|
+
POSITIONING = "POSITIONING",
|
|
638
|
+
USER_NOT_IN_BUILDING = "USER_NOT_IN_BUILDING",
|
|
639
|
+
STOPPED = "STOPPED",
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
export interface SDKError {
|
|
643
|
+
code?: number;
|
|
644
|
+
message: string;
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
export interface SDKNavigation {
|
|
648
|
+
//closestPositionInRoute: any;
|
|
649
|
+
currentIndication?: any;
|
|
650
|
+
//currentStepIndex:number;
|
|
651
|
+
//distanceToEndStep: number;
|
|
652
|
+
distanceToGoal?: number;
|
|
653
|
+
//nextIndication: any;
|
|
654
|
+
points?: any;
|
|
655
|
+
routeStep?: any;
|
|
656
|
+
segments?: any;
|
|
657
|
+
route?: Directions;
|
|
658
|
+
//timeToEndStep: number;
|
|
659
|
+
//timeToGoal: number;
|
|
660
|
+
type?: NavigationUpdateType;
|
|
661
|
+
status: NavigationStatus;
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
export enum NavigationStatus {
|
|
665
|
+
START = "start",
|
|
666
|
+
STOP = "stop",
|
|
667
|
+
UPDATE = "update",
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
export enum NavigationUpdateType {
|
|
671
|
+
progress = "PROGRESS",
|
|
672
|
+
userOutsideRoute = "OUT_OF_ROUTE",
|
|
673
|
+
destinationReached = "DESTINATION_REACHED",
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
export type NavigateToPoiType = {
|
|
677
|
+
navigationTo: number;
|
|
678
|
+
type?: string;
|
|
679
|
+
};
|
|
680
|
+
|
|
601
681
|
export interface SitumPluginStatic {
|
|
602
682
|
initSitumSDK(): void;
|
|
603
683
|
|
|
@@ -49,12 +49,12 @@ const checkAndroidPermissions = async () => {
|
|
|
49
49
|
granted["android.permission.BLUETOOTH_SCAN"] === RESULTS.GRANTED
|
|
50
50
|
) {
|
|
51
51
|
console.info(
|
|
52
|
-
"ACCESS_FINE_LOCATION, BLUETOOTH_CONNECT and
|
|
52
|
+
"ACCESS_FINE_LOCATION, BLUETOOTH_CONNECT and BLUETOOTH_SCAN permissions granted"
|
|
53
53
|
);
|
|
54
54
|
return true;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
throw "ACCESS_FINE_LOCATION, BLUETOOTH_CONNECT and
|
|
57
|
+
throw "ACCESS_FINE_LOCATION, BLUETOOTH_CONNECT and BLUETOOTH_SCAN permissions not granted";
|
|
58
58
|
} else {
|
|
59
59
|
console.info("ANDROID VERSION < 30");
|
|
60
60
|
granted = await request(PERMISSIONS.ANDROID.ACCESS_FINE_LOCATION);
|