@nativescript-community/ui-mapbox 7.0.0-alpha.14.3191a7b → 7.0.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.md +13 -0
- package/common.d.ts +18 -2
- package/common.js +9 -2
- package/expression/expression-parser.ios.d.ts +2 -2
- package/expression/expression-parser.ios.js +28 -13
- package/index.android.d.ts +5 -12
- package/index.android.js +11 -97
- package/index.ios.d.ts +68 -241
- package/index.ios.js +1171 -2001
- package/layers/layer-factory.ios.d.ts +7 -7
- package/layers/layer-factory.ios.js +46 -100
- package/layers/parser/property-parser.d.ts +1 -1
- package/layers/parser/property-parser.ios.d.ts +0 -2
- package/layers/parser/property-parser.ios.js +0 -149
- package/markers/Marker.android.d.ts +0 -7
- package/markers/Marker.android.js +7 -81
- package/markers/Marker.common.d.ts +2 -0
- package/markers/Marker.common.js +31 -0
- package/markers/MarkerManager.android.d.ts +7 -0
- package/markers/MarkerManager.android.js +88 -22
- package/package.json +3 -3
- package/platforms/ios/Podfile +3 -1
- package/platforms/ios/Resources/default_pin.png +0 -0
- package/platforms/ios/src/MapboxBridge.swift +1505 -0
- package/platforms/ios/src/NativeExpressionParser.swift +33 -0
- package/platforms/ios/src/NativeLayerFactory.swift +108 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/typings/Mapbox.ios.d.ts +2 -3242
- package/typings/mapbox.android.d.ts +7177 -5481
- package/typings/mapbox.bridge.ios.d.ts +128 -0
- package/platforms/android/ui_mapbox.aar +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,19 @@
|
|
|
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
|
+
## [7.0.1](https://github.com/nativescript-community/ui-mapbox/compare/v7.0.0...v7.0.1) (2025-10-28)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **ios:** missing options and improvements ([3d4cedd](https://github.com/nativescript-community/ui-mapbox/commit/3d4cedd92761445ab7293668d2b22e8767f73cce))
|
|
11
|
+
|
|
12
|
+
## [7.0.0](https://github.com/nativescript-community/ui-mapbox/compare/v6.2.31...v7.0.0) (2025-10-25)
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
* **android:** plugin updated to v11 (not retro compat!) ([9b98b79](https://github.com/nativescript-community/ui-mapbox/commit/9b98b79cb9a0cf2474ac6336e754370940a29d2d))
|
|
17
|
+
* **ios:** updated SDK to v11+ ([fc9af79](https://github.com/nativescript-community/ui-mapbox/commit/fc9af79a296019fa8c44e4b019826b524c19af72))
|
|
18
|
+
|
|
6
19
|
## [6.2.31](https://github.com/nativescript-community/ui-mapbox/compare/v6.2.30...v6.2.31) (2024-10-04)
|
|
7
20
|
|
|
8
21
|
**Note:** Version bump only for package @nativescript-community/ui-mapbox
|
package/common.d.ts
CHANGED
|
@@ -96,7 +96,7 @@ export interface MapboxMarker extends LatLng {
|
|
|
96
96
|
/**
|
|
97
97
|
* Set this in case you want to later pass it to 'removeMarker'.
|
|
98
98
|
*/
|
|
99
|
-
id?:
|
|
99
|
+
id?: number;
|
|
100
100
|
title?: string;
|
|
101
101
|
subtitle?: string;
|
|
102
102
|
/**
|
|
@@ -195,6 +195,10 @@ export interface MapboxCluster {
|
|
|
195
195
|
color: string;
|
|
196
196
|
}
|
|
197
197
|
export interface AddGeoJsonClusteredOptions {
|
|
198
|
+
id: any;
|
|
199
|
+
url: any;
|
|
200
|
+
pointColor: string;
|
|
201
|
+
pointRadius: number;
|
|
198
202
|
/**
|
|
199
203
|
* A unique identifier, like: "earthquakes"
|
|
200
204
|
*/
|
|
@@ -264,6 +268,7 @@ export interface VectorSource extends Source {
|
|
|
264
268
|
tileSize?: number;
|
|
265
269
|
}
|
|
266
270
|
export interface GeoJSONSource extends Source {
|
|
271
|
+
url: any;
|
|
267
272
|
type: 'geojson';
|
|
268
273
|
data?: any;
|
|
269
274
|
minzoom?: number;
|
|
@@ -287,6 +292,12 @@ export interface TrackUserOptions {
|
|
|
287
292
|
animated?: boolean;
|
|
288
293
|
}
|
|
289
294
|
export interface AddExtrusionOptions {
|
|
295
|
+
id?: string;
|
|
296
|
+
source?: string;
|
|
297
|
+
sourceLayer?: string;
|
|
298
|
+
minZoom?: any;
|
|
299
|
+
color?: string;
|
|
300
|
+
opacity?: any;
|
|
290
301
|
}
|
|
291
302
|
export interface OfflineRegion {
|
|
292
303
|
name: string;
|
|
@@ -310,6 +321,7 @@ export interface DownloadProgress {
|
|
|
310
321
|
completedSize?: number;
|
|
311
322
|
}
|
|
312
323
|
export interface DownloadOfflineRegionOptions extends OfflineRegion {
|
|
324
|
+
styleUrl: any;
|
|
313
325
|
onProgress?: (data: DownloadProgress) => void;
|
|
314
326
|
/**
|
|
315
327
|
* Optional, used on Android only.
|
|
@@ -546,8 +558,12 @@ export declare abstract class MapboxCommon implements MapboxCommonApi {
|
|
|
546
558
|
constructor(view?: MapboxViewCommonBase);
|
|
547
559
|
static defaults: Partial<ShowOptions>;
|
|
548
560
|
static merge(obj1: {}, obj2: {}): any;
|
|
549
|
-
requestFineLocationPermission(): Promise<any>;
|
|
550
561
|
hasFineLocationPermission(): Promise<boolean>;
|
|
562
|
+
/**
|
|
563
|
+
* Request fine locaion permission
|
|
564
|
+
*
|
|
565
|
+
*/
|
|
566
|
+
requestFineLocationPermission(): Promise<import("@nativescript-community/perms").Status>;
|
|
551
567
|
protected fetchImageSource(imagePath: string): Promise<ImageSource>;
|
|
552
568
|
}
|
|
553
569
|
/**
|
package/common.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { check, request } from '@nativescript-community/perms';
|
|
1
2
|
import { ContentView, ImageSource, Property, Trace, Utils, booleanConverter } from '@nativescript/core';
|
|
2
3
|
export * from './geo.utils';
|
|
3
4
|
export * from './expression/expression-parser';
|
|
@@ -61,9 +62,15 @@ export class MapboxCommon {
|
|
|
61
62
|
}
|
|
62
63
|
return result;
|
|
63
64
|
}
|
|
64
|
-
async requestFineLocationPermission() { }
|
|
65
65
|
async hasFineLocationPermission() {
|
|
66
|
-
return
|
|
66
|
+
return (await check('location')) === 'authorized';
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Request fine locaion permission
|
|
70
|
+
*
|
|
71
|
+
*/
|
|
72
|
+
async requestFineLocationPermission() {
|
|
73
|
+
return request('location');
|
|
67
74
|
}
|
|
68
75
|
async fetchImageSource(imagePath) {
|
|
69
76
|
if (Utils.isDataURI(imagePath)) {
|
|
@@ -1,22 +1,37 @@
|
|
|
1
|
+
// src/ui-mapbox/expression-parser.ios.ts
|
|
2
|
+
// TypeScript shim that exports ExpressionParser (TS API) while delegating to native NativeExpressionParser when available.
|
|
1
3
|
export class ExpressionParser {
|
|
4
|
+
// Return native predicate object (opaque) if native parser available, otherwise return the expression JSON.
|
|
2
5
|
static parseJson(json) {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
try {
|
|
7
|
+
if (global.NativeExpressionParser && global.NativeExpressionParser.parseJson) {
|
|
8
|
+
const res = global.NativeExpressionParser.parseJson(json);
|
|
9
|
+
if (res)
|
|
10
|
+
return res;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
catch (e) {
|
|
14
|
+
// ignore and fallback
|
|
15
|
+
}
|
|
16
|
+
return json;
|
|
8
17
|
}
|
|
18
|
+
// Try to convert native predicate back to JSON expression. Returns array or null.
|
|
9
19
|
static toJson(filter) {
|
|
10
|
-
|
|
11
|
-
|
|
20
|
+
try {
|
|
21
|
+
if (!filter)
|
|
22
|
+
return null;
|
|
23
|
+
if (Array.isArray(filter))
|
|
24
|
+
return filter;
|
|
25
|
+
if (global.NativeExpressionParser && global.NativeExpressionParser.toJson) {
|
|
26
|
+
const res = global.NativeExpressionParser.toJson(filter);
|
|
27
|
+
if (res)
|
|
28
|
+
return res;
|
|
29
|
+
}
|
|
12
30
|
}
|
|
13
|
-
|
|
14
|
-
|
|
31
|
+
catch (e) {
|
|
32
|
+
// ignore
|
|
15
33
|
}
|
|
16
|
-
|
|
17
|
-
const data = NSJSONSerialization.dataWithJSONObjectOptionsError(expressionObj, 0);
|
|
18
|
-
const expression = NSString.alloc().initWithDataEncoding(data, NSUTF8StringEncoding);
|
|
19
|
-
return JSON.parse(expression);
|
|
34
|
+
return null;
|
|
20
35
|
}
|
|
21
36
|
}
|
|
22
37
|
//# sourceMappingURL=expression-parser.ios.js.map
|
package/index.android.d.ts
CHANGED
|
@@ -223,13 +223,6 @@ export declare class Mapbox extends MapboxCommon implements MapboxApi {
|
|
|
223
223
|
* an invoke any registered callbacks.
|
|
224
224
|
*/
|
|
225
225
|
private handleLineClickEvent;
|
|
226
|
-
hasFineLocationPermission(): Promise<boolean>;
|
|
227
|
-
/**
|
|
228
|
-
* Request fine locaion permission
|
|
229
|
-
*
|
|
230
|
-
* @link https://docs.mapbox.com/android/core/overview/#permissionsmanager
|
|
231
|
-
*/
|
|
232
|
-
requestFineLocationPermission(): Promise<import("@nativescript-community/perms").Result>;
|
|
233
226
|
/**
|
|
234
227
|
* set the map style
|
|
235
228
|
*
|
|
@@ -434,11 +427,11 @@ export declare class Mapbox extends MapboxCommon implements MapboxApi {
|
|
|
434
427
|
*
|
|
435
428
|
* @todo at least with simulated data, the location is only updated once hence adding support for forceLocation method.
|
|
436
429
|
*/
|
|
437
|
-
showUserLocationMarker(options: TrackUserOptions & {
|
|
438
|
-
accuracyColor
|
|
439
|
-
accuracyRingColor
|
|
440
|
-
pulsingColor
|
|
441
|
-
}
|
|
430
|
+
showUserLocationMarker(options: Partial<TrackUserOptions & {
|
|
431
|
+
accuracyColor?: any;
|
|
432
|
+
accuracyRingColor?: any;
|
|
433
|
+
pulsingColor?: any;
|
|
434
|
+
}>, nativeMap?: any): Promise<void>;
|
|
442
435
|
/**
|
|
443
436
|
* hide (destroy) the user location marker
|
|
444
437
|
*
|
package/index.android.js
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @todo FIXME: The gcFix() implementation currently assumes only one map visible at a time.
|
|
5
5
|
*/
|
|
6
|
-
import { request } from '@nativescript-community/perms';
|
|
7
6
|
import { Application, Color, File, Http, ImageSource, Trace, Utils, knownFolders, path } from '@nativescript/core';
|
|
8
7
|
import { ExpressionParser } from './expression/expression-parser';
|
|
9
8
|
import { Layer, LayerFactory } from './layers/layer-factory';
|
|
@@ -116,6 +115,9 @@ export class MapboxView extends MapboxViewBase {
|
|
|
116
115
|
* programmatically include settings
|
|
117
116
|
*/
|
|
118
117
|
setConfig(settings) {
|
|
118
|
+
if (Trace.isEnabled()) {
|
|
119
|
+
CLog(CLogTypes.info, 'setConfig()');
|
|
120
|
+
}
|
|
119
121
|
// zoom level is not applied unless center is set
|
|
120
122
|
if (settings.zoomLevel && !settings.center) {
|
|
121
123
|
// Eiffel tower, Paris
|
|
@@ -221,13 +223,14 @@ export class MapboxView extends MapboxViewBase {
|
|
|
221
223
|
* @todo FIXME: this.nativeMapView is unused and never actually set to anything.
|
|
222
224
|
*/
|
|
223
225
|
async initMap() {
|
|
226
|
+
const accessToken = this.config?.accessToken ?? this.settings?.accessToken;
|
|
224
227
|
if (Trace.isEnabled()) {
|
|
225
|
-
CLog(CLogTypes.info, "MapboxView:initMap(): top - accessToken is '" +
|
|
228
|
+
CLog(CLogTypes.info, "MapboxView:initMap(): top - accessToken is '" + accessToken + "'", this.config);
|
|
226
229
|
}
|
|
227
|
-
if (!
|
|
230
|
+
if (!accessToken) {
|
|
228
231
|
throw new Error('missing accessToken');
|
|
229
232
|
}
|
|
230
|
-
if (!this.nativeMapView
|
|
233
|
+
if (!this.nativeMapView) {
|
|
231
234
|
this.mapbox = new Mapbox(this);
|
|
232
235
|
// the NativeScript contentview class extends from Observable to provide the notify method
|
|
233
236
|
// which is the glue that joins this code with whatever callbacks are set in the Mapbox XML
|
|
@@ -937,27 +940,6 @@ export class Mapbox extends MapboxCommon {
|
|
|
937
940
|
} // end of for loop over events.
|
|
938
941
|
return false;
|
|
939
942
|
}
|
|
940
|
-
hasFineLocationPermission() {
|
|
941
|
-
return new Promise((resolve, reject) => {
|
|
942
|
-
try {
|
|
943
|
-
resolve(this._fineLocationPermissionGranted());
|
|
944
|
-
}
|
|
945
|
-
catch (ex) {
|
|
946
|
-
if (Trace.isEnabled()) {
|
|
947
|
-
CLog(CLogTypes.info, 'Error in mapbox.hasFineLocationPermission: ' + ex);
|
|
948
|
-
}
|
|
949
|
-
reject(ex);
|
|
950
|
-
}
|
|
951
|
-
});
|
|
952
|
-
}
|
|
953
|
-
/**
|
|
954
|
-
* Request fine locaion permission
|
|
955
|
-
*
|
|
956
|
-
* @link https://docs.mapbox.com/android/core/overview/#permissionsmanager
|
|
957
|
-
*/
|
|
958
|
-
async requestFineLocationPermission() {
|
|
959
|
-
return request('location');
|
|
960
|
-
}
|
|
961
943
|
/**
|
|
962
944
|
* set the map style
|
|
963
945
|
*
|
|
@@ -2423,7 +2405,6 @@ export class Mapbox extends MapboxCommon {
|
|
|
2423
2405
|
source = this.getSource(style.source, theMap);
|
|
2424
2406
|
}
|
|
2425
2407
|
const layer = await LayerFactory.createLayer(style, source);
|
|
2426
|
-
console.log('addLayer', layer.getNativeInstance());
|
|
2427
2408
|
if (belowLayerId) {
|
|
2428
2409
|
// TODO: missing extension typings
|
|
2429
2410
|
//@ts-ignore
|
|
@@ -2596,23 +2577,14 @@ export class Mapbox extends MapboxCommon {
|
|
|
2596
2577
|
if (Trace.isEnabled()) {
|
|
2597
2578
|
CLog(CLogTypes.info, 'trackUser(): top');
|
|
2598
2579
|
}
|
|
2599
|
-
return new Promise((resolve, reject) => {
|
|
2580
|
+
return new Promise(async (resolve, reject) => {
|
|
2600
2581
|
try {
|
|
2601
2582
|
if (!this._mapboxMapInstance) {
|
|
2602
2583
|
reject('No map has been loaded');
|
|
2603
2584
|
return;
|
|
2604
2585
|
}
|
|
2605
|
-
this.requestFineLocationPermission()
|
|
2606
|
-
|
|
2607
|
-
// if (this._locationComponent) {
|
|
2608
|
-
// this.changeUserLocationMarkerMode(options.renderMode || 'COMPASS', options.cameraMode || 'TRACKING');
|
|
2609
|
-
// } else {
|
|
2610
|
-
this.showUserLocationMarker(options);
|
|
2611
|
-
// }
|
|
2612
|
-
})
|
|
2613
|
-
.catch((err) => {
|
|
2614
|
-
console.error('Location permission denied. error:', err);
|
|
2615
|
-
});
|
|
2586
|
+
await this.requestFineLocationPermission();
|
|
2587
|
+
this.showUserLocationMarker(options, nativeMap);
|
|
2616
2588
|
resolve();
|
|
2617
2589
|
}
|
|
2618
2590
|
catch (ex) {
|
|
@@ -2869,64 +2841,6 @@ export class Mapbox extends MapboxCommon {
|
|
|
2869
2841
|
return settings;
|
|
2870
2842
|
}
|
|
2871
2843
|
}));
|
|
2872
|
-
// if (typeof options.elevation != 'undefined') {
|
|
2873
|
-
// componentOptionsBuilder = componentOptionsBuilder.elevation(options.elevation);
|
|
2874
|
-
// }
|
|
2875
|
-
// if (typeof options.accuracyAlpha != 'undefined') {
|
|
2876
|
-
// componentOptionsBuilder = componentOptionsBuilder.accuracyAlpha(options.accuracyAlpha);
|
|
2877
|
-
// }
|
|
2878
|
-
// if (typeof options.foregroundTintColor != 'undefined') {
|
|
2879
|
-
// const foregroundTintColor = new java.lang.Integer(android.graphics.Color.parseColor(options.foregroundTintColor));
|
|
2880
|
-
// componentOptionsBuilder = componentOptionsBuilder.foregroundTintColor(foregroundTintColor);
|
|
2881
|
-
// }
|
|
2882
|
-
// if (typeof options.foregroundStaleTintColor != 'undefined') {
|
|
2883
|
-
// const foregroundStaleTintColor = new java.lang.Integer(android.graphics.Color.parseColor(options.foregroundStaleTintColor));
|
|
2884
|
-
// componentOptionsBuilder = componentOptionsBuilder.foregroundStaleTintColor(foregroundStaleTintColor);
|
|
2885
|
-
// }
|
|
2886
|
-
// if (typeof options.backgroundTintColor != 'undefined') {
|
|
2887
|
-
// const backgroundTintColor = new java.lang.Integer(android.graphics.Color.parseColor(options.backgroundTintColor));
|
|
2888
|
-
// componentOptionsBuilder = componentOptionsBuilder.backgroundTintColor(backgroundTintColor);
|
|
2889
|
-
// }
|
|
2890
|
-
// if (typeof options.bearingTintColor != 'undefined') {
|
|
2891
|
-
// const bearingTintColor = new java.lang.Integer(android.graphics.Color.parseColor(options.bearingTintColor));
|
|
2892
|
-
// componentOptionsBuilder = componentOptionsBuilder.bearingTintColor(bearingTintColor);
|
|
2893
|
-
// }
|
|
2894
|
-
// const componentOptions = componentOptionsBuilder.build();
|
|
2895
|
-
// this._locationComponent = this._mapboxMapInstance.getLocationComponent();
|
|
2896
|
-
// const activationOptionsBuilder = com.mapbox.maps.location.LocationComponentActivationOptions.builder(Utils.android.getApplicationContext(), this._mapboxMapInstance.getStyle());
|
|
2897
|
-
// activationOptionsBuilder.locationComponentOptions(componentOptions);
|
|
2898
|
-
// let useDefaultEngine = true;
|
|
2899
|
-
// if (typeof options.useDefaultLocationEngine != 'undefined') {
|
|
2900
|
-
// useDefaultEngine = options.useDefaultLocationEngine;
|
|
2901
|
-
// }
|
|
2902
|
-
// activationOptionsBuilder.useDefaultLocationEngine(useDefaultEngine);
|
|
2903
|
-
// const locationComponentActivationOptions = activationOptionsBuilder.build();
|
|
2904
|
-
// this._locationComponent.activateLocationComponent(locationComponentActivationOptions);
|
|
2905
|
-
// this._locationComponent.setLocationComponentEnabled(true);
|
|
2906
|
-
// let cameraMode = this._stringToCameraMode('TRACKING');
|
|
2907
|
-
// if (typeof options.cameraMode != 'undefined') {
|
|
2908
|
-
// cameraMode = this._stringToCameraMode(options.cameraMode);
|
|
2909
|
-
// }
|
|
2910
|
-
// this._locationComponent.setCameraMode(cameraMode);
|
|
2911
|
-
// let renderMode = com.mapbox.maps.location.modes.RenderMode.COMPASS;
|
|
2912
|
-
// if (typeof options.renderMode != 'undefined') {
|
|
2913
|
-
// renderMode = this._stringToRenderMode(options.renderMode);
|
|
2914
|
-
// }
|
|
2915
|
-
// this._locationComponent.setRenderMode(renderMode);
|
|
2916
|
-
// if (Trace.isEnabled()) {
|
|
2917
|
-
// CLog(CLogTypes.info, 'showUserLocationMarker(): after renderMode');
|
|
2918
|
-
// }
|
|
2919
|
-
// if (typeof options.clickListener != 'undefined') {
|
|
2920
|
-
// this.onLocationClickListener = new com.mapbox.maps.location.OnLocationClickListener({
|
|
2921
|
-
// onLocationComponentClick: () => {
|
|
2922
|
-
// options.clickListener();
|
|
2923
|
-
// }
|
|
2924
|
-
// });
|
|
2925
|
-
// this._locationComponent.addOnLocationClickListener(this.onLocationClickListener);
|
|
2926
|
-
// }
|
|
2927
|
-
// if (typeof options.cameraTrackingChangedListener != 'undefined') {
|
|
2928
|
-
// this._locationComponent.addOnCameraTrackingChangedListener(options.cameraTrackingChangedListener);
|
|
2929
|
-
// }
|
|
2930
2844
|
}
|
|
2931
2845
|
catch (ex) {
|
|
2932
2846
|
if (Trace.isEnabled()) {
|
|
@@ -2982,7 +2896,7 @@ export class Mapbox extends MapboxCommon {
|
|
|
2982
2896
|
return new Promise((resolve, reject) => {
|
|
2983
2897
|
try {
|
|
2984
2898
|
if (Trace.isEnabled()) {
|
|
2985
|
-
CLog(CLogTypes.info, '
|
|
2899
|
+
CLog(CLogTypes.info, 'changeUserLocationMarkerMode()');
|
|
2986
2900
|
}
|
|
2987
2901
|
if (!this._mapboxMapInstance) {
|
|
2988
2902
|
throw new Error('No map has been loaded');
|