Skip to content

Commit

Permalink
draw the user trip #268
Browse files Browse the repository at this point in the history
  • Loading branch information
EddyVerbruggen committed Oct 15, 2018
1 parent fc0d84c commit a35ec54
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 20 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
23 changes: 6 additions & 17 deletions src/mapbox.android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -67,9 +66,8 @@ export class MapboxView extends MapboxViewBase {
}

disposeNativeView(): void {
if (_locationEngine) {
_locationEngine.deactivate();
_locationEngine = null;
if (_locationLayerPlugin) {
_locationLayerPlugin.onStop();
}
}

Expand Down Expand Up @@ -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) => {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -797,7 +786,7 @@ export class Mapbox extends MapboxCommon implements MapboxApi {
getUserLocation(): Promise<UserLocation> {
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 {
Expand Down
2 changes: 1 addition & 1 deletion src/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions src/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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",
Expand Down

0 comments on commit a35ec54

Please sign in to comment.