@situm/react-native 3.12.6 → 3.13.0
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/commonjs/sdk/index.js +158 -24
- package/lib/commonjs/sdk/index.js.map +1 -1
- package/lib/commonjs/sdk/types/constants.js +16 -1
- package/lib/commonjs/sdk/types/constants.js.map +1 -1
- package/lib/commonjs/sdk/types/index.js +11 -1
- package/lib/commonjs/sdk/types/index.js.map +1 -1
- package/lib/commonjs/sdk/utils.js +10 -0
- package/lib/commonjs/sdk/utils.js.map +1 -1
- package/lib/commonjs/wayfinding/components/MapView.js +10 -23
- package/lib/commonjs/wayfinding/components/MapView.js.map +1 -1
- package/lib/commonjs/wayfinding/hooks/index.js +64 -64
- package/lib/commonjs/wayfinding/hooks/index.js.map +1 -1
- package/lib/module/sdk/index.js +161 -27
- package/lib/module/sdk/index.js.map +1 -1
- package/lib/module/sdk/types/constants.js +15 -0
- package/lib/module/sdk/types/constants.js.map +1 -1
- package/lib/module/sdk/types/index.js +10 -0
- package/lib/module/sdk/types/index.js.map +1 -1
- package/lib/module/sdk/utils.js +10 -1
- package/lib/module/sdk/utils.js.map +1 -1
- package/lib/module/wayfinding/components/MapView.js +9 -22
- package/lib/module/wayfinding/components/MapView.js.map +1 -1
- package/lib/module/wayfinding/hooks/index.js +66 -66
- package/lib/module/wayfinding/hooks/index.js.map +1 -1
- package/lib/typescript/src/sdk/index.d.ts +8 -1
- package/lib/typescript/src/sdk/index.d.ts.map +1 -1
- package/lib/typescript/src/sdk/types/constants.d.ts +14 -0
- package/lib/typescript/src/sdk/types/constants.d.ts.map +1 -1
- package/lib/typescript/src/sdk/types/index.d.ts +7 -1
- package/lib/typescript/src/sdk/types/index.d.ts.map +1 -1
- package/lib/typescript/src/sdk/utils.d.ts +1 -0
- package/lib/typescript/src/sdk/utils.d.ts.map +1 -1
- package/lib/typescript/src/wayfinding/components/MapView.d.ts.map +1 -1
- package/lib/typescript/src/wayfinding/hooks/index.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/sdk/index.ts +201 -54
- package/src/sdk/types/constants.ts +15 -0
- package/src/sdk/types/index.ts +15 -0
- package/src/sdk/utils.ts +11 -1
- package/src/wayfinding/components/MapView.tsx +9 -28
- package/src/wayfinding/hooks/index.ts +84 -96
|
@@ -7,10 +7,13 @@ import {
|
|
|
7
7
|
type Error,
|
|
8
8
|
ErrorCode,
|
|
9
9
|
ErrorType,
|
|
10
|
+
InternalCall,
|
|
10
11
|
type Location,
|
|
11
12
|
type NavigationProgress,
|
|
12
13
|
} from "../../sdk/types";
|
|
13
14
|
import {
|
|
15
|
+
InternalCallType,
|
|
16
|
+
LocationStatusName,
|
|
14
17
|
NavigationStatus,
|
|
15
18
|
NavigationUpdateType,
|
|
16
19
|
} from "../../sdk/types/constants";
|
|
@@ -24,6 +27,7 @@ import {
|
|
|
24
27
|
setDirections,
|
|
25
28
|
setError,
|
|
26
29
|
setLocation,
|
|
30
|
+
setLocationStatus,
|
|
27
31
|
setNavigation,
|
|
28
32
|
UseSitumContext,
|
|
29
33
|
} from "../store/index";
|
|
@@ -58,102 +62,86 @@ export const useSitumInternal = () => {
|
|
|
58
62
|
};
|
|
59
63
|
|
|
60
64
|
function registerCallbacks() {
|
|
61
|
-
SitumPlugin.
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
SitumPlugin.onNavigationCancellation(() => {
|
|
142
|
-
console.debug("Situm > hook > navigation was cancelled by the user.");
|
|
143
|
-
|
|
144
|
-
dispatch(
|
|
145
|
-
setNavigation({
|
|
146
|
-
type: NavigationUpdateType.CANCELLED,
|
|
147
|
-
status: NavigationStatus.STOP,
|
|
148
|
-
})
|
|
149
|
-
);
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
SitumPlugin.onNavigationError((navigationError: any) => {
|
|
153
|
-
console.error(
|
|
154
|
-
"Situm > hook > ERROR while navigating: ",
|
|
155
|
-
JSON.stringify(navigationError)
|
|
156
|
-
);
|
|
65
|
+
SitumPlugin.internalSetMethodCallMapDelegate((internalCall: InternalCall) => {
|
|
66
|
+
switch(internalCall.type) {
|
|
67
|
+
case InternalCallType.LOCATION:
|
|
68
|
+
let location = internalCall.get<Location>();
|
|
69
|
+
dispatch(
|
|
70
|
+
setLocation({
|
|
71
|
+
...location,
|
|
72
|
+
})
|
|
73
|
+
);
|
|
74
|
+
break;
|
|
75
|
+
case InternalCallType.LOCATION_STATUS:
|
|
76
|
+
let statusName = internalCall.get<string>();
|
|
77
|
+
if (statusName in LocationStatusName) {
|
|
78
|
+
dispatch(
|
|
79
|
+
setLocationStatus(statusName)
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
break;
|
|
83
|
+
case InternalCallType.LOCATION_STOPPED:
|
|
84
|
+
// TODO: LOCATION_STOPPED exists only in RN, delete!
|
|
85
|
+
dispatch(resetLocation());
|
|
86
|
+
break;
|
|
87
|
+
case InternalCallType.LOCATION_ERROR:
|
|
88
|
+
let error = internalCall.get<Error>();
|
|
89
|
+
dispatch(
|
|
90
|
+
setError(error)
|
|
91
|
+
);
|
|
92
|
+
break;
|
|
93
|
+
case InternalCallType.NAVIGATION_START:
|
|
94
|
+
dispatch(
|
|
95
|
+
setNavigation({
|
|
96
|
+
type: NavigationUpdateType.PROGRESS,
|
|
97
|
+
status: NavigationStatus.START,
|
|
98
|
+
})
|
|
99
|
+
);
|
|
100
|
+
break;
|
|
101
|
+
case InternalCallType.NAVIGATION_DESTINATION_REACHED:
|
|
102
|
+
dispatch(
|
|
103
|
+
setNavigation({
|
|
104
|
+
type: NavigationUpdateType.DESTINATION_REACHED,
|
|
105
|
+
status: NavigationStatus.UPDATE,
|
|
106
|
+
})
|
|
107
|
+
);
|
|
108
|
+
break;
|
|
109
|
+
case InternalCallType.NAVIGATION_PROGRESS:
|
|
110
|
+
let progress = internalCall.get<NavigationProgress>();
|
|
111
|
+
dispatch(
|
|
112
|
+
setNavigation({
|
|
113
|
+
currentIndication: progress?.currentIndication,
|
|
114
|
+
routeStep: progress?.routeStep,
|
|
115
|
+
distanceToGoal: progress?.distanceToGoal,
|
|
116
|
+
points: progress?.points,
|
|
117
|
+
type: NavigationUpdateType.PROGRESS,
|
|
118
|
+
segments: progress?.segments,
|
|
119
|
+
status: NavigationStatus.UPDATE,
|
|
120
|
+
})
|
|
121
|
+
);
|
|
122
|
+
break;
|
|
123
|
+
case InternalCallType.NAVIGATION_OUT_OF_ROUTE:
|
|
124
|
+
dispatch(
|
|
125
|
+
setNavigation({
|
|
126
|
+
type: NavigationUpdateType.OUT_OF_ROUTE,
|
|
127
|
+
status: NavigationStatus.UPDATE,
|
|
128
|
+
})
|
|
129
|
+
);
|
|
130
|
+
break;
|
|
131
|
+
case InternalCallType.NAVIGATION_CANCELLATION:
|
|
132
|
+
dispatch(
|
|
133
|
+
setNavigation({
|
|
134
|
+
type: NavigationUpdateType.CANCELLED,
|
|
135
|
+
status: NavigationStatus.STOP,
|
|
136
|
+
})
|
|
137
|
+
);
|
|
138
|
+
break;
|
|
139
|
+
case InternalCallType.NAVIGATION_ERROR:
|
|
140
|
+
case InternalCallType.GEOFENCES_ENTER:
|
|
141
|
+
case InternalCallType.GEOFENCES_EXIT:
|
|
142
|
+
// Do nothing.
|
|
143
|
+
break;
|
|
144
|
+
}
|
|
157
145
|
});
|
|
158
146
|
}
|
|
159
147
|
|