@nativescript-community/ui-mapbox 6.2.14 → 6.2.15
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.md +8 -0
- package/common.d.ts +3 -0
- package/common.js +3 -0
- package/index.android.d.ts +3 -1
- package/index.android.js +30 -0
- package/index.ios.d.ts +3 -1
- package/index.ios.js +33 -17
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [6.2.15](https://github.com/nativescript-community/ui-mapbox/compare/v6.2.14...v6.2.15) (2022-03-03)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @nativescript-community/ui-mapbox
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## [6.2.14](https://github.com/nativescript-community/ui-mapbox/compare/v6.2.13...v6.2.14) (2022-02-09)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @nativescript-community/ui-mapbox
|
package/common.d.ts
CHANGED
|
@@ -292,6 +292,7 @@ export interface MapboxApi {
|
|
|
292
292
|
changeUserLocationMarkerMode(renderModeString: any, cameraModeString: UserLocationCameraMode, nativeMap?: any): void;
|
|
293
293
|
forceUserLocationUpdate(location: any, nativeMap?: any): void;
|
|
294
294
|
trackUser(options: TrackUserOptions, nativeMap?: any): Promise<void>;
|
|
295
|
+
getUserLocationCameraMode(nativeMap?: any): UserLocationCameraMode;
|
|
295
296
|
addSource(id: string, options: AddSourceOptions, nativeMapView?: any): Promise<any>;
|
|
296
297
|
updateSource(id: string, options: UpdateSourceOptions, nativeMapView?: any): Promise<any>;
|
|
297
298
|
removeSource(id: string, nativeMap?: any): Promise<any>;
|
|
@@ -393,6 +394,7 @@ export interface MapboxViewApi {
|
|
|
393
394
|
setTilt(options: SetTiltOptions): Promise<any>;
|
|
394
395
|
getUserLocation(): Promise<UserLocation>;
|
|
395
396
|
trackUser(options: TrackUserOptions): Promise<any>;
|
|
397
|
+
getUserLocationCameraMode(nativeMap?: any): UserLocationCameraMode;
|
|
396
398
|
showUserLocationMarker(options: any): void;
|
|
397
399
|
hideUserLocationMarker(options: any): void;
|
|
398
400
|
changeUserLocationMarkerMode(renderModeString: any, cameraModeString: UserLocationCameraMode): void;
|
|
@@ -461,6 +463,7 @@ export declare abstract class MapboxViewCommonBase extends ContentView implement
|
|
|
461
463
|
changeUserLocationMarkerMode(renderModeString: any, cameraModeString: UserLocationCameraMode): void;
|
|
462
464
|
forceUserLocationUpdate(location: any): void;
|
|
463
465
|
trackUser(options: TrackUserOptions): Promise<any>;
|
|
466
|
+
getUserLocationCameraMode(): UserLocationCameraMode;
|
|
464
467
|
addSource(id: string, options: AddSourceOptions): Promise<any>;
|
|
465
468
|
updateSource(id: string, options: UpdateSourceOptions): Promise<any>;
|
|
466
469
|
removeSource(id: string): Promise<any>;
|
package/common.js
CHANGED
|
@@ -158,6 +158,9 @@ export class MapboxViewCommonBase extends ContentView {
|
|
|
158
158
|
trackUser(options) {
|
|
159
159
|
return this.mapbox.trackUser(options, this.getNativeMapView());
|
|
160
160
|
}
|
|
161
|
+
getUserLocationCameraMode() {
|
|
162
|
+
return this.mapbox.getUserLocationCameraMode(this.getNativeMapView());
|
|
163
|
+
}
|
|
161
164
|
addSource(id, options) {
|
|
162
165
|
return this.mapbox.addSource(id, options, this.getNativeMapView());
|
|
163
166
|
}
|
package/index.android.d.ts
CHANGED
|
@@ -109,7 +109,7 @@ export declare class Mapbox extends MapboxCommon implements MapboxApi {
|
|
|
109
109
|
deleteOfflineRegion(options: DeleteOfflineRegionOptions): Promise<void>;
|
|
110
110
|
_getOfflineManager(): any;
|
|
111
111
|
addExtrusion(options: AddExtrusionOptions, nativeMap?: any): Promise<void>;
|
|
112
|
-
updateSource(id: string, options: UpdateSourceOptions, nativeMap?: any): Promise<
|
|
112
|
+
updateSource(id: string, options: UpdateSourceOptions, nativeMap?: any): Promise<void>;
|
|
113
113
|
addSource(id: string, options: AddSourceOptions, nativeMap?: any): Promise<void>;
|
|
114
114
|
removeSource(id: string, nativeMap?: any): Promise<void>;
|
|
115
115
|
addLayer(style: any, belowLayerId?: string, nativeMap?: any): Promise<void>;
|
|
@@ -122,6 +122,7 @@ export declare class Mapbox extends MapboxCommon implements MapboxApi {
|
|
|
122
122
|
_getMapboxMapOptions(settings: any): com.mapbox.mapboxsdk.maps.MapboxMapOptions;
|
|
123
123
|
_stringToCameraMode(mode: UserLocationCameraMode): any;
|
|
124
124
|
_stringToRenderMode(mode: any): any;
|
|
125
|
+
_convertCameraMode(mode: any): UserLocationCameraMode;
|
|
125
126
|
_fineLocationPermissionGranted(): boolean;
|
|
126
127
|
_getRegionName(offlineRegion: com.mapbox.mapboxsdk.offline.OfflineRegion): string;
|
|
127
128
|
_getRegionMetadata(offlineRegion: com.mapbox.mapboxsdk.offline.OfflineRegion): any;
|
|
@@ -142,4 +143,5 @@ export declare class Mapbox extends MapboxCommon implements MapboxApi {
|
|
|
142
143
|
x: number;
|
|
143
144
|
y: number;
|
|
144
145
|
}): LatLng;
|
|
146
|
+
getUserLocationCameraMode(nativeMap?: any): UserLocationCameraMode;
|
|
145
147
|
}
|
package/index.android.js
CHANGED
|
@@ -1786,6 +1786,7 @@ export class Mapbox extends MapboxCommon {
|
|
|
1786
1786
|
case 'geojson':
|
|
1787
1787
|
const geoJsonString = JSON.stringify(options.data);
|
|
1788
1788
|
source.setGeoJson(geoJsonString);
|
|
1789
|
+
resolve();
|
|
1789
1790
|
break;
|
|
1790
1791
|
default:
|
|
1791
1792
|
reject('Invalid source type: ' + options['type']);
|
|
@@ -2187,6 +2188,26 @@ export class Mapbox extends MapboxCommon {
|
|
|
2187
2188
|
}
|
|
2188
2189
|
return renderMode;
|
|
2189
2190
|
}
|
|
2191
|
+
_convertCameraMode(mode) {
|
|
2192
|
+
const modeRef = com.mapbox.mapboxsdk.location.modes.CameraMode;
|
|
2193
|
+
switch (mode) {
|
|
2194
|
+
case modeRef.NONE:
|
|
2195
|
+
return "NONE";
|
|
2196
|
+
case modeRef.NONE_COMPASS:
|
|
2197
|
+
return "NONE_COMPASS";
|
|
2198
|
+
case modeRef.NONE_GPS:
|
|
2199
|
+
return "NONE_GPS";
|
|
2200
|
+
case modeRef.TRACKING:
|
|
2201
|
+
return "TRACKING";
|
|
2202
|
+
case modeRef.TRACKING_COMPASS:
|
|
2203
|
+
return "TRACKING_COMPASS";
|
|
2204
|
+
case modeRef.TRACKING_GPS:
|
|
2205
|
+
return "TRACKING_GPS";
|
|
2206
|
+
case modeRef.TRACKING_GPS_NORTH:
|
|
2207
|
+
return "TRACKING_GPS_NORTH";
|
|
2208
|
+
}
|
|
2209
|
+
return "NONE";
|
|
2210
|
+
}
|
|
2190
2211
|
_fineLocationPermissionGranted() {
|
|
2191
2212
|
let hasPermission = android.os.Build.VERSION.SDK_INT < 23;
|
|
2192
2213
|
if (!hasPermission) {
|
|
@@ -2501,5 +2522,14 @@ export class Mapbox extends MapboxCommon {
|
|
|
2501
2522
|
lng: coordinate.getLongitude()
|
|
2502
2523
|
};
|
|
2503
2524
|
}
|
|
2525
|
+
getUserLocationCameraMode(nativeMap) {
|
|
2526
|
+
if (!this._mapboxMapInstance) {
|
|
2527
|
+
return "NONE";
|
|
2528
|
+
}
|
|
2529
|
+
if (!this._locationComponent) {
|
|
2530
|
+
return "NONE";
|
|
2531
|
+
}
|
|
2532
|
+
return this._convertCameraMode(this._locationComponent.getCameraMode());
|
|
2533
|
+
}
|
|
2504
2534
|
}
|
|
2505
2535
|
//# sourceMappingURL=index.android.js.map
|
package/index.ios.d.ts
CHANGED
|
@@ -53,6 +53,7 @@ export declare class Mapbox extends MapboxCommon implements MapboxApi {
|
|
|
53
53
|
getUserLocation(nativeMap?: any): Promise<UserLocation>;
|
|
54
54
|
_stringToCameraMode(mode: UserLocationCameraMode): any;
|
|
55
55
|
_stringToRenderMode(mode: any): any;
|
|
56
|
+
_convertCameraMode(mode: MGLUserTrackingMode): UserLocationCameraMode;
|
|
56
57
|
showUserLocationMarker(options: any, nativeMap?: any): Promise<void>;
|
|
57
58
|
hideUserLocationMarker(nativeMap?: any): Promise<void>;
|
|
58
59
|
changeUserLocationMarkerMode(renderModeString: any, cameraModeString: UserLocationCameraMode, nativeMap?: any): Promise<void>;
|
|
@@ -81,7 +82,7 @@ export declare class Mapbox extends MapboxCommon implements MapboxApi {
|
|
|
81
82
|
listOfflineRegions(options?: ListOfflineRegionsOptions): Promise<OfflineRegion[]>;
|
|
82
83
|
deleteOfflineRegion(options: DeleteOfflineRegionOptions): Promise<void>;
|
|
83
84
|
addExtrusion(options: AddExtrusionOptions, nativeMap?: any): Promise<void>;
|
|
84
|
-
updateSource(id: string, options: UpdateSourceOptions, nativeMap?: any): Promise<
|
|
85
|
+
updateSource(id: string, options: UpdateSourceOptions, nativeMap?: any): Promise<void>;
|
|
85
86
|
addSource(id: string, options: AddSourceOptions, nativeMap?: any): Promise<void>;
|
|
86
87
|
removeSource(id: string, nativeMap?: any): Promise<void>;
|
|
87
88
|
addLayer(style: any, belowLayerId?: string, nativeMapView?: any): Promise<void>;
|
|
@@ -99,4 +100,5 @@ export declare class Mapbox extends MapboxCommon implements MapboxApi {
|
|
|
99
100
|
x: number;
|
|
100
101
|
y: number;
|
|
101
102
|
}): LatLng;
|
|
103
|
+
getUserLocationCameraMode(nativeMap?: any): UserLocationCameraMode;
|
|
102
104
|
}
|
package/index.ios.js
CHANGED
|
@@ -463,9 +463,6 @@ const _getMapStyle = (input) => {
|
|
|
463
463
|
return MGLStyle.streetsStyleURL;
|
|
464
464
|
}
|
|
465
465
|
};
|
|
466
|
-
function _getTrackingMode(input) {
|
|
467
|
-
return 0;
|
|
468
|
-
}
|
|
469
466
|
function _getLocation(loc) {
|
|
470
467
|
if (loc === null) {
|
|
471
468
|
return null;
|
|
@@ -1333,27 +1330,26 @@ export class Mapbox extends MapboxCommon {
|
|
|
1333
1330
|
}
|
|
1334
1331
|
_stringToCameraMode(mode) {
|
|
1335
1332
|
switch (mode) {
|
|
1336
|
-
case
|
|
1333
|
+
case "NONE":
|
|
1337
1334
|
return 0;
|
|
1338
|
-
case
|
|
1339
|
-
|
|
1340
|
-
CLog(CLogTypes.info, '_stringToCameraMode(): NONE_COMPASS unsupported on iOS');
|
|
1341
|
-
}
|
|
1335
|
+
case "NONE_COMPASS":
|
|
1336
|
+
console.log("MapboxView::_stringToCameraMode(): NONE_COMPASS unsupported on iOS");
|
|
1342
1337
|
return 0;
|
|
1343
|
-
case
|
|
1344
|
-
|
|
1345
|
-
CLog(CLogTypes.info, '_stringToCameraMode(): NONE_GPS unsupported on iOS');
|
|
1346
|
-
}
|
|
1338
|
+
case "NONE_GPS":
|
|
1339
|
+
console.log("MapboxView::_stringToCameraMode(): NONE_GPS unsupported on iOS");
|
|
1347
1340
|
return 0;
|
|
1348
|
-
case
|
|
1341
|
+
case "TRACKING":
|
|
1349
1342
|
return 1;
|
|
1350
|
-
case
|
|
1343
|
+
case "TRACKING_COMPASS":
|
|
1351
1344
|
return 2;
|
|
1352
|
-
case
|
|
1345
|
+
case "TRACKING_GPS":
|
|
1353
1346
|
return 1;
|
|
1354
|
-
case
|
|
1347
|
+
case "TRACKING_GPS_NORTH":
|
|
1355
1348
|
return 3;
|
|
1349
|
+
default:
|
|
1350
|
+
console.log(`_stringToCameraMode: invalid cameraMode: ${mode}`);
|
|
1356
1351
|
}
|
|
1352
|
+
return 0;
|
|
1357
1353
|
}
|
|
1358
1354
|
_stringToRenderMode(mode) {
|
|
1359
1355
|
let renderMode;
|
|
@@ -1366,6 +1362,18 @@ export class Mapbox extends MapboxCommon {
|
|
|
1366
1362
|
return 'GPS';
|
|
1367
1363
|
}
|
|
1368
1364
|
}
|
|
1365
|
+
_convertCameraMode(mode) {
|
|
1366
|
+
switch (mode) {
|
|
1367
|
+
case 0:
|
|
1368
|
+
return "NONE";
|
|
1369
|
+
case 1:
|
|
1370
|
+
return "TRACKING";
|
|
1371
|
+
case 2:
|
|
1372
|
+
return "TRACKING_COMPASS";
|
|
1373
|
+
case 3:
|
|
1374
|
+
return "TRACKING_GPS_NORTH";
|
|
1375
|
+
}
|
|
1376
|
+
}
|
|
1369
1377
|
showUserLocationMarker(options, nativeMap) {
|
|
1370
1378
|
return new Promise((resolve, reject) => {
|
|
1371
1379
|
try {
|
|
@@ -2059,6 +2067,7 @@ export class Mapbox extends MapboxCommon {
|
|
|
2059
2067
|
const nsData = content.dataUsingEncoding(NSUTF8StringEncoding);
|
|
2060
2068
|
const geoJsonShape = MGLShape.shapeWithDataEncodingError(nsData, NSUTF8StringEncoding);
|
|
2061
2069
|
source.shape = geoJsonShape;
|
|
2070
|
+
resolve();
|
|
2062
2071
|
break;
|
|
2063
2072
|
default:
|
|
2064
2073
|
reject('Invalid source type: ' + options['type']);
|
|
@@ -2314,7 +2323,7 @@ export class Mapbox extends MapboxCommon {
|
|
|
2314
2323
|
reject('The map is not currently showing the user location');
|
|
2315
2324
|
return;
|
|
2316
2325
|
}
|
|
2317
|
-
theMap.setUserTrackingModeAnimated(
|
|
2326
|
+
theMap.setUserTrackingModeAnimated(this._stringToCameraMode(options.cameraMode), options.animated !== false);
|
|
2318
2327
|
resolve();
|
|
2319
2328
|
}
|
|
2320
2329
|
catch (ex) {
|
|
@@ -2384,6 +2393,13 @@ export class Mapbox extends MapboxCommon {
|
|
|
2384
2393
|
lng: coordinate.longitude
|
|
2385
2394
|
};
|
|
2386
2395
|
}
|
|
2396
|
+
getUserLocationCameraMode(nativeMap) {
|
|
2397
|
+
let theMap = nativeMap || this._mapboxViewInstance;
|
|
2398
|
+
if (!theMap) {
|
|
2399
|
+
return "NONE";
|
|
2400
|
+
}
|
|
2401
|
+
return this._convertCameraMode(theMap.userTrackingMode);
|
|
2402
|
+
}
|
|
2387
2403
|
}
|
|
2388
2404
|
const _addObserver = (eventName, callback) => NSNotificationCenter.defaultCenter.addObserverForNameObjectQueueUsingBlock(eventName, null, NSOperationQueue.mainQueue, callback);
|
|
2389
2405
|
function _downloadImage(marker) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nativescript-community/ui-mapbox",
|
|
3
|
-
"version": "6.2.
|
|
3
|
+
"version": "6.2.15",
|
|
4
4
|
"description": "Interactive, thoroughly customizable maps powered by vector tiles and OpenGL.",
|
|
5
5
|
"main": "index",
|
|
6
6
|
"typings": "index.d.ts",
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@nativescript-community/perms": "^2.2.0"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "0fcc83da4bd587591485042c0cec891041d9049a"
|
|
58
58
|
}
|