@situm/cordova 3.16.1 → 3.17.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.
@@ -3,4 +3,10 @@
3
3
  ### Updated
4
4
  - Updated Android example app targetSdkVersion and compileSdkVersion from 33 to 37.
5
5
  - Updated gradle wrapper version from 8.4 to 8.13.
6
- - Updated AGP (com.android.application) from 8.0.0 to 8.13.2.
6
+ - Updated AGP (com.android.application) from 8.0.0 to 8.13.2.
7
+
8
+ ### Removed
9
+ - Removed the legacy routing and navigation bridge between the MapView and the native SDK, as the MapView now always uses its own routing and navigation library.
10
+
11
+ ### Changed
12
+ - Deprecated the `use-viewer-navigation` MapView attribute. It is now ignored and kept only for backward compatibility.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@situm/cordova",
3
- "version": "3.16.1",
3
+ "version": "3.17.0",
4
4
  "description": "Situm Wayfinding for Capacitor and Cordova. Integrate plug&play indoor navigation experience with floorplans, POIs, routes and turn-by-turn directions in no time. With the power of Situm.",
5
5
  "private": false,
6
6
  "repository": "https://github.com/situmtech/cordova",
package/plugin.xml CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  <plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
4
4
  id="@situm/cordova"
5
- version="3.16.1">
5
+ version="3.17.0">
6
6
  <name>Situm Cordova plugin Official</name>
7
7
  <description>This is the stable branch.</description>
8
8
  <license>MIT</license>
@@ -49,10 +49,7 @@ class MapViewControllerImpl {
49
49
  _onLoadCallback = undefined;
50
50
  _onPoiSelectedCallback = undefined;
51
51
  _onPoiDeselectedCallback = undefined;
52
- _buildings = undefined;
53
52
  _mapView = undefined;
54
- _isNavigating = false;
55
- _navigationType = "";
56
53
  _isWaitingForAuth = false;
57
54
 
58
55
  constructor() {
@@ -62,21 +59,12 @@ class MapViewControllerImpl {
62
59
 
63
60
  _prepare(mapView) {
64
61
  this._mapView = mapView;
65
- let useViewerNavigation = mapView.getAttribute('use-viewer-navigation')
66
- ? mapView.getAttribute('use-viewer-navigation')
67
- : null;
68
- if (useViewerNavigation != null) {
69
- this._setNavigationType(useViewerNavigation);
70
- }
71
- }
72
62
 
73
- _setNavigationType(useViewerNavigation) {
74
- if (useViewerNavigation) {
75
- if (useViewerNavigation === "true") {
76
- this._navigationType = 'webAssembly';
77
- } else {
78
- this._navigationType = 'sdk';
79
- }
63
+ if (mapView.hasAttribute('use-viewer-navigation')) {
64
+ console.warn(
65
+ 'Situm> MapView> [!] The "use-viewer-navigation" attribute is deprecated and ignored. ' +
66
+ 'The MapView always uses its own routing and navigation library.'
67
+ );
80
68
  }
81
69
  }
82
70
 
@@ -127,17 +115,6 @@ class MapViewControllerImpl {
127
115
 
128
116
  _handleOnLocationUpdate(payload) {
129
117
  this._sendMessageToViewer('location.update', payload);
130
- if (this._isNavigating) {
131
- Situm.updateNavigationWithLocation(
132
- [payload],
133
- () => {
134
- // Do nothing.
135
- },
136
- () => {
137
- console.error('Error at updateNavigationWithLocation');
138
- }
139
- );
140
- }
141
118
  }
142
119
 
143
120
  _handleOnLocationStatus(payload) {
@@ -177,15 +154,6 @@ class MapViewControllerImpl {
177
154
  };
178
155
  this._onPoiDeselectedCallback(poiDeselectedResult);
179
156
  break;
180
- case 'directions.requested':
181
- this._onDirectionsRequested(m.payload);
182
- break;
183
- case 'navigation.requested':
184
- this._onNavigationRequested(m.payload);
185
- break;
186
- case 'navigation.stopped':
187
- this._onNavigationCancel();
188
- break;
189
157
  case 'viewer.navigation.started':
190
158
  this._onViewerNavigationStarted(m.payload);
191
159
  break;
@@ -211,9 +179,6 @@ class MapViewControllerImpl {
211
179
  this._onLoadCallback(this);
212
180
  console.debug('Map is ready!');
213
181
  }
214
- if (this._navigationType) {
215
- this._sendNavigationConfig(this._navigationType);
216
- }
217
182
  this._sendMessageToViewer('app.set_config_item', [
218
183
  {key: "internal.tts.engine", value: "mobile"},
219
184
  // Any other config item here...
@@ -240,180 +205,34 @@ class MapViewControllerImpl {
240
205
  );
241
206
  }
242
207
 
243
- // Fetch the given building and return it or undefined if not found.
244
- _ensureBuilding(buildingId, callback) {
245
- if (this._buildings) {
246
- let building = this._buildings.find(
247
- (b) => b.buildingIdentifier == buildingId
248
- );
249
- callback(building);
250
- } else {
251
- // Fetch buildings and calculate route.
252
- cordova.plugins.Situm.fetchBuildings(
253
- (res) => {
254
- this._buildings = res;
255
- let building = this._buildings.find(
256
- (b) => b.buildingIdentifier == buildingId
257
- );
258
- callback(building);
259
- },
260
- (err) => {
261
- callback(undefined);
262
- }
263
- );
264
- }
265
- }
266
-
267
- // DIRECTIONS:
268
-
269
- _onDirectionsRequested(payload) {
270
- let directionsRequest = payload.directionsRequest;
271
- let mapViewerData = {
272
- identifier: payload.identifier,
273
- originIdentifier: payload.originIdentifier,
274
- destinationIdentifier: payload.destinationIdentifier,
275
- type: directionsRequest.accessibilityMode
276
- };
277
- this._ensureBuilding(payload.buildingIdentifier, (building) => {
278
- if (building) {
279
- Situm.requestDirections(
280
- [
281
- building,
282
- directionsRequest.from,
283
- directionsRequest.to,
284
- directionsRequest
285
- ],
286
- (route) => {
287
- this._sendMessageToViewer('directions.update', {
288
- ...route,
289
- ...mapViewerData
290
- });
291
- },
292
- (error) => {
293
- this._sendMessageToViewer('directions.update', {
294
- error: -1,
295
- identifier: mapViewerData.identifier
296
- });
297
- }
298
- );
299
- } else {
300
- this._sendMessageToViewer('directions.update', {
301
- error: -1,
302
- identifier: payload.identifier
303
- });
304
- }
305
- });
306
- }
307
-
308
208
  // NAVIGATION
309
209
 
310
- _onNavigationRequested(payload) {
311
- let directionsRequest = payload.directionsRequest;
312
- let mapViewerData = {
313
- identifier: payload.identifier,
314
- originIdentifier: payload.originIdentifier,
315
- destinationIdentifier: payload.destinationIdentifier,
316
- type: directionsRequest.accessibilityMode
317
- };
318
- let navigationRequest = payload.navigationRequest;
319
- this._ensureBuilding(payload.buildingIdentifier, (building) => {
320
- // Request directions again to update the calculated route on the native side.
321
- Situm.requestDirections(
322
- [
323
- building,
324
- directionsRequest.from,
325
- directionsRequest.to,
326
- directionsRequest
327
- ],
328
- (route) => {
329
- this._isNavigating = true;
330
- this._sendMessageToViewer('navigation.start', {
331
- ...route,
332
- ...mapViewerData
333
- });
334
- Situm.requestNavigationUpdates(
335
- [navigationRequest],
336
- (progress) => {
337
- // Navigation is working, handle different progress types:
338
- if (progress.type == 'progress') {
339
- progress.type = 'PROGRESS'; // The map-viewer waits for an upper case "type".
340
- this._sendMessageToViewer('navigation.update', progress);
341
- } else if (progress.type == 'destinationReached') {
342
- this._sendMessageToViewer('navigation.update', {
343
- type: 'DESTINATION_REACHED'
344
- });
345
- this._isNavigating = false;
346
- } else if (progress.type == 'userOutsideRoute') {
347
- this._sendMessageToViewer('navigation.update', {
348
- type: 'OUT_OF_ROUTE'
349
- });
350
- }
351
- },
352
- (error) => {
353
- this._sendMessageToViewer('directions.update', {
354
- error: -1,
355
- identifier: mapViewerData.identifier
356
- });
357
- this._isNavigating = false;
358
- }
359
- );
360
- },
361
- (error) => {
362
- this._sendMessageToViewer('directions.update', {
363
- error: -1,
364
- identifier: mapViewerData.identifier
365
- });
366
- this._isNavigating = false;
367
- }
368
- );
369
- });
370
- }
371
-
372
- _onNavigationCancel() {
373
- this._isNavigating = false;
374
- Situm.removeNavigationUpdates(
375
- () => {
376
- // Do nothing.
377
- },
378
- () => {
379
- console.error('Error removing navigation updates.');
380
- }
381
- );
382
- }
383
-
384
210
  _onViewerNavigationStarted(webPayload) {
385
- if (this._isNavigating) {
386
- return;
387
- }
388
- this._isNavigating = true;
389
211
  let externalNavigation = { messageType: "NavigationStarted", payload: webPayload};
390
212
  Situm.updateNavigationState(externalNavigation, () => {}, () => {});
391
213
  }
392
214
 
393
215
  _onViewerNavigationUpdated(webPayload) {
394
- if (!this._isNavigating) {
395
- return;
396
- }
397
- if (webPayload.type == "PROGRESS") {
398
- let externalNavigation = { messageType: "NavigationUpdated", payload: webPayload};
399
- Situm.updateNavigationState(externalNavigation, () => {}, () => {});
400
- } else if (webPayload.type == "DESTINATION_REACHED") {
401
- let externalNavigation = { messageType: "DestinationReached", payload: webPayload};
402
- Situm.updateNavigationState(externalNavigation, () => {}, () => {});
403
- this._isNavigating = false;
404
- } else if (webPayload.type == "OUT_OF_ROUTE") {
405
- let externalNavigation = { messageType: "OutsideRoute", payload: webPayload};
406
- Situm.updateNavigationState(externalNavigation, () => {}, () => {});
407
- this._isNavigating = false;
216
+ let messageType;
217
+ switch (webPayload.type) {
218
+ case 'PROGRESS':
219
+ messageType = 'NavigationUpdated';
220
+ break;
221
+ case 'DESTINATION_REACHED':
222
+ messageType = 'DestinationReached';
223
+ break;
224
+ case 'OUT_OF_ROUTE':
225
+ messageType = 'OutsideRoute';
226
+ break;
227
+ default:
228
+ return;
408
229
  }
409
-
230
+
231
+ const externalNavigation = { messageType, payload: webPayload };
232
+ Situm.updateNavigationState(externalNavigation, () => { }, () => { });
410
233
  }
411
234
 
412
235
  _onViewerNavigationStopped(webPayload) {
413
- if (!this._isNavigating) {
414
- return;
415
- }
416
- this._isNavigating = false;
417
236
  let externalNavigation = { messageType: "NavigationCancelled", payload: webPayload};
418
237
  Situm.updateNavigationState(externalNavigation, () => {}, () => {});
419
238
  }
@@ -440,10 +259,6 @@ class MapViewControllerImpl {
440
259
  });
441
260
  }
442
261
 
443
- _sendNavigationConfig(navigationType) {
444
- this._sendMessageToViewer('app.set_config_item', [{key:'internal.navigationLibrary',value:navigationType}]);
445
- }
446
-
447
262
  /**
448
263
  * Allows you to navigate to a {@link POI} programmatically in your venue. This will cause the {@link MapView} to start navigation mode displaying the route between the user's location and the POI specified by parameters.
449
264
  *