@rnmapbox/maps 10.0.0-beta.54 → 10.0.0-beta.56

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,7 @@
1
1
  package com.mapbox.rctmgl.components.annotation
2
2
 
3
3
  import android.view.View
4
+ import android.widget.FrameLayout
4
5
  import com.mapbox.rctmgl.utils.GeoJSONUtils.toPointGeometry
5
6
  import com.facebook.react.bridge.ReactApplicationContext
6
7
  import com.mapbox.rctmgl.components.AbstractEventEmitter
@@ -8,6 +9,10 @@ import com.facebook.react.uimanager.annotations.ReactProp
8
9
  import com.facebook.react.bridge.ReadableMap
9
10
  import com.facebook.react.common.MapBuilder
10
11
  import com.facebook.react.uimanager.ThemedReactContext
12
+ import com.mapbox.maps.ScreenCoordinate
13
+ import com.mapbox.maps.viewannotation.OnViewAnnotationUpdatedListener
14
+ import com.mapbox.maps.viewannotation.ViewAnnotationManager
15
+ import com.mapbox.rctmgl.components.mapview.RCTMGLMapView
11
16
 
12
17
  class RCTMGLMarkerViewManager(reactApplicationContext: ReactApplicationContext?) :
13
18
  AbstractEventEmitter<RCTMGLMarkerView?>(reactApplicationContext) {
@@ -46,5 +51,28 @@ class RCTMGLMarkerViewManager(reactApplicationContext: ReactApplicationContext?)
46
51
 
47
52
  companion object {
48
53
  const val REACT_CLASS = "RCTMGLMarkerView"
54
+
55
+ fun markerViewContainerSizeFixer(mapView: RCTMGLMapView, viewAnnotationManager: ViewAnnotationManager) {
56
+ // see https://github.com/rnmapbox/maps/issues/2376
57
+ viewAnnotationManager.addOnViewAnnotationUpdatedListener(object :
58
+ OnViewAnnotationUpdatedListener {
59
+ override fun onViewAnnotationVisibilityUpdated(view: View, visible: Boolean) {
60
+ val parent = view.parent
61
+ if (parent is FrameLayout) {
62
+ if ((parent.width == 0 && parent.height == 0) && (mapView.width != 0 || mapView.height != 0)) {
63
+ parent.layout(0,0,mapView.width, mapView.height)
64
+ }
65
+ }
66
+ }
67
+
68
+ override fun onViewAnnotationPositionUpdated(
69
+ view: View,
70
+ leftTopCoordinate: ScreenCoordinate,
71
+ width: Int,
72
+ height: Int
73
+ ) {
74
+ }
75
+ })
76
+ }
49
77
  }
50
78
  }
@@ -43,6 +43,7 @@ import com.mapbox.maps.plugin.scalebar.scalebar
43
43
  import com.mapbox.rctmgl.R
44
44
  import com.mapbox.rctmgl.components.AbstractMapFeature
45
45
  import com.mapbox.rctmgl.components.annotation.RCTMGLMarkerView
46
+ import com.mapbox.rctmgl.components.annotation.RCTMGLMarkerViewManager
46
47
  import com.mapbox.rctmgl.components.annotation.RCTMGLPointAnnotation
47
48
  import com.mapbox.rctmgl.components.camera.RCTMGLCamera
48
49
  import com.mapbox.rctmgl.components.images.RCTMGLImages
@@ -900,6 +901,8 @@ open class RCTMGLMapView(private val mContext: Context, var mManager: RCTMGLMapV
900
901
  images.sendImageMissingEvent(id, mMap)
901
902
  }
902
903
  })
904
+
905
+ RCTMGLMarkerViewManager.markerViewContainerSizeFixer(this, viewAnnotationManager)
903
906
  }
904
907
 
905
908
  // region Ornaments
@@ -269,11 +269,12 @@ open class RCTMGLMapViewManager(context: ReactApplicationContext?) :
269
269
  );
270
270
  }
271
271
  METHOD_QUERY_FEATURES_RECT -> {
272
+ val layerIds = ConvertUtils.toStringList(args!!.getArray(3))
272
273
  mapView.queryRenderedFeaturesInRect(
273
274
  args!!.getString(0),
274
275
  ConvertUtils.toRectF(args.getArray(1)),
275
276
  ExpressionParser.from(args!!.getArray(2)),
276
- ConvertUtils.toStringList(args!!.getArray(3))
277
+ if (layerIds.size == 0) null else layerIds
277
278
  );
278
279
  }
279
280
  METHOD_VISIBLE_BOUNDS -> {
@@ -65,10 +65,10 @@ class CameraUpdateQueue {
65
65
  }
66
66
 
67
67
  open class RCTMGLMapComponentBase : UIView, RCTMGLMapComponent {
68
- private var _map: RCTMGLMapView! = nil
68
+ private weak var _map: RCTMGLMapView! = nil
69
69
  private var _mapCallbacks: [(RCTMGLMapView) -> Void] = []
70
70
 
71
- var map : RCTMGLMapView? {
71
+ weak var map : RCTMGLMapView? {
72
72
  return _map;
73
73
  }
74
74
 
@@ -6,7 +6,7 @@ class RCTMGLCircleLayer: RCTMGLVectorLayer {
6
6
  typealias LayerType = CircleLayer
7
7
 
8
8
  override func makeLayer(style: Style) throws -> Layer {
9
- let vectorSource : VectorSource = try self.layerWithSourceID(in: style)
9
+ let _ : VectorSource = try self.layerWithSourceID(in: style)
10
10
  var layer = LayerType(id: self.id!)
11
11
  layer.sourceLayer = self.sourceLayerID
12
12
  layer.source = sourceID
@@ -44,23 +44,4 @@ class RCTMGLCircleLayer: RCTMGLVectorLayer {
44
44
  func isAddedToMap() -> Bool {
45
45
  return true
46
46
  }
47
- /*
48
- - (MGLCircleStyleLayer*)makeLayer:(MGLStyle*)style
49
- {
50
- MGLSource *source = [self layerWithSourceIDInStyle:style];
51
- if (source == nil) { return nil; }
52
- MGLCircleStyleLayer *layer = [[MGLCircleStyleLayer alloc] initWithIdentifier:self.id source:source];
53
- layer.sourceLayerIdentifier = self.sourceLayerID;
54
- return layer;
55
- }
56
-
57
- - (void)addStyles
58
- {
59
- RCTMGLStyle *style = [[RCTMGLStyle alloc] initWithMGLStyle:self.style];
60
- style.bridge = self.bridge;
61
- [style circleLayer:(MGLCircleStyleLayer*)self.styleLayer withReactStyle:self.reactStyle isValid:^{
62
- return [self isAddedToMap];
63
- }];
64
- }*/
65
-
66
47
  }
@@ -2,7 +2,7 @@ import MapboxMaps
2
2
 
3
3
  class RCTMGLImages : UIView, RCTMGLMapComponent {
4
4
 
5
- var bridge : RCTBridge! = nil
5
+ weak var bridge : RCTBridge! = nil
6
6
  var remoteImages : [String:String] = [:]
7
7
 
8
8
  @objc
@@ -1,12 +1,10 @@
1
- @_spi(Experimental) import MapboxMaps
1
+ import MapboxMaps
2
2
 
3
3
  @objc
4
4
  class RCTMGLInteractiveElement : UIView, RCTMGLMapComponent {
5
5
 
6
- var map : RCTMGLMapView? = nil
7
-
8
- var layers: [RCTMGLSourceConsumer] = []
9
-
6
+ weak var map : RCTMGLMapView? = nil
7
+
10
8
  static let hitboxDefault = 44.0
11
9
 
12
10
  @objc var draggable: Bool = false
@@ -25,13 +23,7 @@ class RCTMGLInteractiveElement : UIView, RCTMGLMapComponent {
25
23
  @objc var onPress: RCTBubblingEventBlock? = nil
26
24
 
27
25
  func getLayerIDs() -> [String] {
28
- layers.compactMap {
29
- if let layer = $0 as? RCTMGLLayer {
30
- return layer.id
31
- } else {
32
- return nil
33
- }
34
- }
26
+ return []
35
27
  }
36
28
 
37
29
  func isDraggable() -> Bool {
@@ -7,11 +7,12 @@ protocol RCTMGLSourceConsumer {
7
7
 
8
8
  @objc(RCTMGLLayer)
9
9
  class RCTMGLLayer : UIView, RCTMGLMapComponent, RCTMGLSourceConsumer {
10
- var bridge : RCTBridge? = nil
10
+ weak var bridge : RCTBridge? = nil
11
11
 
12
12
  @objc var sourceLayerID : String? = nil {
13
13
  didSet { self.optionsChanged() }
14
14
  }
15
+
15
16
  @objc var reactStyle : Dictionary<String, Any>? = nil {
16
17
  didSet {
17
18
  DispatchQueue.main.async {
@@ -27,8 +27,16 @@ typealias RCTMGLLocationBlock = (RCTMGLLocation?) -> Void
27
27
 
28
28
  let RCT_MAPBOX_USER_LOCATION_UPDATE = "MapboxUserLocationUpdate";
29
29
 
30
+ /// This implementation of LocationProviderDelegate is used by `LocationManager` to work around
31
+ /// the fact that the `LocationProvider` API does not allow the delegate to be set to `nil`.
32
+ internal class EmptyLocationProviderDelegate: LocationProviderDelegate {
33
+ func locationProvider(_ provider: LocationProvider, didFailWithError error: Error) {}
34
+ func locationProvider(_ provider: LocationProvider, didUpdateHeading newHeading: CLHeading) {}
35
+ func locationProvider(_ provider: LocationProvider, didUpdateLocations locations: [CLLocation]) {}
36
+ func locationProviderDidChangeAuthorization(_ provider: LocationProvider) {}
37
+ }
30
38
 
31
- protocol RCTMGLLocationManagerDelegate {
39
+ protocol RCTMGLLocationManagerDelegate : AnyObject {
32
40
  func locationManager(_ locationManager: RCTMGLLocationManager, didUpdateLocation: RCTMGLLocation)
33
41
  }
34
42
 
@@ -38,8 +46,8 @@ class RCTMGLLocationManager : LocationProviderDelegate {
38
46
  var lastKnownLocation : CLLocation?
39
47
  var lastKnownHeading : CLHeading?
40
48
 
41
- var delegate: RCTMGLLocationManagerDelegate?
42
- var locationProviderDelage: LocationProviderDelegate?
49
+ weak var delegate: RCTMGLLocationManagerDelegate?
50
+ weak var locationProviderDelage: LocationProviderDelegate?
43
51
 
44
52
  var listeners: [RCTMGLLocationBlock] = []
45
53
 
@@ -60,6 +68,12 @@ class RCTMGLLocationManager : LocationProviderDelegate {
60
68
  provider.startUpdatingLocation()
61
69
  }
62
70
 
71
+ func stop() {
72
+ provider.stopUpdatingHeading()
73
+ provider.stopUpdatingLocation()
74
+ provider.setDelegate(EmptyLocationProviderDelegate())
75
+ }
76
+
63
77
  func _convertToMapboxLocation(_ location: CLLocation?) -> RCTMGLLocation {
64
78
  guard let location = location else {
65
79
  return RCTMGLLocation()
@@ -192,7 +206,7 @@ extension RCTMGLLocationManager: LocationProvider {
192
206
  @objc(RCTMGLLocationModule)
193
207
  class RCTMGLLocationModule: RCTEventEmitter, RCTMGLLocationManagerDelegate {
194
208
 
195
- static var shared : RCTMGLLocationModule? = nil
209
+ static weak var shared : RCTMGLLocationModule? = nil
196
210
 
197
211
  var locationManager : RCTMGLLocationManager
198
212
  var hasListener = false
@@ -233,7 +247,7 @@ class RCTMGLLocationModule: RCTEventEmitter, RCTMGLLocationManagerDelegate {
233
247
  }
234
248
 
235
249
  @objc func stop() {
236
- print("TODO implement RCTMGLLocationModule.stop!")
250
+ locationManager.stop()
237
251
  }
238
252
 
239
253
  @objc func getLastKnownLocation() -> RCTMGLLocation? {
@@ -15,7 +15,7 @@ open class RCTMGLMapView : MapView {
15
15
  var styleLoaded: Bool = false
16
16
  var styleLoadWaiters : [(MapboxMap)->Void] = []
17
17
 
18
- var reactCamera : RCTMGLCamera?
18
+ weak var reactCamera : RCTMGLCamera?
19
19
  var images : [RCTMGLImages] = []
20
20
  var sources : [RCTMGLInteractiveElement] = []
21
21
 
@@ -282,10 +282,26 @@ open class RCTMGLMapView : MapView {
282
282
  // MARK: - event handlers
283
283
 
284
284
  extension RCTMGLMapView {
285
+ private func onEvery<Payload>(event: MapEvents.Event<Payload>, handler: @escaping (RCTMGLMapView, MapEvent<Payload>) -> Void) {
286
+ self.mapView.mapboxMap.onEvery(event: event) { [weak self](mapEvent) in
287
+ guard let self = self else { return }
288
+
289
+ handler(self, mapEvent)
290
+ }
291
+ }
292
+
293
+ private func onNext<Payload>(event: MapEvents.Event<Payload>, handler: @escaping (RCTMGLMapView, MapEvent<Payload>) -> Void) {
294
+ self.mapView.mapboxMap.onNext(event: event) { [weak self](mapEvent) in
295
+ guard let self = self else { return }
296
+
297
+ handler(self, mapEvent)
298
+ }
299
+ }
300
+
285
301
  @objc func setReactOnMapChange(_ value: @escaping RCTBubblingEventBlock) {
286
302
  self.reactOnMapChange = value
287
303
 
288
- self.mapView.mapboxMap.onEvery(event: .cameraChanged, handler: { cameraEvent in
304
+ self.onEvery(event: .cameraChanged, handler: { (self, cameraEvent) in
289
305
  self.wasGestureActive = self.isGestureActive
290
306
  if self.handleMapChangedEvents.contains(.regionIsChanging) {
291
307
  let event = RCTMGLEvent(type:.regionIsChanging, payload: self.buildRegionObject());
@@ -296,7 +312,7 @@ extension RCTMGLMapView {
296
312
  }
297
313
  })
298
314
 
299
- self.mapView.mapboxMap.onEvery(event: .mapIdle, handler: { cameraEvent in
315
+ self.onEvery(event: .mapIdle, handler: { (self, cameraEvent) in
300
316
  if self.handleMapChangedEvents.contains(.regionDidChange) {
301
317
  let event = RCTMGLEvent(type:.regionDidChange, payload: self.buildRegionObject());
302
318
  self.fireEvent(event: event, callback: self.reactOnMapChange)
@@ -367,7 +383,7 @@ extension RCTMGLMapView {
367
383
  }
368
384
 
369
385
  public func setupEvents() {
370
- self.mapboxMap.onEvery(event: .mapLoadingError, handler: {(event) in
386
+ self.onEvery(event: .mapLoadingError, handler: {(self, event) in
371
387
  if let message = event.payload.error.errorDescription {
372
388
  Logger.log(level: .error, message: "MapLoad error \(message)")
373
389
  } else {
@@ -375,7 +391,7 @@ extension RCTMGLMapView {
375
391
  }
376
392
  })
377
393
 
378
- self.mapboxMap.onEvery(event: .styleImageMissing) { (event) in
394
+ self.onEvery(event: .styleImageMissing) { (self, event) in
379
395
  let imageName = event.payload.id
380
396
 
381
397
  self.images.forEach {
@@ -389,7 +405,7 @@ extension RCTMGLMapView {
389
405
  }
390
406
  }
391
407
 
392
- self.mapboxMap.onEvery(event: .renderFrameFinished, handler: { (event) in
408
+ self.onEvery(event: .renderFrameFinished, handler: { (self, event) in
393
409
  var type = RCTMGLEvent.EventType.didFinishRendering
394
410
  if event.payload.renderMode == .full {
395
411
  type = .didFinishRenderingFully
@@ -403,12 +419,12 @@ extension RCTMGLMapView {
403
419
  self.fireEvent(event: event, callback: self.reactOnMapChange)
404
420
  })
405
421
 
406
- self.mapboxMap.onNext(event: .mapLoaded, handler: { (event) in
422
+ self.onNext(event: .mapLoaded, handler: { (self, event) in
407
423
  let event = RCTMGLEvent(type:.didFinishLoadingMap, payload: nil);
408
424
  self.fireEvent(event: event, callback: self.reactOnMapChange)
409
425
  })
410
426
 
411
- self.mapboxMap.onEvery(event: .styleLoaded, handler: { (event) in
427
+ self.onEvery(event: .styleLoaded, handler: { (self, event) in
412
428
  self.onStyleLoadedComponents.forEach { (component) in
413
429
  component.addToMap(self, style: self.mapboxMap.style)
414
430
  }
@@ -215,13 +215,13 @@ extension RCTMGLMapViewManager {
215
215
  resolver: @escaping RCTPromiseResolveBlock,
216
216
  rejecter: @escaping RCTPromiseRejectBlock) -> Void {
217
217
  withMapView(reactTag, name:"queryRenderedFeaturesInRect", rejecter: rejecter) { mapView in
218
- let left = bbox.isEmpty ? 0.0 : CGFloat(bbox[0].floatValue)
219
- let bottom = bbox.isEmpty ? 0.0 : CGFloat(bbox[1].floatValue)
220
- let right = bbox.isEmpty ? 0.0 : CGFloat(bbox[2].floatValue)
221
- let top = bbox.isEmpty ? 0.0 : CGFloat(bbox[3].floatValue)
218
+ let top = bbox.isEmpty ? 0.0 : CGFloat(bbox[0].floatValue)
219
+ let right = bbox.isEmpty ? 0.0 : CGFloat(bbox[1].floatValue)
220
+ let bottom = bbox.isEmpty ? 0.0 : CGFloat(bbox[2].floatValue)
221
+ let left = bbox.isEmpty ? 0.0 : CGFloat(bbox[3].floatValue)
222
222
  let rect = bbox.isEmpty ? CGRect(x: 0.0, y: 0.0, width: mapView.bounds.size.width, height: mapView.bounds.size.height) : CGRect(x: [left,right].min()!, y: [top,bottom].min()!, width: abs(right-left), height: abs(bottom-top))
223
223
  logged("queryRenderedFeaturesInRect.option", rejecter: rejecter) {
224
- let options = try RenderedQueryOptions(layerIds: layerIDs, filter: filter?.asExpression())
224
+ let options = try RenderedQueryOptions(layerIds: layerIDs?.isEmpty ?? true ? nil : layerIDs, filter: filter?.asExpression())
225
225
  mapView.mapboxMap.queryRenderedFeatures(with: rect, options: options) { result in
226
226
  switch result {
227
227
  case .success(let features):
@@ -7,7 +7,7 @@ class RCTMGLMarkerView: UIView, RCTMGLMapComponent {
7
7
  static let key = "RCTMGLMarkerView"
8
8
  let id: String = "marker-\(UUID().uuidString)"
9
9
 
10
- var map: RCTMGLMapView?
10
+ weak var map: RCTMGLMapView?
11
11
 
12
12
  var didAddToMap = false
13
13
 
@@ -14,7 +14,7 @@ class RCTMGLPointAnnotation : RCTMGLInteractiveElement {
14
14
  static var gid = 0;
15
15
 
16
16
  var annotation : PointAnnotation! = nil
17
- var callout: RCTMGLCallout? = nil
17
+ weak var callout: RCTMGLCallout? = nil
18
18
  var calloutId : String?
19
19
  var image : UIImage? = nil
20
20
  var reactSubviews : [UIView] = []
@@ -3,8 +3,8 @@ import MapboxMaps
3
3
  /// RCTMGLSingletonLayer is absract superclass for Light, Atmosphere, Terrain
4
4
  @objc
5
5
  class RCTMGLSingletonLayer : UIView {
6
- var bridge : RCTBridge? = nil
7
- var map : RCTMGLMapView? = nil
6
+ weak var bridge : RCTBridge? = nil
7
+ weak var map : RCTMGLMapView? = nil
8
8
  var style: Style? = nil
9
9
 
10
10
  @objc var reactStyle : Dictionary<String, Any>? = nil {
@@ -2,11 +2,22 @@
2
2
 
3
3
  @objc
4
4
  class RCTMGLSource : RCTMGLInteractiveElement {
5
-
5
+ var layers: [RCTMGLSourceConsumer] = []
6
+
6
7
  var source : Source? = nil
7
8
 
8
9
  var ownsSource : Bool = false
9
10
 
11
+ override func getLayerIDs() -> [String] {
12
+ layers.compactMap {
13
+ if let layer = $0 as? RCTMGLLayer {
14
+ return layer.id
15
+ } else {
16
+ return nil
17
+ }
18
+ }
19
+ }
20
+
10
21
  func makeSource() -> Source {
11
22
  fatalError("Subclasses should override makeSource")
12
23
  }
@@ -15,6 +26,8 @@ class RCTMGLSource : RCTMGLInteractiveElement {
15
26
  fatalError("Subclasses should override makeSource")
16
27
  }
17
28
 
29
+ // MARK: - UIView+React
30
+
18
31
  @objc override func insertReactSubview(_ subview: UIView!, at atIndex: Int) {
19
32
  if let layer : RCTMGLSourceConsumer = subview as? RCTMGLSourceConsumer {
20
33
  if let map = map {
@@ -22,6 +35,15 @@ class RCTMGLSource : RCTMGLInteractiveElement {
22
35
  }
23
36
  layers.append(layer)
24
37
  }
38
+ super.insertReactSubview(subview, at: atIndex)
39
+ }
40
+
41
+ @objc override func removeReactSubview(_ subview: UIView!) {
42
+ super.removeReactSubview(subview)
43
+ }
44
+
45
+ @objc override func didUpdateReactSubviews() {
46
+ // do nothing to prevent inserting layers to UIView hierarchy
25
47
  }
26
48
 
27
49
  // MARK: - RCTMGLInteractiveElement
@@ -225,7 +225,7 @@ class RCTMGLStyleValue {
225
225
  red: CGFloat((Float((rgbValue & 0xff0000) >> 16)) / 255.0),
226
226
  green: CGFloat((Float((rgbValue & 0x00ff00) >> 8)) / 255.0),
227
227
  blue: CGFloat((Float((rgbValue & 0x0000ff) >> 0)) / 255.0),
228
- alpha: 1.0)
228
+ alpha: CGFloat((rgbValue & 0xFF000000) >> 24) / 0xFF)
229
229
  }
230
230
 
231
231
  func mglStyleValueColor() -> Value<StyleColor> {
@@ -2,48 +2,4 @@ import MapboxMaps
2
2
 
3
3
  @objc(RCTMGLVectorLayer)
4
4
  class RCTMGLVectorLayer: RCTMGLLayer {
5
- //@property (nonatomic, copy) NSString *sourceLayerID;
6
- /*
7
- - (NSPredicate*)buildFilters
8
- {
9
- return self.filter ? [FilterParser parse:self.filter] : nil;
10
- }
11
-
12
- - (void)updateFilter:(NSPredicate *)predicate
13
- {
14
- @try {
15
- ((MGLVectorStyleLayer *) self.styleLayer).predicate = predicate;
16
- }
17
- @catch (NSException* exception) {
18
- RCTMGLLogError(@"Invalid predicate: %@ on layer %@ - %@ reason: %@", predicate, self, exception.name, exception.reason);
19
- }
20
- }
21
-
22
- - (void)setSourceLayerID:(NSString *)sourceLayerID
23
- {
24
- _sourceLayerID = sourceLayerID;
25
-
26
- if (self.styleLayer != nil) {
27
- ((MGLVectorStyleLayer*) self.styleLayer).sourceLayerIdentifier = _sourceLayerID;
28
- }
29
- }
30
-
31
- - (void)addedToMap
32
- {
33
- NSPredicate *filter = [self buildFilters];
34
- if (filter != nil) {
35
- [self updateFilter:filter];
36
- }
37
- }
38
-
39
- - (void)setFilter:(NSArray*)filter
40
- {
41
- [super setFilter: filter];
42
-
43
- if (self.styleLayer != nil) {
44
- NSPredicate *predicate = [self buildFilters];
45
- [self updateFilter:predicate];
46
- }
47
- }
48
- */
49
5
  }
@@ -1 +1 @@
1
- {"version":3,"names":["Logger","sharedInstance","instance","constructor","logCallback","setLogCallback","setLogLevel","level","start","stop","subscribe","unsubscribe","effectiveLevel","log","message","tag","startsWith","onLog","console","error","warn"],"sourceRoot":"../../javascript","sources":["Logger.ts"],"mappings":";;;;;;;AAAA;;AASA,MAAMA,MAAM,CAAC;EAOX,OAAOC,cAAc,GAAG;IACtB,IAAI,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AACC,GAAG,CAAC;MACtC,IAAIN,KAAK,KAAK,OAAO,EAAE;QACrBW,OAAO,CAACC,KAAK,CAAC,cAAc,EAAEL,OAAO,EAAED,GAAG,CAAC;MAC7C,CAAC,MAAM,IAAIN,KAAK,KAAK,SAAS,EAAE;QAC9BW,OAAO,CAACE,IAAI,CAAC,gBAAgB,EAAEN,OAAO,EAAED,GAAG,CAAC;MAC9C,CAAC,MAAM;QACLK,OAAO,CAACL,GAAG,CAAE,WAAUN,KAAM,GAAE,EAAEO,OAAO,EAAED,GAAG,CAAC;MAChD;IACF;EACF;AACF;AAAC,gBA7FKb,MAAM,cACuB,IAAI;AA8FvCA,MAAM,CAACC,cAAc,EAAE,CAACO,KAAK,EAAE;AAAC,eAEjBR,MAAM;AAAA"}
1
+ {"version":3,"names":["Logger","sharedInstance","instance","constructor","logCallback","setLogCallback","setLogLevel","level","start","stop","subscribe","unsubscribe","effectiveLevel","log","message","tag","startsWith","onLog","console","error","warn"],"sourceRoot":"../../javascript","sources":["Logger.ts"],"mappings":";;;;;;;AAAA;;AASA,MAAMA,MAAM,CAAC;EAOX,OAAOC,cAAc,GAAG;IACtB,IAAI,IAAI,CAACC,QAAQ,KAAK,IAAI,EAAE;MAC1B,IAAI,CAACA,QAAQ,GAAG,IAAIF,MAAM,EAAE;IAC9B;IACA,OAAO,IAAI,CAACE,QAAQ;EACtB;EAEAC,WAAW,GAAG;IAAA,+BAXI,MAAM;IAAA;IAAA,sCAET,CAAC;IAUd,IAAI,CAACC,WAAW,GAAG,IAAI;EACzB;;EAEA;AACF;AACA;AACA;AACA;EACE,OAAOC,cAAc,CAACD,WAAwB,EAAE;IAC9C,IAAI,CAACH,cAAc,EAAE,CAACI,cAAc,CAACD,WAAW,CAAC;EACnD;;EAEA;AACF;AACA;AACA;AACA;EACEC,cAAc,CAACD,WAAwB,EAAE;IACvC,IAAI,CAACA,WAAW,GAAGA,WAAW;EAChC;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;;EA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logger","sharedInstance","instance","constructor","logCallback","setLogCallback","setLogLevel","level","start","stop","subscribe","unsubscribe","effectiveLevel","log","message","tag","startsWith","onLog","console","error","warn"],"sourceRoot":"../../javascript","sources":["Logger.ts"],"mappings":";AAAA;;AASA,MAAMA,MAAM,CAAC;EAOX,OAAOC,cAAc,GAAG;IACtB,IAAI,IAAI,CAACC,QAAQ,KAAK,IAAI,EAAE;MAC1B,IAAI,CAACA,QAAQ,GAAG,IAAIF,MAAM,EAAE;IAC9B;IACA,OAAO,IAAI,CAACE,QAAQ;EACtB;EAEAC,WAAW,GAAG;IAAA,+BAXI,MAAM;IAAA;IAAA,sCAET,CAAC;IAUd,IAAI,CAACC,WAAW,GAAG,IAAI;EACzB;;EAEA;AACF;AACA;AACA;AACA;EACE,OAAOC,cAAc,CAACD,WAAwB,EAAE;IAC9C,IAAI,CAACH,cAAc,EAAE,CAACI,cAAc,CAACD,WAAW,CAAC;EACnD;;EAEA;AACF;AACA;AACA;AACA;EACEC,cAAc,CAACD,WAAwB,EAAE;IACvC,IAAI,CAACA,WAAW,GAAGA,WAAW;EAChC;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;;EAEE;AACF;AACA;AACA;EACE,OAAOE,WAAW,CAACC,KAAe,EAAE;IAClC,IAAI,CAACN,cAAc,EAAE,CAACM,KAAK,GAAGA,KAAK;EACrC;EAEAC,KAAK,GAAG,CAAC;EAETC,IAAI,GAAG,CAAC;EAERC,SAAS,GAAG;IACV;EACF;EAEAC,WAAW,GAAG;IACZ;EACF;EAEAC,cAAc,CAACC,GAAe,EAAY;IACxC,MAAM;MAAEN,KAAK;MAAEO,OAAO;MAAEC;IAAI,CAAC,GAAGF,GAAG;IAEnC,IAAIN,KAAK,KAAK,SAAS,EAAE;MACvB,IACEQ,GAAG,KAAK,kBAAkB,IAC1BD,OAAO,CAACE,UAAU,CAAC,mDAAmD,CAAC,EACvE;QACA;QACA,OAAO,MAAM;MACf;IACF;IACA,OAAOT,KAAK;EACd;EAEAU,KAAK,CAACJ,GAAe,EAAE;IACrB,IAAI,CAAC,IAAI,CAACT,WAAW,IAAI,CAAC,IAAI,CAACA,WAAW,CAACS,GAAG,CAAC,EAAE;MAC/C,MAAM;QAAEC;MAAQ,CAAC,GAAGD,GAAG;MACvB,MAAMN,KAAK,GAAG,IAAI,CAACK,cAAc,CAACC,GAAG,CAAC;MACtC,IAAIN,KAAK,KAAK,OAAO,EAAE;QACrBW,OAAO,CAACC,KAAK,CAAC,cAAc,EAAEL,OAAO,EAAED,GAAG,CAAC;MAC7C,CAAC,MAAM,IAAIN,KAAK,KAAK,SAAS,EAAE;QAC9BW,OAAO,CAACE,IAAI,CAAC,gBAAgB,EAAEN,OAAO,EAAED,GAAG,CAAC;MAC9C,CAAC,MAAM;QACLK,OAAO,CAACL,GAAG,CAAE,WAAUN,KAAM,GAAE,EAAEO,OAAO,EAAED,GAAG,CAAC;MAChD;IACF;EACF;AACF;AAAC,gBA7FKb,MAAM,cACuB,IAAI;AA8FvCA,MAAM,CAACC,cAAc,EAAE,CAACO,KAAK,EAAE;AAE/B,eAAeR,MAAM"}
1
+ {"version":3,"names":["Logger","sharedInstance","instance","constructor","logCallback","setLogCallback","setLogLevel","level","start","stop","subscribe","unsubscribe","effectiveLevel","log","message","tag","startsWith","onLog","console","error","warn"],"sourceRoot":"../../javascript","sources":["Logger.ts"],"mappings":";AAAA;;AASA,MAAMA,MAAM,CAAC;EAOX,OAAOC,cAAc,GAAG;IACtB,IAAI,IAAI,CAACC,QAAQ,KAAK,IAAI,EAAE;MAC1B,IAAI,CAACA,QAAQ,GAAG,IAAIF,MAAM,EAAE;IAC9B;IACA,OAAO,IAAI,CAACE,QAAQ;EACtB;EAEAC,WAAW,GAAG;IAAA,+BAXI,MAAM;IAAA;IAAA,sCAET,CAAC;IAUd,IAAI,CAACC,WAAW,GAAG,IAAI;EACzB;;EAEA;AACF;AACA;AACA;AACA;EACE,OAAOC,cAAc,CAACD,WAAwB,EAAE;IAC9C,IAAI,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E,EAAEO,OAAO,EAAED,GAAG,CAAC;MAChD;IACF;EACF;AACF;AAAC,gBA7FKb,MAAM,cACuB,IAAI;AA8FvCA,MAAM,CAACC,cAAc,EAAE,CAACO,KAAK,EAAE;AAE/B,eAAeR,MAAM"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rnmapbox/maps",
3
3
  "description": "A Mapbox react native module for creating custom maps",
4
- "version": "10.0.0-beta.54",
4
+ "version": "10.0.0-beta.56",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -97,7 +97,7 @@
97
97
  "react-native": "0.67.0",
98
98
  "react-native-builder-bob": "^0.20.0",
99
99
  "react-test-renderer": "17.0.2",
100
- "typescript": "4.8.3"
100
+ "typescript": "4.8.4"
101
101
  },
102
102
  "jest": {
103
103
  "preset": "react-native",
@@ -212,32 +212,40 @@ const addMapboxMavenRepo = (projectBuildGradle) => {
212
212
  if (projectBuildGradle.includes('api.mapbox.com/downloads/v2/releases/maven'))
213
213
  return projectBuildGradle;
214
214
  /*
215
- return projectBuildGradle.replace(
216
- /repositories \s?{/,
217
- `repositories {
218
- maven {
219
- url 'https://api.mapbox.com/downloads/v2/releases/maven'
220
- authentication { basic(BasicAuthentication) }
221
- credentials {
222
- username = 'mapbox'
223
- password = project.properties['MAPBOX_DOWNLOADS_TOKEN'] ?: ""
215
+ Should look like this:
216
+ allprojects {
217
+ // ...
218
+ repositories {
219
+ maven {
220
+ url 'https://api.mapbox.com/downloads/v2/releases/maven'
221
+ authentication { basic(BasicAuthentication) }
222
+ credentials {
223
+ username = 'mapbox'
224
+ password = project.properties['MAPBOX_DOWNLOADS_TOKEN'] ?: ""
225
+ }
224
226
  }
225
- }
226
- `,
227
- );*/
227
+ // ...
228
+ */
229
+ /*
230
+ Since mergeContents checks the anchor for each line, we can't do a "correct"
231
+ RegExp for allprojects...repositories and have to insert a second repositories
232
+ for now
233
+ */
228
234
  return (0, generateCode_1.mergeContents)({
229
235
  tag: `@rnmapbox/maps-v2-maven`,
230
236
  src: projectBuildGradle,
231
- newSrc: `maven {
232
- url 'https://api.mapbox.com/downloads/v2/releases/maven'
233
- authentication { basic(BasicAuthentication) }
234
- credentials {
235
- username = 'mapbox'
236
- password = project.properties['MAPBOX_DOWNLOADS_TOKEN'] ?: ""
237
- }
238
- }`,
237
+ newSrc: `repositories {
238
+ maven {
239
+ url 'https://api.mapbox.com/downloads/v2/releases/maven'
240
+ authentication { basic(BasicAuthentication) }
241
+ credentials {
242
+ username = 'mapbox'
243
+ password = project.properties['MAPBOX_DOWNLOADS_TOKEN'] ?: ""
244
+ }
245
+ }
246
+ }`,
239
247
  anchor: new RegExp(`^\\s*allprojects\\s*{`),
240
- offset: 2,
248
+ offset: 1,
241
249
  comment: '//',
242
250
  }).contents;
243
251
  };
@@ -273,33 +273,42 @@ const addMapboxMavenRepo = (projectBuildGradle: string): string => {
273
273
  return projectBuildGradle;
274
274
 
275
275
  /*
276
- return projectBuildGradle.replace(
277
- /repositories \s?{/,
278
- `repositories {
279
- maven {
280
- url 'https://api.mapbox.com/downloads/v2/releases/maven'
281
- authentication { basic(BasicAuthentication) }
282
- credentials {
283
- username = 'mapbox'
284
- password = project.properties['MAPBOX_DOWNLOADS_TOKEN'] ?: ""
276
+ Should look like this:
277
+ allprojects {
278
+ // ...
279
+ repositories {
280
+ maven {
281
+ url 'https://api.mapbox.com/downloads/v2/releases/maven'
282
+ authentication { basic(BasicAuthentication) }
283
+ credentials {
284
+ username = 'mapbox'
285
+ password = project.properties['MAPBOX_DOWNLOADS_TOKEN'] ?: ""
286
+ }
285
287
  }
286
- }
287
- `,
288
- );*/
288
+ // ...
289
+ */
290
+
291
+ /*
292
+ Since mergeContents checks the anchor for each line, we can't do a "correct"
293
+ RegExp for allprojects...repositories and have to insert a second repositories
294
+ for now
295
+ */
289
296
 
290
297
  return mergeContents({
291
298
  tag: `@rnmapbox/maps-v2-maven`,
292
299
  src: projectBuildGradle,
293
- newSrc: `maven {
294
- url 'https://api.mapbox.com/downloads/v2/releases/maven'
295
- authentication { basic(BasicAuthentication) }
296
- credentials {
297
- username = 'mapbox'
298
- password = project.properties['MAPBOX_DOWNLOADS_TOKEN'] ?: ""
299
- }
300
- }`,
301
- anchor: new RegExp(`^\\s*allprojects\\s*{`), // TODO repositories { is needed as well
302
- offset: 2,
300
+ newSrc: `repositories {
301
+ maven {
302
+ url 'https://api.mapbox.com/downloads/v2/releases/maven'
303
+ authentication { basic(BasicAuthentication) }
304
+ credentials {
305
+ username = 'mapbox'
306
+ password = project.properties['MAPBOX_DOWNLOADS_TOKEN'] ?: ""
307
+ }
308
+ }
309
+ }`,
310
+ anchor: new RegExp(`^\\s*allprojects\\s*{`),
311
+ offset: 1,
303
312
  comment: '//',
304
313
  }).contents;
305
314
  };