@situm/cordova 3.5.0 → 3.5.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/CHANGELOG_UNRELEASED.md +0 -2
- package/package.json +1 -1
- package/plugin.xml +2 -2
- package/src/ios/Podfile +1 -1
- package/www/map-view-controller.js +10 -0
- package/www/map-view.js +42 -39
package/CHANGELOG_UNRELEASED.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@situm/cordova",
|
|
3
|
-
"version": "3.5.
|
|
3
|
+
"version": "3.5.2",
|
|
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.5.
|
|
5
|
+
version="3.5.2">
|
|
6
6
|
<name>Situm Cordova plugin Official</name>
|
|
7
7
|
<description>This is the stable branch.</description>
|
|
8
8
|
<license>MIT</license>
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
<config>
|
|
90
90
|
</config>
|
|
91
91
|
<pods use-frameworks="false">
|
|
92
|
-
<pod name="SitumSDK" spec="~> 3.
|
|
92
|
+
<pod name="SitumSDK" spec="~> 3.11.0"/>
|
|
93
93
|
</pods>
|
|
94
94
|
</podspec>
|
|
95
95
|
|
package/src/ios/Podfile
CHANGED
|
@@ -78,6 +78,16 @@ class MapViewControllerImpl {
|
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
+
_getDeviceId(callback) {
|
|
82
|
+
Situm.getDeviceId(
|
|
83
|
+
(deviceId) => callback(deviceId),
|
|
84
|
+
() => {
|
|
85
|
+
console.error('Error retrieving the device id.');
|
|
86
|
+
callback(null);
|
|
87
|
+
}
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
|
|
81
91
|
// ==================================================
|
|
82
92
|
// SDK MESSAGES:
|
|
83
93
|
// ==================================================
|
package/www/map-view.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const MapViewController = require('./map-view-controller')
|
|
1
|
+
const MapViewController = require('./map-view-controller');
|
|
2
2
|
/**
|
|
3
3
|
* <h4>CODE SNIPPET</h4>
|
|
4
4
|
*
|
|
@@ -57,75 +57,78 @@ const MapViewController = require('./map-view-controller')
|
|
|
57
57
|
* @namespace MapView
|
|
58
58
|
*/
|
|
59
59
|
class MapView extends HTMLElement {
|
|
60
|
-
_viewerDomain = 'https://map-viewer.situm.com'
|
|
60
|
+
_viewerDomain = 'https://map-viewer.situm.com';
|
|
61
61
|
|
|
62
62
|
constructor() {
|
|
63
|
-
super()
|
|
63
|
+
super();
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
connectedCallback() {
|
|
67
|
-
MapViewController._prepare(this)
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
67
|
+
MapViewController._prepare(this);
|
|
68
|
+
MapViewController._getDeviceId((deviceId) => {
|
|
69
|
+
this.innerHTML = `
|
|
70
|
+
<iframe
|
|
71
|
+
id="map-view-iframe"
|
|
72
|
+
src="${this._getViewerURL(deviceId)}"
|
|
73
|
+
width="100%"
|
|
74
|
+
height="100%"
|
|
75
|
+
style="border: none; box-shadow: none;"
|
|
76
|
+
/>
|
|
77
|
+
`;
|
|
78
|
+
});
|
|
79
|
+
window.addEventListener('message', this._messageReceivedCallback);
|
|
78
80
|
}
|
|
79
81
|
|
|
80
82
|
_getViewerDomain() {
|
|
81
|
-
return this._viewerDomain
|
|
83
|
+
return this._viewerDomain;
|
|
82
84
|
}
|
|
83
85
|
|
|
84
|
-
_getViewerURL() {
|
|
86
|
+
_getViewerURL(deviceId) {
|
|
85
87
|
let viewerDomain = this._formatValidDomain(
|
|
86
88
|
this.getAttribute('viewer-domain')
|
|
87
|
-
)
|
|
88
|
-
let situmApiKey = this.getAttribute('situm-api-key') ?? ''
|
|
89
|
-
let buildingIdentifier = this.getAttribute('building-identifier') ?? ''
|
|
90
|
-
let language = this.getAttribute('language') ?? ''
|
|
89
|
+
);
|
|
90
|
+
let situmApiKey = this.getAttribute('situm-api-key') ?? '';
|
|
91
|
+
let buildingIdentifier = this.getAttribute('building-identifier') ?? '';
|
|
92
|
+
let language = this.getAttribute('language') ?? '';
|
|
91
93
|
|
|
92
|
-
let situmApiKeyQP = situmApiKey.length > 0 ? `apikey=${situmApiKey}` : ''
|
|
94
|
+
let situmApiKeyQP = situmApiKey.length > 0 ? `apikey=${situmApiKey}` : '';
|
|
93
95
|
let buildingIdentifierQP =
|
|
94
|
-
buildingIdentifier.length > 0 ? `&buildingid=${buildingIdentifier}` : ''
|
|
95
|
-
let languageQP = language.length > 0 ? `&lng=${language}` : ''
|
|
96
|
+
buildingIdentifier.length > 0 ? `&buildingid=${buildingIdentifier}` : '';
|
|
97
|
+
let languageQP = language.length > 0 ? `&lng=${language}` : '';
|
|
98
|
+
let deviceIdQP = deviceId ? `&deviceId=${deviceId}` : '';
|
|
96
99
|
|
|
97
|
-
let query = `${situmApiKeyQP}${buildingIdentifierQP}${languageQP}&mode=embed
|
|
100
|
+
let query = `${situmApiKeyQP}${buildingIdentifierQP}${languageQP}${deviceIdQP}&mode=embed`;
|
|
98
101
|
|
|
99
|
-
let remoteIdentifier = this.getAttribute('remote-identifier')
|
|
102
|
+
let remoteIdentifier = this.getAttribute('remote-identifier');
|
|
100
103
|
if (remoteIdentifier && remoteIdentifier.length > 0) {
|
|
101
|
-
return `${viewerDomain}/id/${remoteIdentifier}?${query}
|
|
104
|
+
return `${viewerDomain}/id/${remoteIdentifier}?${query}`;
|
|
102
105
|
}
|
|
103
|
-
return `${viewerDomain}/?${query}
|
|
106
|
+
return `${viewerDomain}/?${query}`;
|
|
104
107
|
}
|
|
105
108
|
|
|
106
109
|
_formatValidDomain(domain) {
|
|
107
|
-
let result = domain
|
|
110
|
+
let result = domain;
|
|
108
111
|
if (result == null) {
|
|
109
|
-
return 'https://map-viewer.situm.com'
|
|
112
|
+
return 'https://map-viewer.situm.com';
|
|
110
113
|
}
|
|
111
114
|
if (!result.startsWith('https://') && !result.startsWith('http://')) {
|
|
112
|
-
result = `https://${result}
|
|
115
|
+
result = `https://${result}`;
|
|
113
116
|
}
|
|
114
117
|
if (result.endsWith('/')) {
|
|
115
|
-
result = result.substring(0, result.length - 1)
|
|
118
|
+
result = result.substring(0, result.length - 1);
|
|
116
119
|
}
|
|
117
|
-
this._viewerDomain = result
|
|
118
|
-
return result
|
|
120
|
+
this._viewerDomain = result;
|
|
121
|
+
return result;
|
|
119
122
|
}
|
|
120
123
|
|
|
121
124
|
_messageReceivedCallback(m) {
|
|
122
125
|
try {
|
|
123
|
-
const msg = JSON.parse(m.data)
|
|
126
|
+
const msg = JSON.parse(m.data);
|
|
124
127
|
if (msg && msg.type) {
|
|
125
|
-
MapViewController._handleMapViewMessages(msg)
|
|
128
|
+
MapViewController._handleMapViewMessages(msg);
|
|
126
129
|
}
|
|
127
130
|
} catch (error) {
|
|
128
|
-
console.warn('Got unparseable message:', m)
|
|
131
|
+
console.warn('Got unparseable message:', m);
|
|
129
132
|
}
|
|
130
133
|
}
|
|
131
134
|
|
|
@@ -137,10 +140,10 @@ class MapView extends HTMLElement {
|
|
|
137
140
|
static onLoad(cb) {
|
|
138
141
|
// For now, setting the on-load callback from the integrator is done using this (static) bridge.
|
|
139
142
|
// Probably this could be improved.
|
|
140
|
-
MapViewController._setOnLoadCallback(cb)
|
|
143
|
+
MapViewController._setOnLoadCallback(cb);
|
|
141
144
|
}
|
|
142
145
|
}
|
|
143
146
|
|
|
144
|
-
customElements.define('map-view', MapView)
|
|
147
|
+
customElements.define('map-view', MapView);
|
|
145
148
|
|
|
146
|
-
module.exports = MapView
|
|
149
|
+
module.exports = MapView;
|