Skip to content

Commit

Permalink
Android Offline manager take #1
Browse files Browse the repository at this point in the history
  • Loading branch information
mfazekas committed Mar 6, 2022
1 parent a18f40b commit bbc68c3
Show file tree
Hide file tree
Showing 8 changed files with 823 additions and 6 deletions.
2 changes: 2 additions & 0 deletions android/rctmgl/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ dependencies {
implementation 'com.mapbox.mapboxsdk:mapbox-android-plugin-localization-v9:0.12.0'
implementation 'com.mapbox.mapboxsdk:mapbox-android-plugin-markerview-v9:0.4.0'
implementation 'com.mapbox.mapboxsdk:mapbox-sdk-turf:5.1.0'
} else {
implementation 'com.mapbox.mapboxsdk:mapbox-sdk-turf:5.4.1'
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@
import com.mapbox.rctmgl.components.styles.sources.RCTMGLVectorSourceManager;

import com.mapbox.rctmgl.modules.RCTMGLLogging;
/*

import com.mapbox.rctmgl.modules.RCTMGLOfflineModule;
/*
import com.mapbox.rctmgl.modules.RCTMGLSnapshotModule;
*/
import com.mapbox.rctmgl.modules.RCTMGLLocationModule;
Expand All @@ -61,9 +62,9 @@ public List<NativeModule> createNativeModules(ReactApplicationContext reactAppli
List<NativeModule> modules = new ArrayList<>();
modules.add(new RCTMGLModule(reactApplicationContext));
modules.add(new RCTMGLLocationModule(reactApplicationContext));
/*

modules.add(new RCTMGLOfflineModule(reactApplicationContext));
modules.add(new RCTMGLSnapshotModule(reactApplicationContext));
/* modules.add(new RCTMGLSnapshotModule(reactApplicationContext));
*/
modules.add(new RCTMGLLogging(reactApplicationContext));

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.mapbox.rctmgl.events;

import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.bridge.WritableMap;

public class OfflineEvent extends AbstractEvent {
private String mEventKey;
private WritableMap mPayload;

public OfflineEvent(String eventKey, String eventType, WritableMap payload) {
super(eventType);
mEventKey = eventKey;
mPayload = payload;
}

@Override
public String getKey() {
return mEventKey;
}

@Override
public WritableMap getPayload() {
return mPayload;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ public Map<String, Object> getConstants() {

}

public static String getAccessToken(ReactApplicationContext reactContext) {
return ResourceOptionsManager.Companion.getDefault(reactContext, null).getResourceOptions().getAccessToken();
}

@ReactMethod
public void setAccessToken(final String accessToken) {
mReactContext.runOnUiQueueThread(new Runnable() {
Expand Down
Loading

0 comments on commit bbc68c3

Please sign in to comment.