@situm/cordova 3.4.1 → 3.4.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/.prettierrc ADDED
@@ -0,0 +1,10 @@
1
+ {
2
+ "printWidth": 80,
3
+ "tabWidth": 2,
4
+ "singleQuote": true,
5
+ "semi": true,
6
+ "trailingComma": "none",
7
+ "bracketSpacing": true,
8
+ "jsxBracketSameLine": false,
9
+ "arrowParens": "always"
10
+ }
package/README.md CHANGED
@@ -2,12 +2,22 @@
2
2
  <h1 align="center">Situm Cordova Plugin</h1>
3
3
  </p>
4
4
 
5
- Situm Cordova Plugin is a set of utilities that allow any developer to build Cordova location based apps using Situm's indoor positioning system. Among many other capabilities, apps developed with Situm Cordova Plugin will be able to:
5
+ [Situm Wayfinding](https://situm.com/wayfinding) for Capacitor and Cordova. Integrate plug&play navigation experience with floorplans, POIs, routes and turn-by-turn directions in no time. With the power of [Situm](https://www.situm.com/).
6
6
 
7
- - Obtain information related to buildings where Situm's positioning system is already configured: floorplans, points of interest, geotriggered events, etc.
8
- - Retrieve the location of the smartphone inside these buildings (position, orientation, and floor where the smartphone is).
9
- - Compute a route from a point A (e.g. where the smartphone is) to a point B (e.g. any point of interest within the building).
10
- - Trigger notifications when the user enters a certain area.
7
+ This plugin has two parts:
8
+
9
+ - The base SDK, the building blocks that allow you to:
10
+
11
+ - obtain information related to buildings where Situm's positioning system is already configured: floorplans, points of interest, geotriggered events, etc.
12
+ - retrieve the location of the smartphone inside these buildings (position, orientation, and floor where the smartphone is).
13
+ - compute a route from a point A (e.g. where the smartphone is) to a point B (e.g. any point of interest within the building).
14
+ - trigger notifications when the user enters a certain area.
15
+
16
+ - A full featured and easy to integrate UI component (`<map-view>`) that allows you to:
17
+ - show your cartography on a map
18
+ - show the user location on the map
19
+ - calculate point-to-point wayfinging routes
20
+ - explore points of interest on your buildings on the map
11
21
 
12
22
  <div align="center" style="text-align:center">
13
23
 
@@ -77,7 +87,7 @@ Situm Cordova Plugin is licensed under [MIT License](https://opensource.org/lice
77
87
  Log in into your Situm Account. This key is generated in Situm Dashboard. Return true if apiKey was set successfully, otherwise false
78
88
 
79
89
  ```js
80
- cordova.plugins.Situm.setApiKey("SITUM_EMAIL", "SITUM_API_KEY");
90
+ cordova.plugins.Situm.setApiKey('SITUM_EMAIL', 'SITUM_API_KEY');
81
91
  ```
82
92
 
83
93
  #### - setUserPass
@@ -85,7 +95,7 @@ cordova.plugins.Situm.setApiKey("SITUM_EMAIL", "SITUM_API_KEY");
85
95
  Provides user's email and password. Return true if apiKey was set successfully, otherwise false
86
96
 
87
97
  ```js
88
- cordova.plugins.Situm.setUserPass("SITUM_EMAIL", "SITUM_USER_PASS");
98
+ cordova.plugins.Situm.setUserPass('SITUM_EMAIL', 'SITUM_USER_PASS');
89
99
  ```
90
100
 
91
101
  #### - setRemoteConfig
@@ -106,10 +116,13 @@ cordova.plugins.Situm.setCacheMaxAge(1 * 60 * 60); // 1 hour
106
116
 
107
117
  #### - startPositioning
108
118
 
119
+ > [!WARNING]
120
+ > This method is deprecated, instead use [requestLocationUpdates](#--requestLocationUpdates).
121
+
109
122
  Starts the positioning system. In the success callback it can return:
110
123
 
111
- - [Location](https://developers.situm.com/sdk_documentation/cordova/jsdoc/latest/global.html#Location)
112
- - [LocationStatus](https://developers.situm.com/sdk_documentation/cordova/jsdoc/latest/global.html#LocationStatus)
124
+ - [Location](https://developers.situm.com/sdk_documentation/cordova/jsdoc/latest/global.html#Location).
125
+ - [LocationStatus](https://developers.situm.com/sdk_documentation/cordova/jsdoc/latest/global.html#LocationStatus).
113
126
 
114
127
  ```js
115
128
  locationOptions = {
@@ -128,8 +141,72 @@ cordova.plugins.Situm.startPositioning(locationOptions, (res: any) => {
128
141
  });
129
142
  ```
130
143
 
144
+ #### - requestLocationUpdates
145
+
146
+ Starts the positioning system. You can customize the positioning system by specifying a [LocationRequest](https://developers.situm.com/sdk_documentation/cordova/jsdoc/latest/global.html#LocationRequest) in the method parameters.
147
+
148
+ Use [onLocationUpdate()](#--onLocationUpdate) to receive updates of the user's location,
149
+ [onLocationStatus()](#--onLocationStatus) to receive updates of the positioning status
150
+ and [onLocationError()](#--onLocationError) to receive the possible errors that take place when positioning.
151
+
152
+ ```js
153
+ cordova.plugins.Situm.requestLocationUpdates(
154
+ {
155
+ buildingIdentifier = "YOUR_BUILDING_IDENTIFIER"
156
+ });
157
+ ```
158
+
159
+ #### - removeUpdates
160
+
161
+ Stop the positioning system.
162
+ This method returns a promise, so use the .then() and .catch() methods to know the result.
163
+
164
+ ```js
165
+ cordova.plugins.Situm.removeUpdates()
166
+ .then(() => {
167
+ // Positioning system has stopped successfully.
168
+ })
169
+ .catch((err: any) => {
170
+ // Error while stopping the positioning system.
171
+ });
172
+ ```
173
+
174
+ #### - onLocationUpdate
175
+
176
+ Use this callback to stay aware about the user's [Location](https://developers.situm.com/sdk_documentation/cordova/jsdoc/latest/global.html#Location).
177
+
178
+ ```js
179
+ cordova.plugins.Situm.onLocationUpdate((location: any) => {
180
+ console.log('The user has moved to: ' + location.position);
181
+ });
182
+ ```
183
+
184
+ #### - onLocationStatus
185
+
186
+ Use this callback to stay aware about the [LocationStatus](https://developers.situm.com/sdk_documentation/cordova/jsdoc/latest/global.html#LocationStatus) of the positioning system.
187
+
188
+ ```js
189
+ cordova.plugins.Situm.onLocationStatus((status: string) => {
190
+ console.log('New positioning status: ' + status);
191
+ });
192
+ ```
193
+
194
+ #### - onLocationError
195
+
196
+ Use this callback to stay aware about the errors the user might face when the positioning system starts.
197
+ See [onLocationError()](https://developers.situm.com/sdk_documentation/cordova/jsdoc/latest/situm#.onLocationError).
198
+
199
+ ```js
200
+ cordova.plugins.Situm.onLocationError((err: any) => {
201
+ console.log('Error received when positioning: ' + err);
202
+ });
203
+ ```
204
+
131
205
  #### - stopPositioning
132
206
 
207
+ > [!WARNING]
208
+ > This method is deprecated, instead use [removeUpdates](#--removeUpdates).
209
+
133
210
  Stop the positioning system on current active listener.
134
211
 
135
212
  ```js
@@ -329,7 +406,7 @@ directionRequest = [
329
406
  building, // Building in which you're positioning
330
407
  from, // Point where you want to start the route. You can pass a Point or a Location
331
408
  to, // Point where you want to finish the route
332
- {}, // Options to generate the route
409
+ {} // Options to generate the route
333
410
  ];
334
411
 
335
412
  cordova.plugins.Situm.requestDirections(
@@ -352,7 +429,7 @@ When you start feeding locations you can receive [NavigationProgress](https://de
352
429
  // Navigation request with example values
353
430
  navigationRequest = [
354
431
  (distanceToGoalThreshold = 10),
355
- (distanceToFloorChangeThreshold = 5),
432
+ (distanceToFloorChangeThreshold = 5)
356
433
  ];
357
434
  cordova.plugins.Situm.requestNavigationUpdates(
358
435
  navigationRequest,
@@ -394,7 +471,7 @@ Emits the [real time](https://developers.situm.com/sdk_documentation/cordova/jsd
394
471
  ```js
395
472
  const request = {
396
473
  building: building, //Building in which you want to be notified
397
- pollTime: 3000, // time in milliseconds
474
+ pollTime: 3000 // time in milliseconds
398
475
  };
399
476
  cordova.plugins.Situm.SitumPlugin.requestRealTimeUpdates(
400
477
  request,
@@ -462,11 +539,11 @@ cordova.plugins.MapView.onLoad((controller: any) => {
462
539
 
463
540
  // 2. Listen to events that take place inside our map like a poi being selected or deselected:
464
541
  controller.onPoiSelected((poiSelectedResult: any) => {
465
- console.log("EXAMPLE> onPoiSelected -> ", poiSelectedResult);
542
+ console.log('EXAMPLE> onPoiSelected -> ', poiSelectedResult);
466
543
  });
467
544
 
468
545
  controller.onPoiDeselected((poiDeselectedResult: any) => {
469
- console.log("EXAMPLE> onPoiDeselected -> ", poiDeselectedResult);
546
+ console.log('EXAMPLE> onPoiDeselected -> ', poiDeselectedResult);
470
547
  });
471
548
  });
472
549
  ```
@@ -482,7 +559,7 @@ Select a POI in the map.
482
559
  ```js
483
560
  cordova.plugins.MapView.onLoad((controller: any) => {
484
561
  // Once the MapView was loaded you can select a POI in our map by calling:
485
- controller.selectPoi("YOUR_POI_IDENTIFIER");
562
+ controller.selectPoi('YOUR_POI_IDENTIFIER');
486
563
  });
487
564
  ```
488
565
 
@@ -497,7 +574,7 @@ cordova.plugins.MapView.onLoad((controller: any) => {
497
574
  // Once the MapView was loaded you can navigate to a POI in our map.
498
575
  // Make sure to call this method once the user is positioning indoors in your building,
499
576
  // otherwise this method will have no effect.
500
- controller.navigateToPoi("YOUR_POI_IDENTIFIER");
577
+ controller.navigateToPoi('YOUR_POI_IDENTIFIER');
501
578
 
502
579
  // controller.navigateToPoi("YOUR_POI_IDENTIFIER", "CHOOSE_SHORTEST");
503
580
  });
@@ -514,7 +591,7 @@ Listen to the selection event of a POI.
514
591
  cordova.plugins.MapView.onLoad((controller: any) => {
515
592
  // Once the MapView was loaded you can listen to a POI being selected.
516
593
  controller.onPoiSelected((poiSelectedResult: any) => {
517
- console.log("EXAMPLE> onPoiSelected -> ", poiSelectedResult);
594
+ console.log('EXAMPLE> onPoiSelected -> ', poiSelectedResult);
518
595
  });
519
596
  });
520
597
  ```
@@ -529,7 +606,7 @@ Listen to listen to a POI being deselected.
529
606
  cordova.plugins.MapView.onLoad((controller: any) => {
530
607
  // Once the MapView was loaded you can listen to a POI being deselected.
531
608
  controller.onPoiDeselected((poiDeselectedResult: any) => {
532
- console.log("EXAMPLE> onPoiDeselected -> ", poiDeselectedResult);
609
+ console.log('EXAMPLE> onPoiDeselected -> ', poiDeselectedResult);
533
610
  });
534
611
  });
535
612
  ```
@@ -90,6 +90,15 @@ jobs:
90
90
  MAPVIEWERDOMAIN: $(MAPVIEWERDOMAIN)
91
91
  BUILDNUMBER: $(BUILDNUMBER)
92
92
 
93
+ - ${{ if ne(variables['Build.Reason'],'manual') }}:
94
+ - template: azure-templates/teams-notifier.yml@sys_kubernetes_templates
95
+ parameters:
96
+ channelId: $(releasesMobileChannelId)
97
+ teamID: $(releasesMobileTeamId)
98
+ messageType: "error"
99
+ message: "Hey Team, 🚨 our <strong>Capacitor Android Example App auto build</strong> just took a dive off the high board and belly-flopped! 🚨 Let's put on our lifeguard hats and dive in for a rescue mission! 🚑 Time to debug and bring that pipeline back to smooth sailing! 🛠️⚓ Alert level: High! Let's fix it! 🚨"
100
+
101
+
93
102
  #===============================================================
94
103
  # Job for iOS app
95
104
  #===============================================================
@@ -145,3 +154,10 @@ jobs:
145
154
  BUILDINGID: $(BUILDINGID)
146
155
  BUILDNUMBER: $(BUILDNUMBER)
147
156
 
157
+ - ${{ if ne(variables['Build.Reason'],'manual') }}:
158
+ - template: azure-templates/teams-notifier.yml@sys_kubernetes_templates
159
+ parameters:
160
+ channelId: $(releasesMobileChannelId)
161
+ teamID: $(releasesMobileTeamId)
162
+ messageType: "error"
163
+ message: "Hey Team, 🚨 our <strong>Capacitor iOS Example App auto build</strong> just took a dive off the high board and belly-flopped! 🚨 Let's put on our lifeguard hats and dive in for a rescue mission! 🚑 Time to debug and bring that pipeline back to smooth sailing! 🛠️⚓ Alert level: High! Let's fix it! 🚨"
@@ -0,0 +1,78 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Scheme
3
+ LastUpgradeVersion = "1420"
4
+ version = "1.3">
5
+ <BuildAction
6
+ parallelizeBuildables = "YES"
7
+ buildImplicitDependencies = "YES">
8
+ <BuildActionEntries>
9
+ <BuildActionEntry
10
+ buildForTesting = "YES"
11
+ buildForRunning = "YES"
12
+ buildForProfiling = "YES"
13
+ buildForArchiving = "YES"
14
+ buildForAnalyzing = "YES">
15
+ <BuildableReference
16
+ BuildableIdentifier = "primary"
17
+ BlueprintIdentifier = "504EC3031FED79650016851F"
18
+ BuildableName = "App.app"
19
+ BlueprintName = "App"
20
+ ReferencedContainer = "container:App.xcodeproj">
21
+ </BuildableReference>
22
+ </BuildActionEntry>
23
+ </BuildActionEntries>
24
+ </BuildAction>
25
+ <TestAction
26
+ buildConfiguration = "Debug"
27
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29
+ shouldUseLaunchSchemeArgsEnv = "YES">
30
+ <Testables>
31
+ </Testables>
32
+ </TestAction>
33
+ <LaunchAction
34
+ buildConfiguration = "Debug"
35
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
36
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
37
+ launchStyle = "0"
38
+ useCustomWorkingDirectory = "NO"
39
+ ignoresPersistentStateOnLaunch = "NO"
40
+ debugDocumentVersioning = "YES"
41
+ debugServiceExtension = "internal"
42
+ allowLocationSimulation = "YES">
43
+ <BuildableProductRunnable
44
+ runnableDebuggingMode = "0">
45
+ <BuildableReference
46
+ BuildableIdentifier = "primary"
47
+ BlueprintIdentifier = "504EC3031FED79650016851F"
48
+ BuildableName = "App.app"
49
+ BlueprintName = "App"
50
+ ReferencedContainer = "container:App.xcodeproj">
51
+ </BuildableReference>
52
+ </BuildableProductRunnable>
53
+ </LaunchAction>
54
+ <ProfileAction
55
+ buildConfiguration = "Release"
56
+ shouldUseLaunchSchemeArgsEnv = "YES"
57
+ savedToolIdentifier = ""
58
+ useCustomWorkingDirectory = "NO"
59
+ debugDocumentVersioning = "YES">
60
+ <BuildableProductRunnable
61
+ runnableDebuggingMode = "0">
62
+ <BuildableReference
63
+ BuildableIdentifier = "primary"
64
+ BlueprintIdentifier = "504EC3031FED79650016851F"
65
+ BuildableName = "App.app"
66
+ BlueprintName = "App"
67
+ ReferencedContainer = "container:App.xcodeproj">
68
+ </BuildableReference>
69
+ </BuildableProductRunnable>
70
+ </ProfileAction>
71
+ <AnalyzeAction
72
+ buildConfiguration = "Debug">
73
+ </AnalyzeAction>
74
+ <ArchiveAction
75
+ buildConfiguration = "Release"
76
+ revealArchiveInOrganizer = "YES">
77
+ </ArchiveAction>
78
+ </Scheme>
@@ -20,17 +20,17 @@
20
20
  <ion-row>
21
21
  <ion-button
22
22
  size="small"
23
- (click)="startPositioning()"
23
+ (click)="requestLocationUpdates()"
24
24
  [disabled]="positioning"
25
25
  >
26
- startPositioning()
26
+ requestLocationUpdates()
27
27
  </ion-button>
28
28
  <ion-button
29
29
  size="small"
30
- (click)="stopPositioning()"
30
+ (click)="removeUpdates()"
31
31
  [disabled]="!positioning"
32
32
  >
33
- stopPositioning()
33
+ removeUpdates()
34
34
  </ion-button>
35
35
  </ion-row>
36
36
  </ion-card-content>
@@ -18,7 +18,7 @@ import {
18
18
  IonPicker,
19
19
  IonThumbnail,
20
20
  NavController,
21
- Platform,
21
+ Platform
22
22
  } from '@ionic/angular/standalone';
23
23
  import { NgFor, NgIf } from '@angular/common';
24
24
  import { locate, cloudDownload, map } from 'ionicons/icons';
@@ -54,8 +54,8 @@ declare let cordova: any;
54
54
  IonTextarea,
55
55
  IonPicker,
56
56
  NgFor,
57
- NgIf,
58
- ],
57
+ NgIf
58
+ ]
59
59
  })
60
60
  export class SDKPage {
61
61
  buildings: Array<any> | undefined;
@@ -109,7 +109,7 @@ export class SDKPage {
109
109
  // = POSITIONING =
110
110
  // ==============================================================================================
111
111
 
112
- async startPositioning() {
112
+ async requestLocationUpdates() {
113
113
  if (this.positioning) {
114
114
  return;
115
115
  }
@@ -130,44 +130,43 @@ export class SDKPage {
130
130
  }
131
131
 
132
132
  private doStartPositioning() {
133
+ cordova.plugins.Situm.onLocationUpdate((location: any) => {
134
+ this._setStatus('POSITIONING');
135
+ this._setInfo(location);
136
+ });
137
+ cordova.plugins.Situm.onLocationStatus((status: string) => {
138
+ this._setStatus(status);
139
+ if (status == 'STARTING') {
140
+ this._setPositioning(true);
141
+ }
142
+ });
143
+ cordova.plugins.Situm.onLocationError((err: any) => {
144
+ this._setPositioning(false);
145
+ this._setStatus('ERROR WHILE POSITIONING');
146
+ this._setInfo(err);
147
+ });
133
148
  // Start positioning in the building specified in the /src/constants.ts you created before:
134
- cordova.plugins.Situm.startPositioning(
149
+ cordova.plugins.Situm.requestLocationUpdates(
135
150
  // In case you have multiple buildings that the user could visit,
136
151
  // you might want to start positioning in all your buildings using global mode
137
152
  // by specifying an empty identifier:
138
153
  //
139
154
  // buildingIdentifier: ''
140
- [{ buildingIdentifier: Constants.BUILDING_IDENTIFIER }],
141
- (res: any) => {
142
- if (res && res.statusName) {
143
- this._setStatus(res.statusName);
144
- }
145
- if (res && res.position) {
146
- this._setStatus('POSITIONING');
147
- this._setInfo(res);
148
- }
149
- this._setPositioning(true);
150
- },
151
- (err: any) => {
152
- this._setPositioning(false);
153
- this._setStatus('ERROR WHILE POSITIONING');
154
- this._setInfo(err);
155
- }
155
+ { buildingIdentifier: Constants.BUILDING_IDENTIFIER }
156
156
  );
157
157
  }
158
158
 
159
- async stopPositioning() {
160
- cordova.plugins.Situm.stopPositioning(
161
- () => {
159
+ async removeUpdates() {
160
+ cordova.plugins.Situm.removeUpdates()
161
+ .then(() => {
162
162
  this._setPositioning(false);
163
163
  this._setStatus('STOPPED');
164
164
  this._setInfo('');
165
- },
166
- (err: any) => {
165
+ })
166
+ .catch((err: any) => {
167
167
  this._setStatus('ERROR');
168
168
  this._setInfo(err);
169
- }
170
- );
169
+ });
171
170
  }
172
171
 
173
172
  // ==============================================================================================
@@ -373,16 +372,16 @@ export class SDKPage {
373
372
  options: [
374
373
  {
375
374
  text: 'Do fetchPois() before selecting a POI',
376
- value: 'empty',
377
- },
378
- ],
379
- },
375
+ value: 'empty'
376
+ }
377
+ ]
378
+ }
380
379
  ];
381
380
 
382
381
  public pickerButtons = [
383
382
  {
384
383
  text: 'Cancel',
385
- role: 'cancel',
384
+ role: 'cancel'
386
385
  },
387
386
  {
388
387
  text: 'Confirm',
@@ -391,8 +390,8 @@ export class SDKPage {
391
390
  this.ngZone.run(() => {
392
391
  this.currentPoi = value.pois.value;
393
392
  });
394
- },
395
- },
393
+ }
394
+ }
396
395
  ];
397
396
 
398
397
  private _populatePOIPicker(pois: any) {
@@ -400,7 +399,7 @@ export class SDKPage {
400
399
  for (let poi of pois) {
401
400
  this.pickerColumns[0].options.push({
402
401
  text: poi.poiName,
403
- value: poi,
402
+ value: poi
404
403
  });
405
404
  }
406
405
  this.pickerColumns[0].options.sort((a, b) => {
@@ -13,7 +13,6 @@
13
13
  <!-- Follow this guide (https://situm.com/docs/sdk-cartography/#building-identifier)
14
14
  to find out the identifier of the building you want to display -->
15
15
  <map-view
16
- viewer-domain="https://map-viewer.situm.com"
17
16
  situm-api-key="YOUR_SITUM_API_KEY"
18
17
  building-identifier="YOUR_BUILDING_IDENTIFIER"
19
18
  remote-identifier="YOUR_REMOTE_IDENTIFIER"
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@situm/cordova",
3
- "version": "3.4.1",
4
- "description": "Set of utilities that allow any developer to build Cordova location based apps using Situm's indoor positioning system.",
3
+ "version": "3.4.3",
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",
7
7
  "author": "Situm Technologies <mobile@situm.com>",
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.4.1">
5
+ version="3.4.3">
6
6
  <name>Situm Cordova plugin Official</name>
7
7
  <description>This is the stable branch.</description>
8
8
  <license>MIT</license>
@@ -44,7 +44,7 @@ dependencies {
44
44
  implementation ('com.googlecode.json-simple:json-simple:1.1.1'){
45
45
  exclude group: 'junit', module:'junit'
46
46
  }
47
- implementation ('es.situm:situm-sdk:3.11.2@aar') {
47
+ implementation ('es.situm:situm-sdk:3.12.0@aar') {
48
48
  transitive = true
49
49
  }
50
50
  implementation 'org.apache.cordova:framework:10.1.1'
@@ -758,6 +758,9 @@ static JSONObject buildingInfoToJsonObject(BuildingInfo buildingInfo) throws JSO
758
758
  JSONObject request = args.getJSONObject(0);
759
759
  if (request.has(SitumMapper.BUILDING_IDENTIFIER)) {
760
760
  String buildingIdentifier = String.valueOf(request.get(SitumMapper.BUILDING_IDENTIFIER));
761
+ if (buildingIdentifier.isEmpty()) {
762
+ buildingIdentifier = "-1";
763
+ }
761
764
  locationBuilder.buildingIdentifier(buildingIdentifier);
762
765
  Log.i(TAG, "buildingIdentifier: " + buildingIdentifier);
763
766
  }
@@ -12,7 +12,7 @@ allprojects {
12
12
 
13
13
  dependencies {
14
14
  implementation 'com.google.android.gms:play-services-location:16.0.0'
15
- implementation('es.situm:situm-sdk:3.11.2@aar') {
15
+ implementation('es.situm:situm-sdk:3.12.0@aar') {
16
16
  transitive = true
17
17
  }
18
18
  }
@@ -568,6 +568,9 @@ static SitumLocationWrapper *singletonSitumLocationWrapperObj;
568
568
  }
569
569
 
570
570
  - (SITLocation *) locationJsonObjectToLocation:(NSDictionary *) jo {
571
+ if ([jo isKindOfClass:[NSArray class]] && [jo count] > 0) {
572
+ jo = [[jo objectEnumerator] nextObject];
573
+ }
571
574
  NSTimeInterval timestamp = [(NSNumber*)[jo valueForKey:@"timestamp"] doubleValue];
572
575
  SITPoint *position;
573
576
  // TODO: the map-viewer is not wrapping the position info into a position object.
package/www/map-view.js CHANGED
@@ -57,7 +57,7 @@ const MapViewController = require('./map-view-controller')
57
57
  * @namespace MapView
58
58
  */
59
59
  class MapView extends HTMLElement {
60
- _viewerDomain
60
+ _viewerDomain = 'https://map-viewer.situm.com'
61
61
 
62
62
  constructor() {
63
63
  super()
package/www/situm.js CHANGED
@@ -8,7 +8,7 @@ let _clientLocationUpdateCallback;
8
8
  let _clientLocationStatusCallback;
9
9
  let _clientLocationErrorCallback;
10
10
 
11
- let _internalPositioningCallback = function(res) {
11
+ let _internalPositioningCallback = function (res) {
12
12
  if (!res) {
13
13
  return;
14
14
  }
@@ -23,13 +23,13 @@ let _internalPositioningCallback = function(res) {
23
23
  }
24
24
  };
25
25
 
26
- let _internalErrorCallback = function(error) {
26
+ let _internalErrorCallback = function (error) {
27
27
  if (_clientLocationErrorCallback) {
28
28
  _clientLocationErrorCallback(error);
29
29
  }
30
- }
30
+ };
31
31
 
32
- /**
32
+ /**
33
33
  * @namespace Situm
34
34
  */
35
35
  var Situm = {
@@ -101,7 +101,13 @@ var Situm = {
101
101
  error(err);
102
102
  };
103
103
  let compatRequest = common.standarizeRequest(request);
104
- exec(legacyCallback, legacyErrorCallback, PLUGIN_NAME, 'startPositioning', compatRequest);
104
+ exec(
105
+ legacyCallback,
106
+ legacyErrorCallback,
107
+ PLUGIN_NAME,
108
+ 'startPositioning',
109
+ compatRequest
110
+ );
105
111
  },
106
112
 
107
113
  /**
@@ -111,9 +117,15 @@ var Situm = {
111
117
  * @see {@link onLocationStatus}
112
118
  * @see {@link onLocationError}
113
119
  */
114
- requestLocationUpdates: function(request) {
120
+ requestLocationUpdates: function (request) {
115
121
  let compatRequest = common.standarizeRequest(request);
116
- exec(_internalPositioningCallback, _internalErrorCallback, PLUGIN_NAME, 'startPositioning', compatRequest);
122
+ exec(
123
+ _internalPositioningCallback,
124
+ _internalErrorCallback,
125
+ PLUGIN_NAME,
126
+ 'startPositioning',
127
+ compatRequest
128
+ );
117
129
  },
118
130
 
119
131
  // TODO: move to TypeScript:
@@ -142,7 +154,7 @@ var Situm = {
142
154
  * @param {OnLocationUpdateCallback} callback Callback.
143
155
  * @see {@link requestLocationUpdates}
144
156
  */
145
- onLocationUpdate: function(callback) {
157
+ onLocationUpdate: function (callback) {
146
158
  if (!callback || typeof callback === 'function') {
147
159
  _clientLocationUpdateCallback = callback;
148
160
  }
@@ -153,7 +165,7 @@ var Situm = {
153
165
  * @param {OnLocationStatusCallback} callback Callback.
154
166
  * @see {@link requestLocationUpdates}
155
167
  */
156
- onLocationStatus: function(callback) {
168
+ onLocationStatus: function (callback) {
157
169
  if (!callback || typeof callback === 'function') {
158
170
  _clientLocationStatusCallback = callback;
159
171
  }
@@ -164,7 +176,7 @@ var Situm = {
164
176
  * @param {OnLocationErrorCallback} callback Callback.
165
177
  * @see {@link requestLocationUpdates}
166
178
  */
167
- onLocationError: function(callback) {
179
+ onLocationError: function (callback) {
168
180
  if (!callback || typeof callback === 'function') {
169
181
  _clientLocationErrorCallback = callback;
170
182
  }
@@ -186,9 +198,19 @@ var Situm = {
186
198
  * Stops positioning.
187
199
  * @returns {Promise} Get notified when the native SDK actually stops positioning.
188
200
  */
189
- removeUpdates: function() {
201
+ removeUpdates: function () {
190
202
  return new Promise((res, rej) => {
191
- exec(() => { res(true) }, (err) => { rej(err) }, PLUGIN_NAME, 'stopPositioning', []);
203
+ exec(
204
+ () => {
205
+ res(true);
206
+ },
207
+ (err) => {
208
+ rej(err);
209
+ },
210
+ PLUGIN_NAME,
211
+ 'stopPositioning',
212
+ []
213
+ );
192
214
  });
193
215
  },
194
216
 
@@ -374,11 +396,6 @@ var Situm = {
374
396
  * @return {boolean} success True if there is a listener to which notify progress update. False if there isn't, so this method do nothing.
375
397
  */
376
398
  updateNavigationWithLocation: function (location, cb, error) {
377
- if (!args) {
378
- args = []
379
- } else if (!Array.isArray(args)) {
380
- args = [args]
381
- }
382
399
  exec(cb, error, PLUGIN_NAME, 'updateNavigationWithLocation', [location]);
383
400
  },
384
401
  /**
@@ -408,7 +425,7 @@ var Situm = {
408
425
  * @param {function} cb Cordova native callback to recive data.
409
426
  * @param {function} error Cordova native callback to recive errors.
410
427
  */
411
- removeRealTimeUpdates: function(cb, error) {
428
+ removeRealTimeUpdates: function (cb, error) {
412
429
  exec(cb, error, PLUGIN_NAME, 'removeRealTimeUpdates', []);
413
430
  }
414
431
  };