Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update maplibre native version #61

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Please add unreleased changes in the following style:
PR Title ([#123](link to my pr))
```

Update react-maplibre ([#34](https://github.com/maplibre/maplibre-react-native/issues/34))
chore: update support libraries ([#121](https://github.com/maplibre/maplibre-react-native/pull/121)).

## 10.0.0-alpha.1
Expand Down
8 changes: 4 additions & 4 deletions android/rctmgl/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ dependencies {
implementation("com.facebook.react:react-android")

// MapLibre SDK
implementation "org.maplibre.gl:android-sdk:9.6.0"
implementation "org.maplibre.gl:android-sdk:10.2.0"
implementation "org.maplibre.gl:android-sdk-turf:5.9.0"

// Dependencies
Expand All @@ -45,9 +45,9 @@ dependencies {


// MapLibre plugins
implementation ("org.maplibre.gl:android-plugin-localization-v9:1.0.0")
implementation ("org.maplibre.gl:android-plugin-annotation-v9:1.0.0")
implementation ("org.maplibre.gl:android-plugin-markerview-v9:1.0.0")
implementation ("org.maplibre.gl:android-plugin-localization-v9:2.0.1")
implementation ("org.maplibre.gl:android-plugin-annotation-v9:2.0.1")
implementation ("org.maplibre.gl:android-plugin-markerview-v9:2.0.1")
}

allprojects {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import com.mapbox.android.core.location.LocationEnginePriority;
*/

import com.mapbox.mapboxsdk.location.engine.LocationEngineProvider;
import com.mapbox.mapboxsdk.location.engine.LocationEngineDefault;
import com.mapbox.mapboxsdk.location.engine.LocationEngineRequest;
import com.mapbox.mapboxsdk.location.engine.LocationEngineResult;
import com.mapbox.mapboxsdk.location.permissions.PermissionsManager;
Expand Down Expand Up @@ -63,7 +63,7 @@ private LocationManager(Context context) {

}
private void buildEngineRequest() {
locationEngine = LocationEngineProvider.getBestLocationEngine(this.context.getApplicationContext());
locationEngine = LocationEngineDefault.INSTANCE.getDefaultLocationEngine(this.context.getApplicationContext());
locationEngineRequest = new LocationEngineRequest.Builder(DEFAULT_INTERVAL_MILLIS)
.setFastestInterval(DEFAULT_FASTEST_INTERVAL_MILLIS)
.setPriority(LocationEngineRequest.PRIORITY_HIGH_ACCURACY)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
package com.mapbox.rctmgl.modules;

import android.content.Context;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;

import com.facebook.react.bridge.Arguments;
import com.facebook.react.bridge.Promise;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.bridge.WritableArray;
import com.facebook.react.bridge.WritableMap;
import com.facebook.react.bridge.WritableNativeMap;
import com.facebook.react.bridge.*;
import com.facebook.react.module.annotations.ReactModule;
import com.facebook.react.modules.core.RCTNativeAppEventEmitter;
import com.mapbox.geojson.FeatureCollection;
Expand Down Expand Up @@ -58,12 +51,14 @@ public class RCTMGLOfflineModule extends ReactContextBaseJavaModule {
public static final Double DEFAULT_MIN_ZOOM_LEVEL = 10.0;
public static final Double DEFAULT_MAX_ZOOM_LEVEL = 20.0;

private ReactApplicationContext mReactContext;
private final Context mContext;
private final ReactContext mReactContext;
private Double mProgressEventThrottle = 300.0;

public RCTMGLOfflineModule(ReactApplicationContext reactApplicationContext) {
super(reactApplicationContext);
mReactContext = reactApplicationContext;
mContext = reactApplicationContext.getApplicationContext();
}

@Override
Expand All @@ -84,7 +79,7 @@ public void removeListeners(Integer count) {
@ReactMethod
public void createPack(ReadableMap options, final Promise promise) {
final String name = ConvertUtils.getString("name", options, "");
final OfflineManager offlineManager = OfflineManager.getInstance(mReactContext);
final OfflineManager offlineManager = OfflineManager.Companion.getInstance(mContext);
LatLngBounds latLngBounds = getBoundsFromOptions(options);

OfflineRegionDefinition definition = makeDefinition(latLngBounds, options);
Expand All @@ -110,7 +105,7 @@ public void onError(String error) {
public void getPacks(final Promise promise) {
activateFileSource();

final OfflineManager offlineManager = OfflineManager.getInstance(mReactContext);
final OfflineManager offlineManager = OfflineManager.Companion.getInstance(mContext);

offlineManager.listOfflineRegions(new OfflineManager.ListOfflineRegionsCallback() {
@Override
Expand All @@ -134,7 +129,7 @@ public void onError(String error) {
@ReactMethod
public void invalidateAmbientCache(final Promise promise) {
activateFileSource();
final OfflineManager offlineManager = OfflineManager.getInstance(mReactContext);
final OfflineManager offlineManager = OfflineManager.Companion.getInstance(mContext);
offlineManager.invalidateAmbientCache(new OfflineManager.FileSourceCallback() {
@Override
public void onSuccess() {
Expand All @@ -152,7 +147,7 @@ public void onError(String error) {
public void clearAmbientCache(final Promise promise) {
activateFileSource();

final OfflineManager offlineManager = OfflineManager.getInstance(mReactContext);
final OfflineManager offlineManager = OfflineManager.Companion.getInstance(mContext);

offlineManager.clearAmbientCache(new OfflineManager.FileSourceCallback() {
@Override
Expand All @@ -171,7 +166,7 @@ public void onError(String error) {
public void setMaximumAmbientCacheSize(int size, final Promise promise) {
activateFileSource();

final OfflineManager offlineManager = OfflineManager.getInstance(mReactContext);
final OfflineManager offlineManager = OfflineManager.Companion.getInstance(mContext);

offlineManager.setMaximumAmbientCacheSize(size, new OfflineManager.FileSourceCallback() {
@Override
Expand All @@ -190,7 +185,7 @@ public void onError(String error) {
@ReactMethod
public void resetDatabase(final Promise promise) {
activateFileSource();
final OfflineManager offlineManager = OfflineManager.getInstance(mReactContext);
final OfflineManager offlineManager = OfflineManager.Companion.getInstance(mContext);
offlineManager.resetDatabase(new OfflineManager.FileSourceCallback() {
@Override
public void onSuccess() {
Expand All @@ -208,7 +203,7 @@ public void onError(String error) {
public void getPackStatus(final String name, final Promise promise) {
activateFileSource();

final OfflineManager offlineManager = OfflineManager.getInstance(mReactContext);
final OfflineManager offlineManager = OfflineManager.Companion.getInstance(mContext);

offlineManager.listOfflineRegions(new OfflineManager.ListOfflineRegionsCallback() {
@Override
Expand Down Expand Up @@ -245,7 +240,7 @@ public void onError(String error) {
public void setPackObserver(final String name, final Promise promise) {
activateFileSource();

final OfflineManager offlineManager = OfflineManager.getInstance(mReactContext);
final OfflineManager offlineManager = OfflineManager.Companion.getInstance(mContext);

offlineManager.listOfflineRegions(new OfflineManager.ListOfflineRegionsCallback() {
@Override
Expand All @@ -271,7 +266,7 @@ public void onError(String error) {
public void invalidatePack(final String name, final Promise promise) {
activateFileSource();

final OfflineManager offlineManager = OfflineManager.getInstance(mReactContext);
final OfflineManager offlineManager = OfflineManager.Companion.getInstance(mContext);

offlineManager.listOfflineRegions(new OfflineManager.ListOfflineRegionsCallback() {
@Override
Expand Down Expand Up @@ -308,7 +303,7 @@ public void onError(String error) {
public void deletePack(final String name, final Promise promise) {
activateFileSource();

final OfflineManager offlineManager = OfflineManager.getInstance(mReactContext);
final OfflineManager offlineManager = OfflineManager.Companion.getInstance(mContext);

offlineManager.listOfflineRegions(new OfflineManager.ListOfflineRegionsCallback() {
@Override
Expand Down Expand Up @@ -348,7 +343,7 @@ public void onError(String error) {
public void pausePackDownload(final String name, final Promise promise) {
activateFileSource();

final OfflineManager offlineManager = OfflineManager.getInstance(mReactContext);
final OfflineManager offlineManager = OfflineManager.Companion.getInstance(mContext);

offlineManager.listOfflineRegions(new OfflineManager.ListOfflineRegionsCallback() {
@Override
Expand Down Expand Up @@ -380,7 +375,7 @@ public void onError(String error) {
public void resumePackDownload(final String name, final Promise promise) {
activateFileSource();

final OfflineManager offlineManager = OfflineManager.getInstance(mReactContext);
final OfflineManager offlineManager = OfflineManager.Companion.getInstance(mContext);

offlineManager.listOfflineRegions(new OfflineManager.ListOfflineRegionsCallback() {
@Override
Expand All @@ -407,7 +402,7 @@ public void onError(String error) {
public void mergeOfflineRegions(final String path, final Promise promise) {
activateFileSource();

final OfflineManager offlineManager = OfflineManager.getInstance(mReactContext);
final OfflineManager offlineManager = OfflineManager.Companion.getInstance(mContext);

offlineManager.mergeOfflineRegions(path, new OfflineManager.MergeOfflineRegionsCallback() {
@Override
Expand All @@ -424,7 +419,7 @@ public void onError(String error) {

@ReactMethod
public void setTileCountLimit(int tileCountLimit) {
OfflineManager offlineManager = OfflineManager.getInstance(mReactContext);
OfflineManager offlineManager = OfflineManager.Companion.getInstance(mContext);
offlineManager.setOfflineMapboxTileCountLimit(tileCountLimit);
}

Expand All @@ -439,7 +434,7 @@ private OfflineRegionDefinition makeDefinition(LatLngBounds latLngBounds, Readab
latLngBounds,
ConvertUtils.getDouble("minZoom", options, DEFAULT_MIN_ZOOM_LEVEL),
ConvertUtils.getDouble("maxZoom", options, DEFAULT_MAX_ZOOM_LEVEL),
mReactContext.getResources().getDisplayMetrics().density);
mContext.getResources().getDisplayMetrics().density);
}

private byte[] getMetadataBytes(String metadata) {
Expand Down Expand Up @@ -591,7 +586,7 @@ private OfflineRegion getRegionByName(String name, OfflineRegion[] offlineRegion
}

private void activateFileSource() {
FileSource fileSource = FileSource.getInstance(mReactContext);
FileSource fileSource = FileSource.getInstance(mContext);
fileSource.activate();
}
}
Loading