Skip to content

Commit 660f569

Browse files
committed
1 parent 5ec38d7 commit 660f569

File tree

3 files changed

+21
-10
lines changed

3 files changed

+21
-10
lines changed

android/src/main/java/com/github/quadflask/react/navermap/RNNaverMapView.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import android.graphics.PointF;
44
import android.os.Bundle;
5+
import android.util.Log;
56
import android.view.View;
67
import android.view.ViewGroup;
78

@@ -26,18 +27,23 @@
2627
import java.util.List;
2728

2829
public class RNNaverMapView extends MapView implements OnMapReadyCallback, NaverMap.OnCameraIdleListener, NaverMap.OnMapClickListener, RNNaverMapViewProps {
30+
private static final int LOCATION_PERMISSION_REQUEST_CODE = 100;
2931
private ThemedReactContext themedReactContext;
3032
private FusedLocationSource locationSource;
3133
private NaverMap naverMap;
34+
private NaverMapSdk naverMapSdk;
3235
private ViewAttacherGroup attacherGroup;
3336
private long lastTouch = 0;
3437
private final List<RNNaverMapFeature<?>> features = new ArrayList<>();
3538

36-
public RNNaverMapView(@NonNull ThemedReactContext themedReactContext, ReactApplicationContext appContext, FusedLocationSource locationSource, NaverMapOptions naverMapOptions, Bundle instanceStateBundle) {
39+
// public RNNaverMapView(@NonNull ThemedReactContext themedReactContext, ReactApplicationContext appContext, FusedLocationSource locationSource, NaverMapOptions naverMapOptions, Bundle instanceStateBundle) {
40+
public RNNaverMapView(@NonNull ThemedReactContext themedReactContext, ReactApplicationContext appContext, NaverMapOptions naverMapOptions, Bundle instanceStateBundle) {
3741
super(ReactUtil.getNonBuggyContext(themedReactContext, appContext), naverMapOptions);
3842
this.themedReactContext = themedReactContext;
39-
this.locationSource = locationSource;
43+
// this.locationSource = locationSource;
44+
this.locationSource = new FusedLocationSource(appContext.getCurrentActivity(), LOCATION_PERMISSION_REQUEST_CODE);
4045
super.onCreate(instanceStateBundle);
46+
naverMapSdk = NaverMapSdk.getInstance(appContext);
4147
// super.onStart();
4248
getMapAsync(this);
4349

@@ -68,6 +74,7 @@ public void onMapReady(@NonNull NaverMap naverMap) {
6874
lastTouch = System.currentTimeMillis();
6975
}
7076
});
77+
naverMapSdk.flushCache(() -> Log.i("NaverMap", "Map Cache Clean"));
7178
onInitialized();
7279
}
7380

android/src/main/java/com/github/quadflask/react/navermap/RNNaverMapViewContainer.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,18 @@
1616
import com.naver.maps.geometry.LatLngBounds;
1717
import com.naver.maps.map.NaverMap;
1818
import com.naver.maps.map.NaverMapOptions;
19-
import com.naver.maps.map.util.FusedLocationSource;
19+
// import com.naver.maps.map.util.FusedLocationSource;
2020

2121
public class RNNaverMapViewContainer extends FrameLayout implements RNNaverMapViewProps {
2222
private RNNaverMapView mapView;
2323
private Bundle instanceStateBundle = new Bundle();
2424
private boolean isAttachedToWindow = false;
2525

26-
public RNNaverMapViewContainer(@NonNull ThemedReactContext themedReactContext, ReactApplicationContext appContext, FusedLocationSource locationSource, NaverMapOptions naverMapOptions) {
26+
// public RNNaverMapViewContainer(@NonNull ThemedReactContext themedReactContext, ReactApplicationContext appContext, FusedLocationSource locationSource, NaverMapOptions naverMapOptions) {
27+
public RNNaverMapViewContainer(@NonNull ThemedReactContext themedReactContext, ReactApplicationContext appContext, NaverMapOptions naverMapOptions) {
2728
super(ReactUtil.getNonBuggyContext(themedReactContext, appContext));
28-
this.mapView = new RNNaverMapView(themedReactContext, appContext, locationSource, naverMapOptions, instanceStateBundle);
29+
this.mapView = new RNNaverMapView(themedReactContext, appContext, naverMapOptions, instanceStateBundle);
30+
// this.mapView = new RNNaverMapView(themedReactContext, appContext, locationSource, naverMapOptions, instanceStateBundle);
2931
addView(mapView);
3032
}
3133

android/src/main/java/com/github/quadflask/react/navermap/RNNaverMapViewManager.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import android.graphics.Rect;
44
import android.view.View;
5-
5+
import android.util.Log;
66
import androidx.annotation.NonNull;
77
import androidx.annotation.Nullable;
88

@@ -19,7 +19,7 @@
1919
import com.naver.maps.geometry.LatLngBounds;
2020
import com.naver.maps.map.NaverMap;
2121
import com.naver.maps.map.NaverMapOptions;
22-
import com.naver.maps.map.util.FusedLocationSource;
22+
// import com.naver.maps.map.util.FusedLocationSource;
2323

2424
import java.util.Arrays;
2525
import java.util.Collections;
@@ -31,14 +31,15 @@
3131

3232
public class RNNaverMapViewManager extends ViewGroupManager<RNNaverMapViewContainer> {
3333
private final ReactApplicationContext appContext;
34-
private final FusedLocationSource locationSource;
34+
// private final FusedLocationSource locationSource;
3535

3636
private static final int ANIMATE_TO_REGION = 1;
3737
private static final int ANIMATE_TO_COORDINATE = 2;
3838
private static final int ANIMATE_TO_TWO_COORDINATES = 3;
3939
private static final int SET_LOCATION_TRACKING_MODE = 4;
4040
private static final int ANIMATE_TO_COORDINATES = 6;
4141
private static final int SET_LAYER_GROUP_ENABLED = 7;
42+
private static final int LOCATION_PERMISSION_REQUEST_CODE = 100;
4243
private static final List<String> LAYER_GROUPS = Collections.unmodifiableList(Arrays.asList(
4344
NaverMap.LAYER_GROUP_BUILDING,
4445
NaverMap.LAYER_GROUP_TRANSIT,
@@ -51,7 +52,7 @@ public class RNNaverMapViewManager extends ViewGroupManager<RNNaverMapViewContai
5152
public RNNaverMapViewManager(ReactApplicationContext context) {
5253
super();
5354
this.appContext = context;
54-
locationSource = new FusedLocationSource(context.getCurrentActivity(), 0x1000);
55+
// locationSource = new FusedLocationSource(context.getCurrentActivity(), 0x1000);
5556
}
5657

5758
@NonNull
@@ -63,7 +64,8 @@ public String getName() {
6364
@NonNull
6465
@Override
6566
protected RNNaverMapViewContainer createViewInstance(@NonNull ThemedReactContext reactContext) {
66-
return new RNNaverMapViewContainer(reactContext, appContext, locationSource, getNaverMapViewOptions());
67+
return new RNNaverMapViewContainer(reactContext, appContext, getNaverMapViewOptions());
68+
// return new RNNaverMapViewContainer(reactContext, appContext, locationSource, getNaverMapViewOptions());
6769
}
6870

6971
@Override

0 commit comments

Comments
 (0)