@situm/react-native 3.15.0-beta.2 → 3.15.0-beta.3
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/index.js +73 -0
- package/lib/commonjs/sdk/index.js +931 -0
- package/lib/commonjs/sdk/internaDelegatedState.js +48 -0
- package/lib/commonjs/sdk/nativeInterface.js +20 -0
- package/lib/commonjs/sdk/types/constants.js +73 -0
- package/lib/commonjs/sdk/types/index.js +414 -0
- package/lib/commonjs/sdk/utils.js +156 -0
- package/lib/commonjs/utils/index.js +17 -0
- package/lib/commonjs/utils/logError.js +21 -0
- package/lib/commonjs/wayfinding/components/MapView.js +389 -0
- package/lib/commonjs/wayfinding/components/MapView.js.map +1 -0
- package/lib/commonjs/wayfinding/hooks/index.js +233 -0
- package/lib/commonjs/wayfinding/hooks/index.js.map +1 -0
- package/lib/commonjs/wayfinding/index.js +57 -0
- package/lib/commonjs/wayfinding/store/index.js +247 -0
- package/lib/commonjs/wayfinding/store/index.js.map +1 -0
- package/lib/commonjs/wayfinding/store/utils.js +49 -0
- package/lib/commonjs/wayfinding/store/utils.js.map +1 -0
- package/lib/commonjs/wayfinding/types/constants.js +13 -0
- package/lib/commonjs/wayfinding/types/constants.js.map +1 -0
- package/lib/commonjs/wayfinding/types/index.js +6 -0
- package/lib/commonjs/wayfinding/utils/index.js +12 -0
- package/lib/commonjs/wayfinding/utils/mapper.js +204 -0
- package/lib/module/index.js +14 -0
- package/lib/module/sdk/index.js +904 -0
- package/lib/module/sdk/index.js.map +1 -0
- package/lib/module/sdk/internaDelegatedState.js +43 -0
- package/lib/module/sdk/nativeInterface.js +20 -0
- package/lib/module/sdk/types/constants.js +70 -0
- package/lib/module/sdk/types/index.js +445 -0
- package/lib/module/sdk/utils.js +146 -0
- package/lib/module/utils/index.js +4 -0
- package/lib/module/utils/logError.js +17 -0
- package/lib/module/utils/logError.js.map +1 -0
- package/lib/module/wayfinding/components/MapView.js +381 -0
- package/lib/module/wayfinding/components/MapView.js.map +1 -0
- package/lib/module/wayfinding/hooks/index.js +226 -0
- package/lib/module/wayfinding/hooks/index.js.map +1 -0
- package/lib/module/wayfinding/index.js +15 -0
- package/lib/module/wayfinding/store/index.js +213 -0
- package/lib/module/wayfinding/store/index.js.map +1 -0
- package/lib/module/wayfinding/store/utils.js +40 -0
- package/lib/module/wayfinding/store/utils.js.map +1 -0
- package/lib/module/wayfinding/types/constants.js +9 -0
- package/lib/module/wayfinding/types/index.js +4 -0
- package/lib/module/wayfinding/types/index.js.map +1 -0
- package/lib/module/wayfinding/utils/index.js +7 -0
- package/lib/module/wayfinding/utils/mapper.js +195 -0
- package/package.json +3 -3
|
@@ -0,0 +1,904 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
4
|
+
/* eslint-disable @typescript-eslint/ban-types */
|
|
5
|
+
|
|
6
|
+
import { NativeEventEmitter, NativeModules, Platform } from "react-native";
|
|
7
|
+
import packageJson from "../../package.json";
|
|
8
|
+
import { logError } from "../utils/logError";
|
|
9
|
+
import { ErrorCode, ErrorType, InternalCall } from "./types";
|
|
10
|
+
import { InternalCallType, SdkNavigationUpdateType } from "./types/constants";
|
|
11
|
+
import { exceptionWrapper, locationErrorAdapter, locationStatusAdapter, promiseWrapper } from "./utils";
|
|
12
|
+
import { DelegatedStateManager } from "./internaDelegatedState";
|
|
13
|
+
export * from "./types";
|
|
14
|
+
export * from "./types/constants";
|
|
15
|
+
const LINKING_ERROR = `The package 'react-native' doesn't seem to be linked. Make sure: \n\n` + Platform.select({
|
|
16
|
+
ios: "- You have run 'pod install'\n",
|
|
17
|
+
default: ""
|
|
18
|
+
}) + "- You rebuilt the app after installing the package\n" + "- You are not using Expo managed workflow\n";
|
|
19
|
+
const RNCSitumPlugin = NativeModules.RNCSitumPlugin || new Proxy({}, {
|
|
20
|
+
get() {
|
|
21
|
+
throw new Error(LINKING_ERROR);
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
const SitumPluginEventEmitter = new NativeEventEmitter(RNCSitumPlugin);
|
|
25
|
+
|
|
26
|
+
// TODO: these do not act as state, not reliable
|
|
27
|
+
let positioningRunning = false;
|
|
28
|
+
let navigationRunning = false;
|
|
29
|
+
let realtimeSubscriptions = [];
|
|
30
|
+
|
|
31
|
+
// Internal method call (MapView) delegate:
|
|
32
|
+
let internalMethodCallMapDelegate = _ => {
|
|
33
|
+
// internalMethodCallMapDelegate is an empty function by default.
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
// TODO: For now, I am keeping this behavior as it was, but it seems like a candidate for refactoring.
|
|
37
|
+
const locationCallbackForNavigation = loc => {
|
|
38
|
+
if (!SitumPlugin.navigationIsRunning()) return;
|
|
39
|
+
SitumPlugin.updateNavigationWithLocation(loc);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
// Client callbacks:
|
|
43
|
+
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
44
|
+
|
|
45
|
+
let locationCallback = _ => {};
|
|
46
|
+
let locationStatusCallback = _ => {};
|
|
47
|
+
let locationStoppedCallback = () => {};
|
|
48
|
+
let locationErrorCallback = _ => {};
|
|
49
|
+
let navigationStartedCallback = _ => {};
|
|
50
|
+
let navigationProgressCallback = _ => {};
|
|
51
|
+
let navigationDestinationReachedCallback = _ => {};
|
|
52
|
+
let navigationOutOfRouteCallback = () => {};
|
|
53
|
+
let navigationFinishedCallback = () => {}; // Deprecated!
|
|
54
|
+
let navigationCancellationCallback = () => {};
|
|
55
|
+
let navigationErrorCallback = _ => {};
|
|
56
|
+
let enterGeofencesCallback = _ => {};
|
|
57
|
+
let exitGeofencesCallback = _ => {};
|
|
58
|
+
|
|
59
|
+
/* eslint-enable @typescript-eslint/no-empty-function */
|
|
60
|
+
|
|
61
|
+
// Internal callbacks:
|
|
62
|
+
// These callback functions will be added as listeners to SitumPluginEventEmitter as soon as possible and will be
|
|
63
|
+
// listening events for all the plugin lifecycle. They will forward calls to both client callbacks and the MapView
|
|
64
|
+
// internal callback.
|
|
65
|
+
|
|
66
|
+
const _internalLocationCallback = loc => {
|
|
67
|
+
DelegatedStateManager.getInstance().updateLocation(loc);
|
|
68
|
+
// MapView internal callback:
|
|
69
|
+
internalMethodCallMapDelegate(new InternalCall(InternalCallType.LOCATION, loc));
|
|
70
|
+
// Navigation internal callback: TODO review this, seems to be different to other plugins and candidate for refactoring.
|
|
71
|
+
locationCallbackForNavigation(loc);
|
|
72
|
+
// Client callback:
|
|
73
|
+
locationCallback(loc);
|
|
74
|
+
};
|
|
75
|
+
const _internalLocationStatusCallback = status => {
|
|
76
|
+
const mapViewStatusName = locationStatusAdapter(status.statusName);
|
|
77
|
+
DelegatedStateManager.getInstance().updateStatus(mapViewStatusName);
|
|
78
|
+
internalMethodCallMapDelegate(new InternalCall(InternalCallType.LOCATION_STATUS, mapViewStatusName));
|
|
79
|
+
// TODO: we are delegating different values to the internal and client callbacks. The viewer only understands
|
|
80
|
+
// the states defined in LocationStatusName, but the integrator might be interested in any state from the SDK.
|
|
81
|
+
locationStatusCallback?.(status);
|
|
82
|
+
};
|
|
83
|
+
const _internalLocationStoppedCallback = () => {
|
|
84
|
+
internalMethodCallMapDelegate(new InternalCall(InternalCallType.LOCATION_STOPPED, undefined));
|
|
85
|
+
// TODO: this callback is used only in RN, delete!
|
|
86
|
+
locationStoppedCallback?.();
|
|
87
|
+
};
|
|
88
|
+
const _internalLocationErrorCallback = error => {
|
|
89
|
+
const adaptedError = locationErrorAdapter(error);
|
|
90
|
+
DelegatedStateManager.getInstance().updateError(adaptedError);
|
|
91
|
+
internalMethodCallMapDelegate(new InternalCall(InternalCallType.LOCATION_ERROR, adaptedError));
|
|
92
|
+
locationErrorCallback?.(adaptedError);
|
|
93
|
+
};
|
|
94
|
+
const _internalNavigationStartedCallback = route => {
|
|
95
|
+
internalMethodCallMapDelegate(new InternalCall(InternalCallType.NAVIGATION_START, route));
|
|
96
|
+
navigationStartedCallback?.(route);
|
|
97
|
+
};
|
|
98
|
+
const _internalNavigationProgressCallback = progress => {
|
|
99
|
+
internalMethodCallMapDelegate(new InternalCall(InternalCallType.NAVIGATION_PROGRESS, progress));
|
|
100
|
+
navigationProgressCallback?.(progress);
|
|
101
|
+
};
|
|
102
|
+
const _internalNavigationDestinationReachedCallback = route => {
|
|
103
|
+
internalMethodCallMapDelegate(new InternalCall(InternalCallType.NAVIGATION_DESTINATION_REACHED, route));
|
|
104
|
+
navigationDestinationReachedCallback?.(route);
|
|
105
|
+
};
|
|
106
|
+
const _internalNavigationOutOfRouteCallback = () => {
|
|
107
|
+
internalMethodCallMapDelegate(new InternalCall(InternalCallType.NAVIGATION_OUT_OF_ROUTE, undefined));
|
|
108
|
+
navigationOutOfRouteCallback?.();
|
|
109
|
+
};
|
|
110
|
+
const _internalNavigationFinishedCallback = () => {
|
|
111
|
+
// Deprecated!
|
|
112
|
+
internalMethodCallMapDelegate(new InternalCall(InternalCallType.NAVIGATION_CANCELLATION, undefined));
|
|
113
|
+
navigationFinishedCallback?.();
|
|
114
|
+
};
|
|
115
|
+
const _internalNavigationCancellationCallback = () => {
|
|
116
|
+
internalMethodCallMapDelegate(new InternalCall(InternalCallType.NAVIGATION_CANCELLATION, undefined));
|
|
117
|
+
navigationCancellationCallback?.();
|
|
118
|
+
};
|
|
119
|
+
const _internalNavigationErrorCallback = error => {
|
|
120
|
+
internalMethodCallMapDelegate(new InternalCall(InternalCallType.NAVIGATION_ERROR, error));
|
|
121
|
+
navigationErrorCallback?.(error);
|
|
122
|
+
};
|
|
123
|
+
const _internalEnterGeofencesCallback = data => {
|
|
124
|
+
internalMethodCallMapDelegate(new InternalCall(InternalCallType.GEOFENCES_ENTER, data));
|
|
125
|
+
enterGeofencesCallback?.(data);
|
|
126
|
+
};
|
|
127
|
+
const _internalExitGeofencesCallback = data => {
|
|
128
|
+
internalMethodCallMapDelegate(new InternalCall(InternalCallType.GEOFENCES_EXIT, data));
|
|
129
|
+
exitGeofencesCallback?.(data);
|
|
130
|
+
};
|
|
131
|
+
const _registerCallbacks = () => {
|
|
132
|
+
const callbacksMap = {
|
|
133
|
+
locationChanged: _internalLocationCallback,
|
|
134
|
+
statusChanged: _internalLocationStatusCallback,
|
|
135
|
+
locationStopped: _internalLocationStoppedCallback,
|
|
136
|
+
locationError: _internalLocationErrorCallback,
|
|
137
|
+
[SdkNavigationUpdateType.START]: _internalNavigationStartedCallback,
|
|
138
|
+
[SdkNavigationUpdateType.PROGRESS]: _internalNavigationProgressCallback,
|
|
139
|
+
[SdkNavigationUpdateType.DESTINATION_REACHED]: _internalNavigationDestinationReachedCallback,
|
|
140
|
+
[SdkNavigationUpdateType.OUTSIDE_ROUTE]: _internalNavigationOutOfRouteCallback,
|
|
141
|
+
[SdkNavigationUpdateType.FINISHED]: _internalNavigationFinishedCallback,
|
|
142
|
+
[SdkNavigationUpdateType.CANCELLATION]: _internalNavigationCancellationCallback,
|
|
143
|
+
[SdkNavigationUpdateType.ERROR]: _internalNavigationErrorCallback,
|
|
144
|
+
onEnterGeofences: _internalEnterGeofencesCallback,
|
|
145
|
+
onExitGeofences: _internalExitGeofencesCallback
|
|
146
|
+
};
|
|
147
|
+
Object.entries(callbacksMap).forEach(([eventName, callback]) => {
|
|
148
|
+
console.log("Event emitter add listener: ", eventName);
|
|
149
|
+
SitumPluginEventEmitter.removeAllListeners(eventName);
|
|
150
|
+
SitumPluginEventEmitter.addListener(eventName, callback);
|
|
151
|
+
console.log("Event emitter add listener finished: ", eventName);
|
|
152
|
+
});
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
// End Internal callbacks --
|
|
156
|
+
|
|
157
|
+
export default class SitumPlugin {
|
|
158
|
+
/**
|
|
159
|
+
* Whether the positioning is currently in execution.
|
|
160
|
+
* @returns boolean
|
|
161
|
+
*/
|
|
162
|
+
static positioningIsRunning = () => positioningRunning;
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Whether the navigation is currently in execution.
|
|
166
|
+
* @returns boolean
|
|
167
|
+
*/
|
|
168
|
+
static navigationIsRunning = () => navigationRunning;
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Initializes {@link SitumPlugin}.
|
|
172
|
+
*
|
|
173
|
+
* This method must be called before invoking any other methods.
|
|
174
|
+
* This method can be safely called many times as it will only initialise the SDK
|
|
175
|
+
* if it is not already initialised.
|
|
176
|
+
*
|
|
177
|
+
* @returns void
|
|
178
|
+
* @throw Exception
|
|
179
|
+
*/
|
|
180
|
+
static init = () => {
|
|
181
|
+
_registerCallbacks();
|
|
182
|
+
return exceptionWrapper(() => {
|
|
183
|
+
RNCSitumPlugin.initSitumSDK();
|
|
184
|
+
});
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Provides your API key to the Situm SDK.
|
|
189
|
+
*
|
|
190
|
+
* This key is generated for your application in the Dashboard.
|
|
191
|
+
* Old credentials will be removed.
|
|
192
|
+
*
|
|
193
|
+
* @param apiKey user's apikey.
|
|
194
|
+
*
|
|
195
|
+
* @returns void
|
|
196
|
+
* @throw Exception
|
|
197
|
+
*/
|
|
198
|
+
static setApiKey = apiKey => {
|
|
199
|
+
return exceptionWrapper(({
|
|
200
|
+
onCallback
|
|
201
|
+
}) => {
|
|
202
|
+
RNCSitumPlugin.setApiKey("email@email.com", apiKey, response => {
|
|
203
|
+
onCallback(response, "Failed to set API key.");
|
|
204
|
+
});
|
|
205
|
+
});
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Provides user's email and password. This credentials will be used to obtain a
|
|
210
|
+
* valid user token to authenticate the server request, when necessary. Token
|
|
211
|
+
* obtaining is not necessary done when this method is executed. Old credentials
|
|
212
|
+
* will be removed.
|
|
213
|
+
*
|
|
214
|
+
* @param email user's email.
|
|
215
|
+
* @param password user's password.
|
|
216
|
+
*
|
|
217
|
+
* @returns void
|
|
218
|
+
* @throw Exception
|
|
219
|
+
*/
|
|
220
|
+
static setUserPass = (email, password) => {
|
|
221
|
+
return exceptionWrapper(({
|
|
222
|
+
onCallback
|
|
223
|
+
}) => {
|
|
224
|
+
RNCSitumPlugin.setUserPass(email, password, response => {
|
|
225
|
+
onCallback(response, "Failed to set user credentials.");
|
|
226
|
+
});
|
|
227
|
+
});
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Sets the API's base URL to retrieve the data.
|
|
232
|
+
*
|
|
233
|
+
* @param url user's email.
|
|
234
|
+
*
|
|
235
|
+
* @returns void
|
|
236
|
+
* @throw Exception
|
|
237
|
+
*/
|
|
238
|
+
|
|
239
|
+
static setDashboardURL = url => {
|
|
240
|
+
return exceptionWrapper(({
|
|
241
|
+
onCallback
|
|
242
|
+
}) => {
|
|
243
|
+
RNCSitumPlugin.setDashboardURL(url, response => {
|
|
244
|
+
onCallback(response, "Failed to set dashboard URL.");
|
|
245
|
+
});
|
|
246
|
+
});
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Set to true if you want the SDK to download the configuration from the Situm API
|
|
251
|
+
* and use it by default. Right now it only affects the {@link LocationRequest}.
|
|
252
|
+
* Default value is true from SDK version 2.83.5
|
|
253
|
+
*
|
|
254
|
+
* @param useRemoteConfig
|
|
255
|
+
*
|
|
256
|
+
* @returns void
|
|
257
|
+
* @throw Exception
|
|
258
|
+
*/
|
|
259
|
+
static setUseRemoteConfig = useRemoteConfig => {
|
|
260
|
+
return exceptionWrapper(({
|
|
261
|
+
onCallback
|
|
262
|
+
}) => {
|
|
263
|
+
RNCSitumPlugin.setUseRemoteConfig(useRemoteConfig ? "true" : "false", response => {
|
|
264
|
+
onCallback(response, "Failed to set remote config");
|
|
265
|
+
});
|
|
266
|
+
});
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* Sets the max seconds the cache is valid
|
|
271
|
+
*
|
|
272
|
+
* @returns void
|
|
273
|
+
* @throw Exception
|
|
274
|
+
*/
|
|
275
|
+
static setMaxCacheAge = cacheAge => {
|
|
276
|
+
return exceptionWrapper(({
|
|
277
|
+
onCallback
|
|
278
|
+
}) => {
|
|
279
|
+
RNCSitumPlugin.setCacheMaxAge(cacheAge, response => {
|
|
280
|
+
onCallback(response, "Failed to set cache max age");
|
|
281
|
+
});
|
|
282
|
+
});
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Sets the SDK {@link ConfigurationOptions}.
|
|
287
|
+
*
|
|
288
|
+
* @param options {@link ConfigurationOptions}
|
|
289
|
+
*
|
|
290
|
+
* @returns void
|
|
291
|
+
* @throw Exception
|
|
292
|
+
*/
|
|
293
|
+
static setConfiguration = options => {
|
|
294
|
+
return exceptionWrapper(() => {
|
|
295
|
+
if (options.useRemoteConfig !== undefined) {
|
|
296
|
+
SitumPlugin.setUseRemoteConfig(options.useRemoteConfig);
|
|
297
|
+
}
|
|
298
|
+
if (options.cacheMaxAge !== undefined) {
|
|
299
|
+
SitumPlugin.setMaxCacheAge(options.cacheMaxAge);
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
// Handle rest of configuration options
|
|
303
|
+
});
|
|
304
|
+
};
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* Invalidate all the resources in the cache
|
|
308
|
+
*
|
|
309
|
+
* @returns void
|
|
310
|
+
* @throw Exception
|
|
311
|
+
*/
|
|
312
|
+
static invalidateCache = () => {
|
|
313
|
+
return exceptionWrapper(() => {
|
|
314
|
+
RNCSitumPlugin.invalidateCache();
|
|
315
|
+
});
|
|
316
|
+
};
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* Gets the list of versions for the current plugin and environment
|
|
320
|
+
*
|
|
321
|
+
* @returns void
|
|
322
|
+
* @throw Exception
|
|
323
|
+
*/
|
|
324
|
+
static sdkVersion = () => {
|
|
325
|
+
return exceptionWrapper(({
|
|
326
|
+
onSuccess
|
|
327
|
+
}) => {
|
|
328
|
+
const versions = {
|
|
329
|
+
react_native: packageJson.version
|
|
330
|
+
};
|
|
331
|
+
if (Platform.OS === "ios") {
|
|
332
|
+
versions.ios = packageJson.sdkVersions.ios;
|
|
333
|
+
} else {
|
|
334
|
+
versions.android = packageJson.sdkVersions.android;
|
|
335
|
+
}
|
|
336
|
+
onSuccess(versions);
|
|
337
|
+
});
|
|
338
|
+
};
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* Returns the device identifier that has generated the location
|
|
342
|
+
*/
|
|
343
|
+
static getDeviceId = () => {
|
|
344
|
+
return promiseWrapper(({
|
|
345
|
+
onSuccess,
|
|
346
|
+
onError
|
|
347
|
+
}) => {
|
|
348
|
+
RNCSitumPlugin.getDeviceId(response => {
|
|
349
|
+
//@ts-ignore
|
|
350
|
+
if (response?.deviceId) {
|
|
351
|
+
// Resolve with the actual deviceId
|
|
352
|
+
//@ts-ignore
|
|
353
|
+
onSuccess(response.deviceId);
|
|
354
|
+
} else {
|
|
355
|
+
// Reject if deviceId is not available in the response
|
|
356
|
+
onError({
|
|
357
|
+
code: ErrorCode.UNKNOWN,
|
|
358
|
+
message: "Couldn't get device ID",
|
|
359
|
+
type: ErrorType.CRITICAL
|
|
360
|
+
});
|
|
361
|
+
}
|
|
362
|
+
});
|
|
363
|
+
});
|
|
364
|
+
};
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* Downloads all the {@link Building}s for the current user.
|
|
368
|
+
*/
|
|
369
|
+
static fetchBuildings = () => {
|
|
370
|
+
return promiseWrapper(({
|
|
371
|
+
onSuccess,
|
|
372
|
+
onError
|
|
373
|
+
}) => {
|
|
374
|
+
RNCSitumPlugin.fetchBuildings(onSuccess, onError);
|
|
375
|
+
});
|
|
376
|
+
};
|
|
377
|
+
|
|
378
|
+
/**
|
|
379
|
+
* Downloads all the building data for the selected building. This info includes
|
|
380
|
+
* {@link Floor}, indoor and outdoor {@link Poi}s, events and paths. Also it download floor
|
|
381
|
+
* maps and {@link PoiCategory} icons to local storage.
|
|
382
|
+
*
|
|
383
|
+
* @param building {@link Building}
|
|
384
|
+
*/
|
|
385
|
+
static fetchBuildingInfo = building => {
|
|
386
|
+
return promiseWrapper(({
|
|
387
|
+
onSuccess,
|
|
388
|
+
onError
|
|
389
|
+
}) => {
|
|
390
|
+
RNCSitumPlugin.fetchBuildingInfo(building, onSuccess, onError);
|
|
391
|
+
});
|
|
392
|
+
};
|
|
393
|
+
|
|
394
|
+
/**
|
|
395
|
+
* (Experimental) Downloads the tiled-map of a certain building
|
|
396
|
+
*
|
|
397
|
+
* @param building {@link Building} whose tiles will be downloaded
|
|
398
|
+
*/
|
|
399
|
+
static fetchTilesFromBuilding = building => {
|
|
400
|
+
return promiseWrapper(({
|
|
401
|
+
onSuccess,
|
|
402
|
+
onError
|
|
403
|
+
}) => {
|
|
404
|
+
RNCSitumPlugin.fetchTilesFromBuilding(building, onSuccess, onError);
|
|
405
|
+
});
|
|
406
|
+
};
|
|
407
|
+
|
|
408
|
+
/**
|
|
409
|
+
* Downloads all the floors of a building
|
|
410
|
+
*
|
|
411
|
+
* @param building {@link Building}
|
|
412
|
+
*/
|
|
413
|
+
static fetchFloorsFromBuilding = building => {
|
|
414
|
+
return promiseWrapper(({
|
|
415
|
+
onSuccess,
|
|
416
|
+
onError
|
|
417
|
+
}) => {
|
|
418
|
+
RNCSitumPlugin.fetchFloorsFromBuilding(building, onSuccess, onError);
|
|
419
|
+
});
|
|
420
|
+
};
|
|
421
|
+
|
|
422
|
+
/**
|
|
423
|
+
* Downloads the map image of a {@link Floor}
|
|
424
|
+
*
|
|
425
|
+
* @param floor {@link Floor}
|
|
426
|
+
*/
|
|
427
|
+
static fetchMapFromFloor = floor => {
|
|
428
|
+
return promiseWrapper(({
|
|
429
|
+
onSuccess,
|
|
430
|
+
onError
|
|
431
|
+
}) => {
|
|
432
|
+
RNCSitumPlugin.fetchMapFromFloor(floor, onSuccess, onError);
|
|
433
|
+
});
|
|
434
|
+
};
|
|
435
|
+
|
|
436
|
+
/**
|
|
437
|
+
* Get the geofences of a {@link Building}
|
|
438
|
+
*
|
|
439
|
+
* @param building {@link Building}
|
|
440
|
+
*/
|
|
441
|
+
static fetchGeofencesFromBuilding = building => {
|
|
442
|
+
return promiseWrapper(({
|
|
443
|
+
onSuccess,
|
|
444
|
+
onError
|
|
445
|
+
}) => {
|
|
446
|
+
RNCSitumPlugin.fetchGeofencesFromBuilding(building, onSuccess, onError);
|
|
447
|
+
});
|
|
448
|
+
};
|
|
449
|
+
|
|
450
|
+
/**
|
|
451
|
+
* Get all {@link PoiCategory}, download and cache their icons asynchronously.
|
|
452
|
+
*/
|
|
453
|
+
static fetchPoiCategories = () => {
|
|
454
|
+
return promiseWrapper(({
|
|
455
|
+
onSuccess,
|
|
456
|
+
onError
|
|
457
|
+
}) => {
|
|
458
|
+
RNCSitumPlugin.fetchPoiCategories(onSuccess, onError);
|
|
459
|
+
});
|
|
460
|
+
};
|
|
461
|
+
|
|
462
|
+
/**
|
|
463
|
+
* Get the normal {@link PoiIcon} for a category
|
|
464
|
+
*
|
|
465
|
+
* @param category {@link PoiCategory}. Not null.
|
|
466
|
+
*/
|
|
467
|
+
static fetchPoiCategoryIconNormal = category => {
|
|
468
|
+
return promiseWrapper(({
|
|
469
|
+
onSuccess,
|
|
470
|
+
onError
|
|
471
|
+
}) => {
|
|
472
|
+
RNCSitumPlugin.fetchPoiCategoryIconNormal(category, onSuccess, onError);
|
|
473
|
+
});
|
|
474
|
+
};
|
|
475
|
+
|
|
476
|
+
/**
|
|
477
|
+
* Get the selected {@link PoiIcon} for a {@link PoiCategory}
|
|
478
|
+
*
|
|
479
|
+
* @param category {@link PoiCategory}. Not null.
|
|
480
|
+
*/
|
|
481
|
+
static fetchPoiCategoryIconSelected = category => {
|
|
482
|
+
return promiseWrapper(({
|
|
483
|
+
onSuccess,
|
|
484
|
+
onError
|
|
485
|
+
}) => {
|
|
486
|
+
RNCSitumPlugin.fetchPoiCategoryIconSelected(category, onSuccess, onError);
|
|
487
|
+
});
|
|
488
|
+
};
|
|
489
|
+
|
|
490
|
+
/**
|
|
491
|
+
* Download the indoor {@link Poi}s of a {@link Building}
|
|
492
|
+
*
|
|
493
|
+
* @param building {@link Building}
|
|
494
|
+
*/
|
|
495
|
+
static fetchIndoorPOIsFromBuilding = building => {
|
|
496
|
+
return promiseWrapper(({
|
|
497
|
+
onSuccess,
|
|
498
|
+
onError
|
|
499
|
+
}) => {
|
|
500
|
+
RNCSitumPlugin.fetchIndoorPOIsFromBuilding(building, onSuccess, onError);
|
|
501
|
+
});
|
|
502
|
+
};
|
|
503
|
+
|
|
504
|
+
/**
|
|
505
|
+
* Download the outdoor {@link Poi}s of a {@link Building}
|
|
506
|
+
*
|
|
507
|
+
* @param building {@link Building}
|
|
508
|
+
*/
|
|
509
|
+
static fetchOutdoorPOIsFromBuilding = building => {
|
|
510
|
+
return promiseWrapper(({
|
|
511
|
+
onSuccess,
|
|
512
|
+
onError
|
|
513
|
+
}) => {
|
|
514
|
+
RNCSitumPlugin.fetchOutdoorPOIsFromBuilding(building, onSuccess, onError);
|
|
515
|
+
});
|
|
516
|
+
};
|
|
517
|
+
|
|
518
|
+
/**
|
|
519
|
+
* Starts positioning.
|
|
520
|
+
*
|
|
521
|
+
* @param {LocationRequest} locationRequest Positioning options to configure how positioning will behave
|
|
522
|
+
*/
|
|
523
|
+
static requestLocationUpdates = locationRequest => {
|
|
524
|
+
return exceptionWrapper(() => {
|
|
525
|
+
if (SitumPlugin.positioningIsRunning()) return;
|
|
526
|
+
RNCSitumPlugin.startPositioning(locationRequest || {});
|
|
527
|
+
positioningRunning = true;
|
|
528
|
+
});
|
|
529
|
+
};
|
|
530
|
+
|
|
531
|
+
/**
|
|
532
|
+
* Stops positioning, removing all location updates
|
|
533
|
+
*/
|
|
534
|
+
static removeLocationUpdates = () => {
|
|
535
|
+
return exceptionWrapper(() => {
|
|
536
|
+
if (!SitumPlugin.positioningIsRunning()) return;
|
|
537
|
+
RNCSitumPlugin.stopPositioning(response => {
|
|
538
|
+
if (response.success) {
|
|
539
|
+
positioningRunning = false;
|
|
540
|
+
} else {
|
|
541
|
+
throw "Situm > hook > Could not stop positioning";
|
|
542
|
+
}
|
|
543
|
+
});
|
|
544
|
+
});
|
|
545
|
+
};
|
|
546
|
+
|
|
547
|
+
/**
|
|
548
|
+
* Calculates a route between two points. The result is provided
|
|
549
|
+
* asynchronously using the callback.
|
|
550
|
+
*
|
|
551
|
+
* @param building {@link Building}
|
|
552
|
+
* @param from {@link Point} route origin
|
|
553
|
+
* @param to {@link Point} route destination
|
|
554
|
+
* @param directionOptions {@link DirectionsOptions}
|
|
555
|
+
*/
|
|
556
|
+
static requestDirections = (building, from, to, directionOptions) => {
|
|
557
|
+
return promiseWrapper(({
|
|
558
|
+
onSuccess,
|
|
559
|
+
onError
|
|
560
|
+
}) => {
|
|
561
|
+
const params = [building, from, to, directionOptions || {}];
|
|
562
|
+
RNCSitumPlugin.requestDirections(params, onSuccess, onError);
|
|
563
|
+
});
|
|
564
|
+
};
|
|
565
|
+
|
|
566
|
+
/**
|
|
567
|
+
* Set the navigation params, and the listener that receives the updated
|
|
568
|
+
* navigation progress.
|
|
569
|
+
*
|
|
570
|
+
* Can only exist one navigation with one listener at a time. If this method was
|
|
571
|
+
* previously invoked, but removeLocationUpdates() wasn't, removeLocationUpdates()
|
|
572
|
+
* is called internally.
|
|
573
|
+
*
|
|
574
|
+
* @param options {@link NavigationRequest}
|
|
575
|
+
*/
|
|
576
|
+
static requestNavigationUpdates = options => {
|
|
577
|
+
return exceptionWrapper(() => {
|
|
578
|
+
RNCSitumPlugin.requestNavigationUpdates(options || {});
|
|
579
|
+
navigationRunning = true;
|
|
580
|
+
});
|
|
581
|
+
};
|
|
582
|
+
|
|
583
|
+
/**
|
|
584
|
+
* Informs NavigationManager object the change of the user's location
|
|
585
|
+
*
|
|
586
|
+
* @param location new {@link Location} of the user. If null, nothing is done
|
|
587
|
+
*/
|
|
588
|
+
static updateNavigationWithLocation = location => {
|
|
589
|
+
return exceptionWrapper(({
|
|
590
|
+
onSuccess,
|
|
591
|
+
onError
|
|
592
|
+
}) => {
|
|
593
|
+
if (!SitumPlugin.navigationIsRunning()) {
|
|
594
|
+
throw "Situm > hook > No active navigation";
|
|
595
|
+
}
|
|
596
|
+
RNCSitumPlugin.updateNavigationWithLocation(location, onSuccess, onError);
|
|
597
|
+
});
|
|
598
|
+
};
|
|
599
|
+
|
|
600
|
+
/**
|
|
601
|
+
* Removes all location updates. This removes the internal state of the manager,
|
|
602
|
+
* including the listener provided in requestNavigationUpdates(NavigationRequest,
|
|
603
|
+
* NavigationListener), so it won't receive more progress updates.
|
|
604
|
+
*
|
|
605
|
+
*/
|
|
606
|
+
static removeNavigationUpdates = () => {
|
|
607
|
+
return promiseWrapper(({
|
|
608
|
+
onCallback
|
|
609
|
+
}) => {
|
|
610
|
+
if (!SitumPlugin.navigationIsRunning()) return;
|
|
611
|
+
navigationRunning = false;
|
|
612
|
+
RNCSitumPlugin.removeNavigationUpdates(response => {
|
|
613
|
+
onCallback(response, "Failed to remove navigation updates");
|
|
614
|
+
});
|
|
615
|
+
});
|
|
616
|
+
};
|
|
617
|
+
|
|
618
|
+
/**
|
|
619
|
+
* Requests a real time devices positions
|
|
620
|
+
*
|
|
621
|
+
* @param realtimeUpdates callback to use when new device positions are updated
|
|
622
|
+
* @param error callback to use when an error on navigation udpates raises
|
|
623
|
+
* @param options Represents the configuration for getting realtime devices positions in
|
|
624
|
+
*/
|
|
625
|
+
|
|
626
|
+
static requestRealTimeUpdates = (realtimeUpdates, error, options) => {
|
|
627
|
+
return exceptionWrapper(() => {
|
|
628
|
+
RNCSitumPlugin.requestRealTimeUpdates(options || {});
|
|
629
|
+
realtimeSubscriptions.push([SitumPluginEventEmitter.addListener("realtimeUpdated", realtimeUpdates), error ? SitumPluginEventEmitter.addListener("realtimeError", error || logError) : null]);
|
|
630
|
+
});
|
|
631
|
+
};
|
|
632
|
+
|
|
633
|
+
/**
|
|
634
|
+
* Removes all real time updates listners.
|
|
635
|
+
*
|
|
636
|
+
* @param _callback
|
|
637
|
+
*/
|
|
638
|
+
static removeRealTimeUpdates = _callback => {
|
|
639
|
+
return exceptionWrapper(() => {
|
|
640
|
+
realtimeSubscriptions = [];
|
|
641
|
+
RNCSitumPlugin.removeRealTimeUpdates();
|
|
642
|
+
});
|
|
643
|
+
};
|
|
644
|
+
|
|
645
|
+
/**
|
|
646
|
+
* Checks if a point is inside a {@link Geofence}
|
|
647
|
+
*
|
|
648
|
+
*/
|
|
649
|
+
static checkIfPointInsideGeofence = (request, callback) => {
|
|
650
|
+
RNCSitumPlugin.checkIfPointInsideGeofence(request, callback || (() => {}));
|
|
651
|
+
};
|
|
652
|
+
|
|
653
|
+
/**
|
|
654
|
+
* Automatically assists users in resolving app-related permission and sensor issues.
|
|
655
|
+
*
|
|
656
|
+
* This method tells the native SDKs to present a user interface that explains detected
|
|
657
|
+
* configuration issues and guides users through the required steps to resolve them,
|
|
658
|
+
* following best practices for runtime permission requests.
|
|
659
|
+
*
|
|
660
|
+
* Issues addressed include:
|
|
661
|
+
* - Missing permissions for Location or Bluetooth.
|
|
662
|
+
* - Disabled Location or Bluetooth sensors.
|
|
663
|
+
*
|
|
664
|
+
* Use the <code>userHelperOptions</code> parameter to configure the available options.
|
|
665
|
+
* Call {@link enableUserHelper} as a shortcut to enable the user helper with default configuration.
|
|
666
|
+
* Call {@link disableUserHelper} as a shortcut to disable the user helper.
|
|
667
|
+
*
|
|
668
|
+
* @param {UserHelperOptions} userHelperOptions - Options for the user helper.
|
|
669
|
+
*/
|
|
670
|
+
static configureUserHelper = userHelperOptions => {
|
|
671
|
+
_registerCallbacks();
|
|
672
|
+
return exceptionWrapper(({
|
|
673
|
+
onSuccess,
|
|
674
|
+
onError
|
|
675
|
+
}) => {
|
|
676
|
+
RNCSitumPlugin.configureUserHelper(userHelperOptions, onSuccess, onError);
|
|
677
|
+
});
|
|
678
|
+
};
|
|
679
|
+
|
|
680
|
+
/**
|
|
681
|
+
* Enables the user helper.
|
|
682
|
+
*
|
|
683
|
+
* Shortcut for {@link configureUserHelper} with <code>{enabled: true}</code>.
|
|
684
|
+
*/
|
|
685
|
+
static enableUserHelper = () => {
|
|
686
|
+
SitumPlugin.configureUserHelper({
|
|
687
|
+
enabled: true,
|
|
688
|
+
colorScheme: undefined
|
|
689
|
+
});
|
|
690
|
+
};
|
|
691
|
+
|
|
692
|
+
/**
|
|
693
|
+
* Disables the user helper.
|
|
694
|
+
*
|
|
695
|
+
* Shortcut for {@link configureUserHelper} with <code>{enabled: false}</code>.
|
|
696
|
+
*
|
|
697
|
+
*/
|
|
698
|
+
static disableUserHelper = () => {
|
|
699
|
+
SitumPlugin.configureUserHelper({
|
|
700
|
+
enabled: false,
|
|
701
|
+
colorScheme: undefined
|
|
702
|
+
});
|
|
703
|
+
};
|
|
704
|
+
|
|
705
|
+
/**
|
|
706
|
+
* INTERNAL METHOD.
|
|
707
|
+
*
|
|
708
|
+
* Update SDK with the viewer navigation states.
|
|
709
|
+
* Do not use this method as it is intended for internal use
|
|
710
|
+
* by the map viewer module.
|
|
711
|
+
*
|
|
712
|
+
* @param externalNavigation
|
|
713
|
+
*/
|
|
714
|
+
static updateNavigationState = externalNavigation => {
|
|
715
|
+
return exceptionWrapper(() => {
|
|
716
|
+
RNCSitumPlugin.updateNavigationState(externalNavigation);
|
|
717
|
+
});
|
|
718
|
+
};
|
|
719
|
+
|
|
720
|
+
/**
|
|
721
|
+
* INTERNAL METHOD.
|
|
722
|
+
*
|
|
723
|
+
* Validate if the mapView internal settings have been properly configured
|
|
724
|
+
* Do not use this method as it is intended for internal use
|
|
725
|
+
* by the map viewer module.
|
|
726
|
+
*
|
|
727
|
+
* @param validateMapViewProjectSettings
|
|
728
|
+
*/
|
|
729
|
+
static validateMapViewProjectSettings = () => {
|
|
730
|
+
if (Platform.OS === "ios") {
|
|
731
|
+
return exceptionWrapper(() => {
|
|
732
|
+
RNCSitumPlugin.validateMapViewProjectSettings();
|
|
733
|
+
});
|
|
734
|
+
}
|
|
735
|
+
};
|
|
736
|
+
|
|
737
|
+
/**
|
|
738
|
+
* INTERNAL METHOD.
|
|
739
|
+
*
|
|
740
|
+
* Set a native MethodCall delegate. Do not use this method as it is intended for internal use by the map viewer module.
|
|
741
|
+
* @param callback
|
|
742
|
+
*/
|
|
743
|
+
static internalSetMethodCallMapDelegate = callback => {
|
|
744
|
+
internalMethodCallMapDelegate = callback;
|
|
745
|
+
const lastValues = DelegatedStateManager.getInstance().getValues();
|
|
746
|
+
// Forward last received values as soon as possible:
|
|
747
|
+
if (lastValues.location) {
|
|
748
|
+
internalMethodCallMapDelegate(new InternalCall(InternalCallType.LOCATION, lastValues.location));
|
|
749
|
+
}
|
|
750
|
+
if (lastValues.status) {
|
|
751
|
+
internalMethodCallMapDelegate(new InternalCall(InternalCallType.LOCATION_STATUS, lastValues.status));
|
|
752
|
+
}
|
|
753
|
+
if (lastValues.error) {
|
|
754
|
+
internalMethodCallMapDelegate(new InternalCall(InternalCallType.LOCATION_ERROR, lastValues.error));
|
|
755
|
+
}
|
|
756
|
+
};
|
|
757
|
+
|
|
758
|
+
//-----------------------------------------------------------------------------//
|
|
759
|
+
//-----------------------------GEOFENCES CALLBACKS-----------------------------//
|
|
760
|
+
//-----------------------------------------------------------------------------//
|
|
761
|
+
|
|
762
|
+
/**
|
|
763
|
+
* Callback that notifies when the user enters a {@link Geofence}.
|
|
764
|
+
*
|
|
765
|
+
* In order to use correctly these callbacks you must know the following:
|
|
766
|
+
* - Positioning geofences (with trainer_metadata custom field) won't be notified.
|
|
767
|
+
* - These callbacks only work with indoor locations. Any outdoor location will
|
|
768
|
+
* produce a call to onExitedGeofences with the last positioned geofences as argument.
|
|
769
|
+
*
|
|
770
|
+
* @param callback the function called when the user enters a {@link Geofence}
|
|
771
|
+
*/
|
|
772
|
+
static onEnterGeofences = callback => {
|
|
773
|
+
RNCSitumPlugin.onEnterGeofences();
|
|
774
|
+
// Adopts SDK behavior (setter):
|
|
775
|
+
enterGeofencesCallback = callback;
|
|
776
|
+
};
|
|
777
|
+
|
|
778
|
+
/**
|
|
779
|
+
* Callback that notifies when the user exits a {@link Geofence}.
|
|
780
|
+
*
|
|
781
|
+
* In order to use correctly these callbacks you must know the following:
|
|
782
|
+
* - Positioning geofences (with trainer_metadata custom field) won't be notified.
|
|
783
|
+
* - These callbacks only work with indoor locations. Any outdoor location will
|
|
784
|
+
* produce a call to onExitedGeofences with the last positioned geofences as argument.
|
|
785
|
+
*
|
|
786
|
+
* @param callback the function called when the user exits a {@link Geofence}
|
|
787
|
+
*/
|
|
788
|
+
static onExitGeofences = callback => {
|
|
789
|
+
RNCSitumPlugin.onExitGeofences();
|
|
790
|
+
exitGeofencesCallback = callback;
|
|
791
|
+
};
|
|
792
|
+
|
|
793
|
+
//-----------------------------------------------------------------------------//
|
|
794
|
+
//-----------------------------LOCATION CALLBACKS------------------------------//
|
|
795
|
+
//-----------------------------------------------------------------------------//
|
|
796
|
+
|
|
797
|
+
/**
|
|
798
|
+
* Callback that notifies when the user {@link Location} changes.
|
|
799
|
+
*
|
|
800
|
+
* @param callback the function called when the user {@link Location} changes
|
|
801
|
+
*/
|
|
802
|
+
static onLocationUpdate = callback => {
|
|
803
|
+
locationCallback = callback;
|
|
804
|
+
};
|
|
805
|
+
|
|
806
|
+
/**
|
|
807
|
+
* Callback that notifies when the user {@link LocationStatus} changes.
|
|
808
|
+
*
|
|
809
|
+
* @param callback the function called when the user {@link LocationStatus} changes
|
|
810
|
+
*/
|
|
811
|
+
static onLocationStatus = callback => {
|
|
812
|
+
locationStatusCallback = callback;
|
|
813
|
+
};
|
|
814
|
+
|
|
815
|
+
/**
|
|
816
|
+
* Callback that notifies when there is an error while the user is positioining.
|
|
817
|
+
*
|
|
818
|
+
* @param callback the function called when there is an error
|
|
819
|
+
*/
|
|
820
|
+
static onLocationError = callback => {
|
|
821
|
+
locationErrorCallback = callback;
|
|
822
|
+
};
|
|
823
|
+
|
|
824
|
+
/**
|
|
825
|
+
* Callback that notifies when the user stops positioning.
|
|
826
|
+
*
|
|
827
|
+
* @param callback the function called when the user stops positioning.
|
|
828
|
+
*/
|
|
829
|
+
static onLocationStopped = callback => {
|
|
830
|
+
locationStoppedCallback = callback;
|
|
831
|
+
};
|
|
832
|
+
|
|
833
|
+
//-----------------------------------------------------------------------------//
|
|
834
|
+
//-----------------------------NAVIGATION CALLBACKS----------------------------//
|
|
835
|
+
//-----------------------------------------------------------------------------//
|
|
836
|
+
|
|
837
|
+
/**
|
|
838
|
+
* Callback that notifies when navigation starts.
|
|
839
|
+
*
|
|
840
|
+
* @param callback a function that returns the initial {@link Route} by parameters.
|
|
841
|
+
*/
|
|
842
|
+
static onNavigationStart = callback => {
|
|
843
|
+
navigationStartedCallback = callback;
|
|
844
|
+
};
|
|
845
|
+
|
|
846
|
+
/**
|
|
847
|
+
* Callback that notifies every progress the user makes while navigating.
|
|
848
|
+
*
|
|
849
|
+
* @param callback a function that returns the {@link NavigationProgress} by parameters.
|
|
850
|
+
*/
|
|
851
|
+
static onNavigationProgress = callback => {
|
|
852
|
+
navigationProgressCallback = callback;
|
|
853
|
+
};
|
|
854
|
+
|
|
855
|
+
/**
|
|
856
|
+
* Callback that notifies when the user reaches the destination POI.
|
|
857
|
+
*
|
|
858
|
+
* @param callback a function that returns the completed {@link Route} by parameters.
|
|
859
|
+
*/
|
|
860
|
+
static onNavigationDestinationReached = callback => {
|
|
861
|
+
navigationDestinationReachedCallback = callback;
|
|
862
|
+
};
|
|
863
|
+
|
|
864
|
+
/**
|
|
865
|
+
* Callback that notifies when the user gets out of the current route.
|
|
866
|
+
*
|
|
867
|
+
* @param callback the function called when the user gets out of the current route.
|
|
868
|
+
*/
|
|
869
|
+
static onNavigationOutOfRoute = callback => {
|
|
870
|
+
navigationOutOfRouteCallback = callback;
|
|
871
|
+
};
|
|
872
|
+
|
|
873
|
+
/**
|
|
874
|
+
* @deprecated
|
|
875
|
+
* DEPRECATED: Use instead onNavigationCancellation()
|
|
876
|
+
* and onNavigationDestinationReached() to determine why did the navigation end.
|
|
877
|
+
*
|
|
878
|
+
* Callback that notifies when the user finishes the route.
|
|
879
|
+
*
|
|
880
|
+
* @param callback the function called when the user finishes the route.
|
|
881
|
+
*/
|
|
882
|
+
static onNavigationFinished = callback => {
|
|
883
|
+
navigationFinishedCallback = callback;
|
|
884
|
+
};
|
|
885
|
+
|
|
886
|
+
/**
|
|
887
|
+
* Callback that notifies when the user does cancel the navigation.
|
|
888
|
+
*
|
|
889
|
+
* @param callback the function called when the user cancels the navigation.
|
|
890
|
+
*/
|
|
891
|
+
static onNavigationCancellation = callback => {
|
|
892
|
+
navigationCancellationCallback = callback;
|
|
893
|
+
};
|
|
894
|
+
|
|
895
|
+
/**
|
|
896
|
+
* Callback that notifies when there is an error during navigation.
|
|
897
|
+
*
|
|
898
|
+
* @param callback the function called when there is an error during navigation.
|
|
899
|
+
*/
|
|
900
|
+
static onNavigationError = callback => {
|
|
901
|
+
navigationErrorCallback = callback;
|
|
902
|
+
};
|
|
903
|
+
}
|
|
904
|
+
//# sourceMappingURL=index.js.map
|