@situm/cordova 3.15.62 → 3.16.1
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 +6 -2
- package/example/android/app/capacitor.build.gradle +1 -2
- package/example/android/build.gradle +1 -1
- package/example/android/capacitor.settings.gradle +9 -9
- package/example/android/gradle/wrapper/gradle-wrapper.properties +1 -1
- package/example/android/variables.gradle +2 -2
- package/example/src/app/sdk/sdk.page.html +7 -7
- package/example/src/app/sdk/sdk.page.scss +5 -3
- package/package.json +1 -1
- package/plugin.xml +1 -1
- package/src/android/app/build.gradle +1 -1
- package/src/android/app/src/main/java/es/situm/plugin/SitumPlugin.java +8 -0
- package/src/android/situm.gradle +1 -1
- package/src/ios/situmcordovaplugin/SitumPlugin.h +1 -0
- package/src/ios/situmcordovaplugin/SitumPlugin.m +17 -2
- package/www/map-view-controller.js +25 -0
- package/www/map-view.js +2 -2
- package/www/situm.js +38 -0
package/CHANGELOG_UNRELEASED.md
CHANGED
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
## Unreleased
|
|
2
|
+
|
|
3
|
+
### Updated
|
|
4
|
+
- Updated Android example app targetSdkVersion and compileSdkVersion from 33 to 37.
|
|
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.
|
|
@@ -17,8 +17,7 @@ dependencies {
|
|
|
17
17
|
implementation project(':capacitor-keyboard')
|
|
18
18
|
implementation project(':capacitor-preferences')
|
|
19
19
|
implementation project(':capacitor-status-bar')
|
|
20
|
-
|
|
21
|
-
implementation "androidx.appcompat:appcompat:1.3.1"
|
|
20
|
+
|
|
22
21
|
}
|
|
23
22
|
apply from: "../../../src/android/situm.gradle"
|
|
24
23
|
|
|
@@ -7,7 +7,7 @@ buildscript {
|
|
|
7
7
|
mavenCentral()
|
|
8
8
|
}
|
|
9
9
|
dependencies {
|
|
10
|
-
classpath 'com.android.tools.build:gradle:8.
|
|
10
|
+
classpath 'com.android.tools.build:gradle:8.13.2'
|
|
11
11
|
classpath 'com.google.gms:google-services:4.3.15'
|
|
12
12
|
|
|
13
13
|
// NOTE: Do not place your application dependencies here; they belong
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
// DO NOT EDIT THIS FILE! IT IS GENERATED EACH TIME "capacitor update" IS RUN
|
|
2
2
|
include ':capacitor-android'
|
|
3
|
-
project(':capacitor-android').projectDir = new File('
|
|
3
|
+
project(':capacitor-android').projectDir = new File('../../node_modules/.pnpm/@capacitor+android@5.5.1_@capacitor+core@5.7.8/node_modules/@capacitor/android/capacitor')
|
|
4
4
|
|
|
5
5
|
include ':capacitor-app'
|
|
6
|
-
project(':capacitor-app').projectDir = new File('
|
|
6
|
+
project(':capacitor-app').projectDir = new File('../../node_modules/.pnpm/@capacitor+app@5.0.6_@capacitor+core@5.7.8/node_modules/@capacitor/app/android')
|
|
7
7
|
|
|
8
8
|
include ':capacitor-camera'
|
|
9
|
-
project(':capacitor-camera').projectDir = new File('
|
|
9
|
+
project(':capacitor-camera').projectDir = new File('../../node_modules/.pnpm/@capacitor+camera@5.0.10_@capacitor+core@5.7.8/node_modules/@capacitor/camera/android')
|
|
10
10
|
|
|
11
11
|
include ':capacitor-filesystem'
|
|
12
|
-
project(':capacitor-filesystem').projectDir = new File('
|
|
12
|
+
project(':capacitor-filesystem').projectDir = new File('../../node_modules/.pnpm/@capacitor+filesystem@5.2.2_@capacitor+core@5.7.8/node_modules/@capacitor/filesystem/android')
|
|
13
13
|
|
|
14
14
|
include ':capacitor-geolocation'
|
|
15
|
-
project(':capacitor-geolocation').projectDir = new File('
|
|
15
|
+
project(':capacitor-geolocation').projectDir = new File('../../node_modules/.pnpm/@capacitor+geolocation@5.0.8_@capacitor+core@5.7.8/node_modules/@capacitor/geolocation/android')
|
|
16
16
|
|
|
17
17
|
include ':capacitor-haptics'
|
|
18
|
-
project(':capacitor-haptics').projectDir = new File('
|
|
18
|
+
project(':capacitor-haptics').projectDir = new File('../../node_modules/.pnpm/@capacitor+haptics@5.0.6_@capacitor+core@5.7.8/node_modules/@capacitor/haptics/android')
|
|
19
19
|
|
|
20
20
|
include ':capacitor-keyboard'
|
|
21
|
-
project(':capacitor-keyboard').projectDir = new File('
|
|
21
|
+
project(':capacitor-keyboard').projectDir = new File('../../node_modules/.pnpm/@capacitor+keyboard@5.0.6_@capacitor+core@5.7.8/node_modules/@capacitor/keyboard/android')
|
|
22
22
|
|
|
23
23
|
include ':capacitor-preferences'
|
|
24
|
-
project(':capacitor-preferences').projectDir = new File('
|
|
24
|
+
project(':capacitor-preferences').projectDir = new File('../../node_modules/.pnpm/@capacitor+preferences@5.0.8_@capacitor+core@5.7.8/node_modules/@capacitor/preferences/android')
|
|
25
25
|
|
|
26
26
|
include ':capacitor-status-bar'
|
|
27
|
-
project(':capacitor-status-bar').projectDir = new File('
|
|
27
|
+
project(':capacitor-status-bar').projectDir = new File('../../node_modules/.pnpm/@capacitor+status-bar@5.0.6_@capacitor+core@5.7.8/node_modules/@capacitor/status-bar/android')
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
distributionBase=GRADLE_USER_HOME
|
|
2
2
|
distributionPath=wrapper/dists
|
|
3
|
-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.
|
|
3
|
+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-all.zip
|
|
4
4
|
networkTimeout=10000
|
|
5
5
|
zipStoreBase=GRADLE_USER_HOME
|
|
6
6
|
zipStorePath=wrapper/dists
|
|
@@ -93,16 +93,16 @@
|
|
|
93
93
|
</ion-card>
|
|
94
94
|
|
|
95
95
|
<ion-card>
|
|
96
|
+
<ion-card-header>
|
|
97
|
+
<ion-card-title>{{ currentStatus }}</ion-card-title>
|
|
98
|
+
</ion-card-header>
|
|
96
99
|
<ion-card-content>
|
|
97
|
-
<ion-item>
|
|
98
|
-
<ion-label>{{ currentStatus }}</ion-label>
|
|
99
|
-
</ion-item>
|
|
100
|
-
|
|
101
100
|
<ion-textarea
|
|
102
|
-
class="
|
|
101
|
+
class="positioning-info-textarea"
|
|
103
102
|
[readonly]="true"
|
|
104
|
-
|
|
105
|
-
|
|
103
|
+
[autoGrow]="false"
|
|
104
|
+
rows="45"
|
|
105
|
+
value="{{ currentPositioningInfo }}"
|
|
106
106
|
/>
|
|
107
107
|
</ion-card-content>
|
|
108
108
|
</ion-card>
|
|
@@ -18,7 +18,9 @@ ion-item.custom {
|
|
|
18
18
|
--margin-end: 0px;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
ion-textarea.
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
ion-textarea.positioning-info-textarea {
|
|
22
|
+
display: block;
|
|
23
|
+
max-height: 200vh;
|
|
24
|
+
overflow-y: auto;
|
|
25
|
+
--color: var(--ion-color-dark);
|
|
24
26
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@situm/cordova",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.16.1",
|
|
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
|
@@ -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.37.
|
|
47
|
+
implementation ('es.situm:situm-sdk:3.37.1@aar') {
|
|
48
48
|
transitive = true
|
|
49
49
|
}
|
|
50
50
|
implementation 'org.apache.cordova:framework:10.1.1'
|
|
@@ -86,6 +86,14 @@ public class SitumPlugin extends CordovaPlugin {
|
|
|
86
86
|
String email = args.getString(0);
|
|
87
87
|
String password = args.getString(1);
|
|
88
88
|
es.situm.sdk.SitumSdk.configuration().setUserPass(email, password);
|
|
89
|
+
} else if (action.equalsIgnoreCase("setToken")) {
|
|
90
|
+
try {
|
|
91
|
+
String token = args.getString(0);
|
|
92
|
+
es.situm.sdk.SitumSdk.configuration().setToken(token);
|
|
93
|
+
} catch(IllegalArgumentException e) {
|
|
94
|
+
Log.d(TAG,"Error setting authentication token: " + e);
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
89
97
|
} else if (action.equalsIgnoreCase("setCacheMaxAge")) {
|
|
90
98
|
Integer cacheAge = args.getInt(0);
|
|
91
99
|
Log.d(TAG,"Setting cache max age to " + cacheAge + " seconds");
|
package/src/android/situm.gradle
CHANGED
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
// The hooks for our plugin commands
|
|
18
18
|
- (void)setApiKey:(CDVInvokedUrlCommand *)command;
|
|
19
19
|
- (void)setUserPass:(CDVInvokedUrlCommand *)command;
|
|
20
|
+
- (void)setToken:(CDVInvokedUrlCommand *)command;
|
|
20
21
|
- (void)getDeviceId:(CDVInvokedUrlCommand *)command;
|
|
21
22
|
- (void)startPositioning:(CDVInvokedUrlCommand *)command;
|
|
22
23
|
- (void)setUseRemoteConfig:(CDVInvokedUrlCommand *)command;
|
|
@@ -29,7 +29,22 @@ static NSString *DEFAULT_SITUM_LOG = @"SitumSDK >>: ";
|
|
|
29
29
|
- (void)setApiKey:(CDVInvokedUrlCommand *)command {
|
|
30
30
|
NSString* email = [command.arguments objectAtIndex:0];
|
|
31
31
|
NSString* apiKey = [command.arguments objectAtIndex:1];
|
|
32
|
-
[SITServices
|
|
32
|
+
[SITServices setApiKey:apiKey];
|
|
33
|
+
|
|
34
|
+
if (IS_LOG_ENABLED) {
|
|
35
|
+
NSArray *allPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
|
|
36
|
+
NSString *documentsDirectory = [allPaths objectAtIndex:0];
|
|
37
|
+
NSString *pathForLog = [documentsDirectory stringByAppendingPathComponent:@"logging.txt"];
|
|
38
|
+
freopen([pathForLog cStringUsingEncoding:NSASCIIStringEncoding],"a+",stderr);
|
|
39
|
+
|
|
40
|
+
NSLog(@"%@", [NSString stringWithFormat: @"%@ Logging ios calls", DEFAULT_SITUM_LOG]);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
- (void)setToken:(CDVInvokedUrlCommand *)command {
|
|
46
|
+
NSString* token = [command.arguments objectAtIndex:0];
|
|
47
|
+
[SITServices setToken:token];
|
|
33
48
|
|
|
34
49
|
if (IS_LOG_ENABLED) {
|
|
35
50
|
NSArray *allPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
|
|
@@ -50,7 +65,7 @@ static NSString *DEFAULT_SITUM_LOG = @"SitumSDK >>: ";
|
|
|
50
65
|
- (void)setUserPass:(CDVInvokedUrlCommand *)command {
|
|
51
66
|
NSString* email = [command.arguments objectAtIndex:0];
|
|
52
67
|
NSString* password = [command.arguments objectAtIndex:1];
|
|
53
|
-
[SITServices
|
|
68
|
+
[SITServices setUser:email pass:password];
|
|
54
69
|
}
|
|
55
70
|
|
|
56
71
|
- (void)setCacheMaxAge:(CDVInvokedUrlCommand *)command {
|
|
@@ -53,9 +53,11 @@ class MapViewControllerImpl {
|
|
|
53
53
|
_mapView = undefined;
|
|
54
54
|
_isNavigating = false;
|
|
55
55
|
_navigationType = "";
|
|
56
|
+
_isWaitingForAuth = false;
|
|
56
57
|
|
|
57
58
|
constructor() {
|
|
58
59
|
Situm.internalSetEventDelegate(this._handleSdkNativeEvents.bind(this));
|
|
60
|
+
Situm.internalSetTokenCallback(this._handleTokenSet.bind(this));
|
|
59
61
|
}
|
|
60
62
|
|
|
61
63
|
_prepare(mapView) {
|
|
@@ -153,6 +155,9 @@ class MapViewControllerImpl {
|
|
|
153
155
|
case 'app.map_is_ready':
|
|
154
156
|
this._handleMapIsReady();
|
|
155
157
|
break;
|
|
158
|
+
case 'app.ready_for_auth':
|
|
159
|
+
this._handleReadyForAuth();
|
|
160
|
+
break;
|
|
156
161
|
case 'cartography.poi_selected':
|
|
157
162
|
console.debug(`poi (${m.payload.identifier}) was selected`);
|
|
158
163
|
const poiSelectedResult = {
|
|
@@ -215,6 +220,26 @@ class MapViewControllerImpl {
|
|
|
215
220
|
]);
|
|
216
221
|
}
|
|
217
222
|
|
|
223
|
+
_handleReadyForAuth() {
|
|
224
|
+
this._isWaitingForAuth = true;
|
|
225
|
+
this._sendTokenToViewer(Situm.internalGetToken());
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
_handleTokenSet(token) {
|
|
229
|
+
if (this._isWaitingForAuth) {
|
|
230
|
+
this._sendTokenToViewer(token);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
_sendTokenToViewer(token) {
|
|
235
|
+
if (!token) {
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
this._sendMessageToViewer('app.set_auth',
|
|
239
|
+
{jwt: token}
|
|
240
|
+
);
|
|
241
|
+
}
|
|
242
|
+
|
|
218
243
|
// Fetch the given building and return it or undefined if not found.
|
|
219
244
|
_ensureBuilding(buildingId, callback) {
|
|
220
245
|
if (this._buildings) {
|
package/www/map-view.js
CHANGED
|
@@ -99,13 +99,13 @@ class MapView extends HTMLElement {
|
|
|
99
99
|
? this.getAttribute('language')
|
|
100
100
|
: '';
|
|
101
101
|
|
|
102
|
-
let
|
|
102
|
+
let authQP = situmApiKey.length > 0 ? `apikey=${situmApiKey}` : 'wait_for_auth=true';
|
|
103
103
|
let buildingIdentifierQP =
|
|
104
104
|
buildingIdentifier.length > 0 ? `&buildingid=${buildingIdentifier}` : '';
|
|
105
105
|
let languageQP = language.length > 0 ? `&lng=${language}` : '';
|
|
106
106
|
let deviceIdQP = deviceId ? `&deviceId=${deviceId}` : '';
|
|
107
107
|
|
|
108
|
-
let query = `${
|
|
108
|
+
let query = `${authQP}${buildingIdentifierQP}${languageQP}${deviceIdQP}&mode=embed`;
|
|
109
109
|
|
|
110
110
|
let remoteIdentifier = this.getAttribute('remote-identifier');
|
|
111
111
|
if (remoteIdentifier && remoteIdentifier.length > 0) {
|
package/www/situm.js
CHANGED
|
@@ -3,6 +3,8 @@ const common = require('@situm/cordova.common-utils');
|
|
|
3
3
|
|
|
4
4
|
var PLUGIN_NAME = 'SitumPlugin';
|
|
5
5
|
let _internalEventDelegate = undefined;
|
|
6
|
+
let _internalTokenCallback = undefined;
|
|
7
|
+
let _token = String;
|
|
6
8
|
|
|
7
9
|
let _clientLocationUpdateCallback;
|
|
8
10
|
let _clientLocationStatusCallback;
|
|
@@ -48,6 +50,12 @@ var Situm = {
|
|
|
48
50
|
internalHandleMapViewMessage: function(message, payload) {
|
|
49
51
|
exec(() => {}, () => {}, PLUGIN_NAME, 'internalHandleMapViewMessage', [message, payload]);
|
|
50
52
|
},
|
|
53
|
+
internalGetToken: function() {
|
|
54
|
+
return _token;
|
|
55
|
+
},
|
|
56
|
+
internalSetTokenCallback: function(callback) {
|
|
57
|
+
_internalTokenCallback = callback;
|
|
58
|
+
},
|
|
51
59
|
/**
|
|
52
60
|
* Provides your API key to the Situm SDK.
|
|
53
61
|
* @description Provides your API key to the Situm SDK. This key is generated for your application in the Dashboard. Old credentials will be removed.
|
|
@@ -63,6 +71,36 @@ var Situm = {
|
|
|
63
71
|
setUseRemoteConfig: function (useRemoteConfig, cb, error) {
|
|
64
72
|
exec(cb, error, PLUGIN_NAME, 'setUseRemoteConfig', [useRemoteConfig]);
|
|
65
73
|
},
|
|
74
|
+
/**
|
|
75
|
+
* Provides your token to the Situm SDK. Any previously configured credentials will be replaced.
|
|
76
|
+
* <p>The SDK does not cryptographically validate the token signature, nor does it verify the
|
|
77
|
+
* token against Situm servers when this method is called. The token is parsed locally only to
|
|
78
|
+
* obtain the account information needed by the SDK, and it will be sent as a Bearer token in
|
|
79
|
+
* subsequent authenticated network requests.</p>
|
|
80
|
+
*
|
|
81
|
+
* <p>If the provided token is expired, has an invalid signature, or is otherwise rejected by
|
|
82
|
+
* Situm servers, network operations that require server authentication will fail. However,
|
|
83
|
+
* features that can operate with already cached local data may continue to work, such as
|
|
84
|
+
* visualizing cached resources or positioning with previously downloaded positioning data.</p>
|
|
85
|
+
*
|
|
86
|
+
* <p>User-provided tokens cannot be renewed automatically by the SDK. To recover from an
|
|
87
|
+
* expired or rejected token, provide a new token by calling this method again.</p>
|
|
88
|
+
*
|
|
89
|
+
* @description Provides your token to the Situm SDK. Any previously configured credentials will be replaced.
|
|
90
|
+
* @param {string} base64Token String representing the token used for authentication; must not be {@code null} or empty.
|
|
91
|
+
* The expected format is a base64-encoded JWT with header, payload and signature sections.
|
|
92
|
+
* This token can be retrieved from <a href="https://developers.situm.com/pages/rest/openapi/#tag/jwt/POST/api/v1/auth/access_tokens">a REST endpoint</a>.
|
|
93
|
+
* @param {function} cb Cordova native callback to recive data.
|
|
94
|
+
* @param {function} error Cordova native callback to recive errors.
|
|
95
|
+
* @return {boolean} success True if operation finished successfully, otherwise false
|
|
96
|
+
*/
|
|
97
|
+
setToken: function (base64Token, cb, error) {
|
|
98
|
+
_token = base64Token;
|
|
99
|
+
if (_internalTokenCallback) {
|
|
100
|
+
_internalTokenCallback(base64Token);
|
|
101
|
+
}
|
|
102
|
+
exec(cb, error, PLUGIN_NAME, 'setToken', [base64Token]);
|
|
103
|
+
},
|
|
66
104
|
/**
|
|
67
105
|
* Provides user's email and password.
|
|
68
106
|
* @description Provides user's email and password. This credentials will be used to obtain a valid user token to authenticate the server request, when necessary. Token obtaining is not necessary done when this method is executed. Old credentials will be removed.
|