@situm/cordova 3.4.0 → 3.4.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/.prettierrc +10 -0
- package/README.md +80 -13
- package/example/ios/App/App.xcodeproj/xcshareddata/xcschemes/App.xcscheme +78 -0
- package/example/src/app/sdk/sdk.page.html +4 -4
- package/example/src/app/sdk/sdk.page.ts +35 -36
- package/example/src/app/wyf/wyf.page.html +0 -1
- package/package.json +1 -1
- package/plugin.xml +1 -1
- package/src/android/app/src/main/java/es/situm/plugin/SitumMapper.java +3 -0
- package/src/ios/Podfile +1 -1
- package/src/ios/situmcordovaplugin/SitumLocationWrapper.m +3 -0
- package/www/map-view.js +1 -1
- package/www/situm.js +35 -18
package/.prettierrc
ADDED
package/README.md
CHANGED
|
@@ -77,7 +77,7 @@ Situm Cordova Plugin is licensed under [MIT License](https://opensource.org/lice
|
|
|
77
77
|
Log in into your Situm Account. This key is generated in Situm Dashboard. Return true if apiKey was set successfully, otherwise false
|
|
78
78
|
|
|
79
79
|
```js
|
|
80
|
-
cordova.plugins.Situm.setApiKey(
|
|
80
|
+
cordova.plugins.Situm.setApiKey('SITUM_EMAIL', 'SITUM_API_KEY');
|
|
81
81
|
```
|
|
82
82
|
|
|
83
83
|
#### - setUserPass
|
|
@@ -85,7 +85,7 @@ cordova.plugins.Situm.setApiKey("SITUM_EMAIL", "SITUM_API_KEY");
|
|
|
85
85
|
Provides user's email and password. Return true if apiKey was set successfully, otherwise false
|
|
86
86
|
|
|
87
87
|
```js
|
|
88
|
-
cordova.plugins.Situm.setUserPass(
|
|
88
|
+
cordova.plugins.Situm.setUserPass('SITUM_EMAIL', 'SITUM_USER_PASS');
|
|
89
89
|
```
|
|
90
90
|
|
|
91
91
|
#### - setRemoteConfig
|
|
@@ -106,10 +106,13 @@ cordova.plugins.Situm.setCacheMaxAge(1 * 60 * 60); // 1 hour
|
|
|
106
106
|
|
|
107
107
|
#### - startPositioning
|
|
108
108
|
|
|
109
|
+
> [!WARNING]
|
|
110
|
+
> This method is deprecated, instead use [requestLocationUpdates](#--requestLocationUpdates).
|
|
111
|
+
|
|
109
112
|
Starts the positioning system. In the success callback it can return:
|
|
110
113
|
|
|
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)
|
|
114
|
+
- [Location](https://developers.situm.com/sdk_documentation/cordova/jsdoc/latest/global.html#Location).
|
|
115
|
+
- [LocationStatus](https://developers.situm.com/sdk_documentation/cordova/jsdoc/latest/global.html#LocationStatus).
|
|
113
116
|
|
|
114
117
|
```js
|
|
115
118
|
locationOptions = {
|
|
@@ -128,8 +131,72 @@ cordova.plugins.Situm.startPositioning(locationOptions, (res: any) => {
|
|
|
128
131
|
});
|
|
129
132
|
```
|
|
130
133
|
|
|
134
|
+
#### - requestLocationUpdates
|
|
135
|
+
|
|
136
|
+
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.
|
|
137
|
+
|
|
138
|
+
Use [onLocationUpdate()](#--onLocationUpdate) to receive updates of the user's location,
|
|
139
|
+
[onLocationStatus()](#--onLocationStatus) to receive updates of the positioning status
|
|
140
|
+
and [onLocationError()](#--onLocationError) to receive the possible errors that take place when positioning.
|
|
141
|
+
|
|
142
|
+
```js
|
|
143
|
+
cordova.plugins.Situm.requestLocationUpdates(
|
|
144
|
+
{
|
|
145
|
+
buildingIdentifier = "YOUR_BUILDING_IDENTIFIER"
|
|
146
|
+
});
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
#### - removeUpdates
|
|
150
|
+
|
|
151
|
+
Stop the positioning system.
|
|
152
|
+
This method returns a promise, so use the .then() and .catch() methods to know the result.
|
|
153
|
+
|
|
154
|
+
```js
|
|
155
|
+
cordova.plugins.Situm.removeUpdates()
|
|
156
|
+
.then(() => {
|
|
157
|
+
// Positioning system has stopped successfully.
|
|
158
|
+
})
|
|
159
|
+
.catch((err: any) => {
|
|
160
|
+
// Error while stopping the positioning system.
|
|
161
|
+
});
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
#### - onLocationUpdate
|
|
165
|
+
|
|
166
|
+
Use this callback to stay aware about the user's [Location](https://developers.situm.com/sdk_documentation/cordova/jsdoc/latest/global.html#Location).
|
|
167
|
+
|
|
168
|
+
```js
|
|
169
|
+
cordova.plugins.Situm.onLocationUpdate((location: any) => {
|
|
170
|
+
console.log('The user has moved to: ' + location.position);
|
|
171
|
+
});
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
#### - onLocationStatus
|
|
175
|
+
|
|
176
|
+
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.
|
|
177
|
+
|
|
178
|
+
```js
|
|
179
|
+
cordova.plugins.Situm.onLocationStatus((status: string) => {
|
|
180
|
+
console.log('New positioning status: ' + status);
|
|
181
|
+
});
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
#### - onLocationError
|
|
185
|
+
|
|
186
|
+
Use this callback to stay aware about the errors the user might face when the positioning system starts.
|
|
187
|
+
See [onLocationError()](https://developers.situm.com/sdk_documentation/cordova/jsdoc/latest/situm#.onLocationError).
|
|
188
|
+
|
|
189
|
+
```js
|
|
190
|
+
cordova.plugins.Situm.onLocationError((err: any) => {
|
|
191
|
+
console.log('Error received when positioning: ' + err);
|
|
192
|
+
});
|
|
193
|
+
```
|
|
194
|
+
|
|
131
195
|
#### - stopPositioning
|
|
132
196
|
|
|
197
|
+
> [!WARNING]
|
|
198
|
+
> This method is deprecated, instead use [removeUpdates](#--removeUpdates).
|
|
199
|
+
|
|
133
200
|
Stop the positioning system on current active listener.
|
|
134
201
|
|
|
135
202
|
```js
|
|
@@ -329,7 +396,7 @@ directionRequest = [
|
|
|
329
396
|
building, // Building in which you're positioning
|
|
330
397
|
from, // Point where you want to start the route. You can pass a Point or a Location
|
|
331
398
|
to, // Point where you want to finish the route
|
|
332
|
-
{}
|
|
399
|
+
{} // Options to generate the route
|
|
333
400
|
];
|
|
334
401
|
|
|
335
402
|
cordova.plugins.Situm.requestDirections(
|
|
@@ -352,7 +419,7 @@ When you start feeding locations you can receive [NavigationProgress](https://de
|
|
|
352
419
|
// Navigation request with example values
|
|
353
420
|
navigationRequest = [
|
|
354
421
|
(distanceToGoalThreshold = 10),
|
|
355
|
-
(distanceToFloorChangeThreshold = 5)
|
|
422
|
+
(distanceToFloorChangeThreshold = 5)
|
|
356
423
|
];
|
|
357
424
|
cordova.plugins.Situm.requestNavigationUpdates(
|
|
358
425
|
navigationRequest,
|
|
@@ -394,7 +461,7 @@ Emits the [real time](https://developers.situm.com/sdk_documentation/cordova/jsd
|
|
|
394
461
|
```js
|
|
395
462
|
const request = {
|
|
396
463
|
building: building, //Building in which you want to be notified
|
|
397
|
-
pollTime: 3000
|
|
464
|
+
pollTime: 3000 // time in milliseconds
|
|
398
465
|
};
|
|
399
466
|
cordova.plugins.Situm.SitumPlugin.requestRealTimeUpdates(
|
|
400
467
|
request,
|
|
@@ -462,11 +529,11 @@ cordova.plugins.MapView.onLoad((controller: any) => {
|
|
|
462
529
|
|
|
463
530
|
// 2. Listen to events that take place inside our map like a poi being selected or deselected:
|
|
464
531
|
controller.onPoiSelected((poiSelectedResult: any) => {
|
|
465
|
-
console.log(
|
|
532
|
+
console.log('EXAMPLE> onPoiSelected -> ', poiSelectedResult);
|
|
466
533
|
});
|
|
467
534
|
|
|
468
535
|
controller.onPoiDeselected((poiDeselectedResult: any) => {
|
|
469
|
-
console.log(
|
|
536
|
+
console.log('EXAMPLE> onPoiDeselected -> ', poiDeselectedResult);
|
|
470
537
|
});
|
|
471
538
|
});
|
|
472
539
|
```
|
|
@@ -482,7 +549,7 @@ Select a POI in the map.
|
|
|
482
549
|
```js
|
|
483
550
|
cordova.plugins.MapView.onLoad((controller: any) => {
|
|
484
551
|
// Once the MapView was loaded you can select a POI in our map by calling:
|
|
485
|
-
controller.selectPoi(
|
|
552
|
+
controller.selectPoi('YOUR_POI_IDENTIFIER');
|
|
486
553
|
});
|
|
487
554
|
```
|
|
488
555
|
|
|
@@ -497,7 +564,7 @@ cordova.plugins.MapView.onLoad((controller: any) => {
|
|
|
497
564
|
// Once the MapView was loaded you can navigate to a POI in our map.
|
|
498
565
|
// Make sure to call this method once the user is positioning indoors in your building,
|
|
499
566
|
// otherwise this method will have no effect.
|
|
500
|
-
controller.navigateToPoi(
|
|
567
|
+
controller.navigateToPoi('YOUR_POI_IDENTIFIER');
|
|
501
568
|
|
|
502
569
|
// controller.navigateToPoi("YOUR_POI_IDENTIFIER", "CHOOSE_SHORTEST");
|
|
503
570
|
});
|
|
@@ -514,7 +581,7 @@ Listen to the selection event of a POI.
|
|
|
514
581
|
cordova.plugins.MapView.onLoad((controller: any) => {
|
|
515
582
|
// Once the MapView was loaded you can listen to a POI being selected.
|
|
516
583
|
controller.onPoiSelected((poiSelectedResult: any) => {
|
|
517
|
-
console.log(
|
|
584
|
+
console.log('EXAMPLE> onPoiSelected -> ', poiSelectedResult);
|
|
518
585
|
});
|
|
519
586
|
});
|
|
520
587
|
```
|
|
@@ -529,7 +596,7 @@ Listen to listen to a POI being deselected.
|
|
|
529
596
|
cordova.plugins.MapView.onLoad((controller: any) => {
|
|
530
597
|
// Once the MapView was loaded you can listen to a POI being deselected.
|
|
531
598
|
controller.onPoiDeselected((poiDeselectedResult: any) => {
|
|
532
|
-
console.log(
|
|
599
|
+
console.log('EXAMPLE> onPoiDeselected -> ', poiDeselectedResult);
|
|
533
600
|
});
|
|
534
601
|
});
|
|
535
602
|
```
|
|
@@ -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)="
|
|
23
|
+
(click)="requestLocationUpdates()"
|
|
24
24
|
[disabled]="positioning"
|
|
25
25
|
>
|
|
26
|
-
|
|
26
|
+
requestLocationUpdates()
|
|
27
27
|
</ion-button>
|
|
28
28
|
<ion-button
|
|
29
29
|
size="small"
|
|
30
|
-
(click)="
|
|
30
|
+
(click)="removeUpdates()"
|
|
31
31
|
[disabled]="!positioning"
|
|
32
32
|
>
|
|
33
|
-
|
|
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
|
|
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.
|
|
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
|
-
|
|
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
|
|
160
|
-
cordova.plugins.Situm.
|
|
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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@situm/cordova",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.2",
|
|
4
4
|
"description": "Set of utilities that allow any developer to build Cordova location based apps using Situm's indoor positioning system.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"repository": "https://github.com/situmtech/cordova",
|
package/plugin.xml
CHANGED
|
@@ -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
|
}
|
package/src/ios/Podfile
CHANGED
|
@@ -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
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(
|
|
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(
|
|
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(
|
|
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
|
};
|