diff --git a/CHANGELOG.md b/CHANGELOG.md index a6b3adb..27e1429 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,18 @@ [iOS SDK](https://github.com/mapbox/mapbox-gl-native/blob/master/platform/ios/CHANGELOG.md) +## [4.4.0](https://github.com/EddyVerbruggen/nativescript-mapbox/tree/4.4.0) (2018-10-15) +[Full Changelog](https://github.com/EddyVerbruggen/nativescript-mapbox/compare/4.3.1...4.4.0) + +**Implemented enhancements:** + +- Bump Mapbox iOS and Android SDK [\#269](https://github.com/EddyVerbruggen/nativescript-mapbox/issues/269) + +**Fixed bugs:** + +- draw the user trip [\#268](https://github.com/EddyVerbruggen/nativescript-mapbox/issues/268) + + ## [4.3.1](https://github.com/EddyVerbruggen/nativescript-mapbox/tree/4.3.1) (2018-10-11) [Full Changelog](https://github.com/EddyVerbruggen/nativescript-mapbox/compare/4.3.0...4.3.1) diff --git a/src/mapbox.android.ts b/src/mapbox.android.ts index 3c4b568..988bbdf 100755 --- a/src/mapbox.android.ts +++ b/src/mapbox.android.ts @@ -43,7 +43,6 @@ let _markers = []; let _polylines = []; let _polygons = []; let _markerIconDownloadCache = []; -let _locationEngine = null; let _locationLayerPlugin = null; const ACCESS_FINE_LOCATION_PERMISSION_REQUEST_CODE = 111; @@ -67,9 +66,8 @@ export class MapboxView extends MapboxViewBase { } disposeNativeView(): void { - if (_locationEngine) { - _locationEngine.deactivate(); - _locationEngine = null; + if (_locationLayerPlugin) { + _locationLayerPlugin.onStop(); } } @@ -233,15 +231,7 @@ const _fineLocationPermissionGranted = () => { }; const _showLocation = (theMapView, mapboxMap) => { - // From https://github.com/mapbox/mapbox-plugins-android/blob/master/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/location/LocationLayerModesActivity.java - if (!_locationEngine) { - _locationEngine = new com.mapbox.android.core.location.LocationEngineProvider(application.android.foregroundActivity || application.android.startActivity).obtainBestLocationEngineAvailable(); - _locationEngine.setPriority(com.mapbox.android.core.location.LocationEnginePriority.HIGH_ACCURACY); - _locationEngine.setFastestInterval(1000); - _locationEngine.activate(); - } - - _locationLayerPlugin = new com.mapbox.mapboxsdk.plugins.locationlayer.LocationLayerPlugin(theMapView, mapboxMap, _locationEngine); + _locationLayerPlugin = new com.mapbox.mapboxsdk.plugins.locationlayer.LocationLayerPlugin(theMapView, mapboxMap); }; const _getClickedMarkerDetails = (clicked) => { @@ -627,9 +617,8 @@ export class Mapbox extends MapboxCommon implements MapboxApi { if (viewGroup !== null) { viewGroup.removeView(theMap.mapView); } - if (_locationEngine) { - _locationEngine.deactivate(); - _locationEngine = null; + if (_locationLayerPlugin) { + _locationLayerPlugin.onStop(); } theMap.mapView = null; theMap.mapboxMap = null; @@ -797,7 +786,7 @@ export class Mapbox extends MapboxCommon implements MapboxApi { getUserLocation(): Promise { return new Promise((resolve, reject) => { try { - const loc = _locationEngine ? _locationEngine.getLastLocation() : null; + const loc = _locationLayerPlugin ? _locationLayerPlugin.getLocationEngine().getLastLocation() : null; if (loc === null) { reject("Location not available"); } else { diff --git a/src/package-lock.json b/src/package-lock.json index 8a1daf3..f8e8fb4 100644 --- a/src/package-lock.json +++ b/src/package-lock.json @@ -1,6 +1,6 @@ { "name": "nativescript-mapbox", - "version": "4.3.1", + "version": "4.4.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/src/package.json b/src/package.json index 0d5d34c..c2c7b11 100644 --- a/src/package.json +++ b/src/package.json @@ -1,6 +1,6 @@ { "name": "nativescript-mapbox", - "version": "4.3.1", + "version": "4.4.0", "description": "Native Maps, by Mapbox.", "main": "mapbox", "typings": "index.d.ts", @@ -19,7 +19,8 @@ "scripts": { "build": "npm i && tsc --skipLibCheck", "demo.ios": "npm run build && cd ../demo && tns run ios --syncAllFiles", - "demo.android": "npm run build && cd ../demo && tns run android --log debug", + "demo.android": "npm run build && cd ../demo && tns run android", + "demo.android.build": "npm run build && cd ../demo && tns build android --log debug", "test": "npm run tslint && npm run tslint.demo && cd ../demo && tns build ios && tns build android", "test.ios": "cd ../demo && tns test ios --emulator", "test.ios.device": "cd ../demo && tns test ios",