@nativescript-community/ui-mapbox 6.2.22 → 6.2.25
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 +14 -0
- package/common.d.ts +4 -3
- package/common.js +13 -3
- package/index.android.d.ts +1 -1
- package/index.android.js +6 -9
- package/index.d.ts +1 -1
- package/index.ios.d.ts +1 -1
- package/index.ios.js +5 -9
- package/package.json +2 -2
- package/platforms/android/include.gradle +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,20 @@
|
|
|
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.25](https://github.com/nativescript-community/ui-mapbox/compare/v6.2.24...v6.2.25) (2023-12-07)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @nativescript-community/ui-mapbox
|
|
9
|
+
|
|
10
|
+
## [6.2.24](https://github.com/nativescript-community/ui-mapbox/compare/v6.2.23...v6.2.24) (2023-12-07)
|
|
11
|
+
|
|
12
|
+
**Note:** Version bump only for package @nativescript-community/ui-mapbox
|
|
13
|
+
|
|
14
|
+
## [6.2.23](https://github.com/nativescript-community/ui-mapbox/compare/v6.2.22...v6.2.23) (2023-11-29)
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
|
|
18
|
+
* **android:** build fix ([76ea2c0](https://github.com/nativescript-community/ui-mapbox/commit/76ea2c08c247dfecdfb1d08f1d2ae3f4ce43bc84))
|
|
19
|
+
|
|
6
20
|
## [6.2.22](https://github.com/nativescript-community/ui-mapbox/compare/v6.2.21...v6.2.22) (2023-11-29)
|
|
7
21
|
|
|
8
22
|
### Bug Fixes
|
package/common.d.ts
CHANGED
|
@@ -496,7 +496,7 @@ export interface MapboxApi {
|
|
|
496
496
|
getLayer(name: string, nativeMap?: any): Promise<LayerCommon>;
|
|
497
497
|
getLayers(nativeMap?: any): Promise<LayerCommon[]>;
|
|
498
498
|
getImage(imageId: string, nativeMap?: any): Promise<ImageSource>;
|
|
499
|
-
addImage(imageId: string,
|
|
499
|
+
addImage(imageId: string, imagePath: string, nativeMap?: any): Promise<void>;
|
|
500
500
|
removeImage(imageId: string, nativeMap?: any): Promise<void>;
|
|
501
501
|
project(data: LatLng): {
|
|
502
502
|
x: number;
|
|
@@ -534,6 +534,7 @@ export declare abstract class MapboxCommon implements MapboxCommonApi {
|
|
|
534
534
|
static merge(obj1: {}, obj2: {}): any;
|
|
535
535
|
requestFineLocationPermission(): Promise<any>;
|
|
536
536
|
hasFineLocationPermission(): Promise<boolean>;
|
|
537
|
+
protected fetchImageSource(imagePath: string): Promise<ImageSource>;
|
|
537
538
|
}
|
|
538
539
|
/**
|
|
539
540
|
* Interface definition for a View of a mapbox map.
|
|
@@ -583,7 +584,7 @@ export interface MapboxViewApi {
|
|
|
583
584
|
getLayer(name: string, nativeMap?: any): Promise<LayerCommon>;
|
|
584
585
|
getLayers(nativeMap?: any): Promise<LayerCommon[]>;
|
|
585
586
|
getImage(imageId: string, nativeMap?: any): Promise<ImageSource>;
|
|
586
|
-
addImage(imageId: string,
|
|
587
|
+
addImage(imageId: string, imagePath: string, nativeMap?: any): Promise<void>;
|
|
587
588
|
removeImage(imageId: string, nativeMap?: any): Promise<void>;
|
|
588
589
|
destroy(): Promise<any>;
|
|
589
590
|
onStart(): Promise<any>;
|
|
@@ -664,7 +665,7 @@ export declare abstract class MapboxViewCommonBase extends ContentView implement
|
|
|
664
665
|
getLayer(name: string, nativeMap?: any): Promise<LayerCommon>;
|
|
665
666
|
getLayers(nativeMap?: any): Promise<LayerCommon[]>;
|
|
666
667
|
getImage(imageId: string): Promise<ImageSource>;
|
|
667
|
-
addImage(imageId: string,
|
|
668
|
+
addImage(imageId: string, imagePath: string): Promise<void>;
|
|
668
669
|
removeImage(imageId: string): Promise<void>;
|
|
669
670
|
destroy(): Promise<any>;
|
|
670
671
|
onStart(): Promise<any>;
|
package/common.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Color, ContentView, ImageSource, Property, Trace, booleanConverter } from '@nativescript/core';
|
|
1
|
+
import { Color, ContentView, ImageSource, Property, Trace, Utils, booleanConverter } from '@nativescript/core';
|
|
2
2
|
export * from './geo.utils';
|
|
3
3
|
export * from './expression/expression-parser';
|
|
4
4
|
export * from './layers/layer-factory';
|
|
@@ -57,6 +57,16 @@ export class MapboxCommon {
|
|
|
57
57
|
async hasFineLocationPermission() {
|
|
58
58
|
return true;
|
|
59
59
|
}
|
|
60
|
+
async fetchImageSource(imagePath) {
|
|
61
|
+
if (Utils.isDataURI(imagePath)) {
|
|
62
|
+
const [, base64] = imagePath.split(';base64,');
|
|
63
|
+
return ImageSource.fromBase64Sync(base64);
|
|
64
|
+
}
|
|
65
|
+
if (Utils.isFileOrResourcePath(imagePath)) {
|
|
66
|
+
return ImageSource.fromFileOrResourceSync(imagePath);
|
|
67
|
+
}
|
|
68
|
+
return ImageSource.fromUrl(imagePath);
|
|
69
|
+
}
|
|
60
70
|
}
|
|
61
71
|
MapboxCommon.defaults = {
|
|
62
72
|
style: MapStyle.STREETS.toString(),
|
|
@@ -230,8 +240,8 @@ export class MapboxViewCommonBase extends ContentView {
|
|
|
230
240
|
getImage(imageId) {
|
|
231
241
|
return this.mapbox.getImage(imageId, this.getNativeMapView());
|
|
232
242
|
}
|
|
233
|
-
addImage(imageId,
|
|
234
|
-
return this.mapbox.addImage(imageId,
|
|
243
|
+
addImage(imageId, imagePath) {
|
|
244
|
+
return this.mapbox.addImage(imageId, imagePath, this.getNativeMapView());
|
|
235
245
|
}
|
|
236
246
|
removeImage(imageId) {
|
|
237
247
|
return this.mapbox.removeImage(imageId, this.getNativeMapView());
|
package/index.android.d.ts
CHANGED
|
@@ -249,7 +249,7 @@ export declare class Mapbox extends MapboxCommon implements MapboxApi {
|
|
|
249
249
|
*/
|
|
250
250
|
setMapStyle(style: string | MapStyle, nativeMapViewInstance?: any): Promise<void>;
|
|
251
251
|
getImage(imageId: string, nativeMap?: any): Promise<ImageSource>;
|
|
252
|
-
addImage(imageId: string,
|
|
252
|
+
addImage(imageId: string, imagePath: string, nativeMap?: any): Promise<void>;
|
|
253
253
|
removeImage(imageId: string, nativeMap?: any): Promise<void>;
|
|
254
254
|
addMarkers(markers: MapboxMarker[], nativeMap?: any): Promise<void>;
|
|
255
255
|
removeMarkers(ids?: any, nativeMap?: any): Promise<void>;
|
package/index.android.js
CHANGED
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
* @todo FIXME: The gcFix() implementation currently assumes only one map visible at a time.
|
|
5
5
|
*/
|
|
6
6
|
import { request } from '@nativescript-community/perms';
|
|
7
|
-
import { AndroidApplication, Application, Color, File, Http,
|
|
7
|
+
import { AndroidApplication, Application, Color, File, Http, ImageSource, Trace, Utils, knownFolders, path } from '@nativescript/core';
|
|
8
8
|
import { ExpressionParser } from './expression/expression-parser';
|
|
9
9
|
import { Layer, LayerFactory } from './layers/layer-factory';
|
|
10
|
-
import { CLog, CLogTypes, MapStyle, MapboxCommon,
|
|
10
|
+
import { CLog, CLogTypes, MapStyle, MapboxCommon, MapboxViewBase, telemetryProperty } from './common';
|
|
11
11
|
// Export the enums for devs not using TS
|
|
12
12
|
export * from './common';
|
|
13
13
|
let libraryLoadedOverloaded = false;
|
|
@@ -987,19 +987,16 @@ export class Mapbox extends MapboxCommon {
|
|
|
987
987
|
}
|
|
988
988
|
});
|
|
989
989
|
}
|
|
990
|
-
async addImage(imageId,
|
|
991
|
-
return new Promise((resolve, reject) => {
|
|
990
|
+
async addImage(imageId, imagePath, nativeMap) {
|
|
991
|
+
return new Promise(async (resolve, reject) => {
|
|
992
992
|
const theMap = nativeMap || this._mapboxMapInstance;
|
|
993
993
|
if (!theMap) {
|
|
994
994
|
reject('No map has been loaded');
|
|
995
995
|
return;
|
|
996
996
|
}
|
|
997
|
-
if (!image.startsWith('res://')) {
|
|
998
|
-
image = path.join(knownFolders.currentApp().path, image.replace('~/', ''));
|
|
999
|
-
}
|
|
1000
|
-
const img = ImageSource.fromFileOrResourceSync(image);
|
|
1001
997
|
try {
|
|
1002
|
-
|
|
998
|
+
const imageSource = await this.fetchImageSource(imagePath);
|
|
999
|
+
theMap.getStyle().addImage(imageId, imageSource.android);
|
|
1003
1000
|
resolve();
|
|
1004
1001
|
}
|
|
1005
1002
|
catch (ex) {
|
package/index.d.ts
CHANGED
|
@@ -43,7 +43,7 @@ export declare class Mapbox extends MapboxCommon implements MapboxApi {
|
|
|
43
43
|
onDestroy(nativeMap?: any): Promise<void>;
|
|
44
44
|
setMapStyle(style: string | MapStyle, nativeMap?: any): Promise<void>;
|
|
45
45
|
getImage(imageId: string, nativeMap?: any): Promise<ImageSource>;
|
|
46
|
-
addImage(imageId: string,
|
|
46
|
+
addImage(imageId: string, imagePath: string, nativeMap?: any): Promise<void>;
|
|
47
47
|
removeImage(imageId: string, nativeMap?: any): Promise<void>;
|
|
48
48
|
addMarkers(markers: MapboxMarker[], nativeMap?: any): Promise<void>;
|
|
49
49
|
removeMarkers(ids?: any, nativeMap?: any): Promise<void>;
|
package/index.ios.d.ts
CHANGED
|
@@ -111,7 +111,7 @@ export declare class Mapbox extends MapboxCommon implements MapboxApi {
|
|
|
111
111
|
*/
|
|
112
112
|
setMapStyle(style: string | MapStyle, nativeMap?: any): Promise<void>;
|
|
113
113
|
getImage(imageId: string, nativeMap?: any): Promise<ImageSource>;
|
|
114
|
-
addImage(imageId: string,
|
|
114
|
+
addImage(imageId: string, imagePath: string, nativeMap?: any): Promise<void>;
|
|
115
115
|
removeImage(imageId: string, nativeMap?: any): Promise<void>;
|
|
116
116
|
addMarkers(markers: MapboxMarker[], nativeMap?: any): Promise<void>;
|
|
117
117
|
removeMarkers(ids?: any, nativeMap?: any): Promise<void>;
|
package/index.ios.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Color, File, Http, ImageSource, Trace, Utils, knownFolders, path } from '@nativescript/core';
|
|
2
|
-
import { CLog, CLogTypes, MapStyle, MapboxCommon,
|
|
2
|
+
import { CLog, CLogTypes, MapStyle, MapboxCommon, MapboxViewBase, telemetryProperty } from './common';
|
|
3
3
|
import { Layer, LayerFactory } from './layers/layer-factory';
|
|
4
4
|
import { ExpressionParser } from './expression/expression-parser';
|
|
5
5
|
var MGLMapViewDelegateImpl = /** @class */ (function (_super) {
|
|
@@ -998,20 +998,16 @@ export class Mapbox extends MapboxCommon {
|
|
|
998
998
|
}
|
|
999
999
|
});
|
|
1000
1000
|
}
|
|
1001
|
-
async addImage(imageId,
|
|
1002
|
-
return new Promise((resolve, reject) => {
|
|
1001
|
+
async addImage(imageId, imagePath, nativeMap) {
|
|
1002
|
+
return new Promise(async (resolve, reject) => {
|
|
1003
1003
|
const theMap = nativeMap || this._mapboxViewInstance;
|
|
1004
1004
|
if (!theMap) {
|
|
1005
1005
|
reject('No map has been loaded');
|
|
1006
1006
|
return;
|
|
1007
1007
|
}
|
|
1008
|
-
if (!image.startsWith('res://')) {
|
|
1009
|
-
const appPath = knownFolders.currentApp().path;
|
|
1010
|
-
image = appPath + '/' + image.replace('~/', '');
|
|
1011
|
-
}
|
|
1012
|
-
const img = ImageSource.fromFileOrResourceSync(image);
|
|
1013
1008
|
try {
|
|
1014
|
-
|
|
1009
|
+
const imageSource = await this.fetchImageSource(imagePath);
|
|
1010
|
+
theMap.style.setImageForName(imageSource.ios, imageId);
|
|
1015
1011
|
resolve();
|
|
1016
1012
|
}
|
|
1017
1013
|
catch (ex) {
|
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.25",
|
|
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.3.0"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "d30b7e286b25bbf34a2593d14932be196f5a025b"
|
|
58
58
|
}
|
|
@@ -5,7 +5,7 @@ repositories {
|
|
|
5
5
|
// see https://www.mapbox.com/android-sdk/
|
|
6
6
|
dependencies {
|
|
7
7
|
def mapboxVersion = project.hasProperty("mapboxVersion") ? project.mapboxVersion : "8.6.6"
|
|
8
|
-
|
|
8
|
+
def mapboxServicesVersion = project.hasProperty("mapboxServicesVersion") ? project.mapboxServicesVersion : "5.6.0"
|
|
9
9
|
// def mapboxTelemetryVersion = project.hasProperty("mapboxTelemetryVersion") ? project.mapboxTelemetryVersion : "6.1.0"
|
|
10
10
|
def mapboxPluginsVersion = project.hasProperty("mapboxPluginsVersion") ? project.mapboxPluginsVersion : "v9"
|
|
11
11
|
def mapboxAnnotationPluginVersion = project.hasProperty("mapboxAnnotationPluginVersion") ? project.mapboxAnnotationPluginVersion : "0.9.0"
|