@maplibre/maplibre-react-native 10.1.0 → 10.1.1

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.
Files changed (152) hide show
  1. package/ios/MLRN/CameraStop.h +1 -1
  2. package/ios/MLRN/CameraStop.m +58 -60
  3. package/ios/MLRN/CameraUpdateItem.h +2 -1
  4. package/ios/MLRN/CameraUpdateItem.m +132 -132
  5. package/ios/MLRN/CameraUpdateQueue.m +43 -47
  6. package/ios/MLRN/FilterParser.h +1 -1
  7. package/ios/MLRN/FilterParser.m +5 -6
  8. package/ios/MLRN/MLRNBackgroundLayer.m +10 -9
  9. package/ios/MLRN/MLRNBackgroundLayerManager.m +4 -5
  10. package/ios/MLRN/MLRNCallout.h +1 -1
  11. package/ios/MLRN/MLRNCallout.m +37 -36
  12. package/ios/MLRN/MLRNCalloutManager.m +2 -3
  13. package/ios/MLRN/MLRNCamera.h +1 -1
  14. package/ios/MLRN/MLRNCamera.m +169 -182
  15. package/ios/MLRN/MLRNCameraManager.m +4 -6
  16. package/ios/MLRN/MLRNCircleLayer.m +17 -14
  17. package/ios/MLRN/MLRNCircleLayerManager.m +4 -5
  18. package/ios/MLRN/MLRNCustomHeaders.h +2 -2
  19. package/ios/MLRN/MLRNCustomHeaders.m +63 -63
  20. package/ios/MLRN/MLRNEvent.h +3 -3
  21. package/ios/MLRN/MLRNEvent.m +19 -24
  22. package/ios/MLRN/MLRNEventProtocol.h +1 -1
  23. package/ios/MLRN/MLRNFillExtrusionLayer.m +18 -14
  24. package/ios/MLRN/MLRNFillExtrusionLayerManager.m +4 -5
  25. package/ios/MLRN/MLRNFillLayer.m +16 -14
  26. package/ios/MLRN/MLRNFillLayerManager.m +4 -5
  27. package/ios/MLRN/MLRNHeatmapLayer.m +17 -14
  28. package/ios/MLRN/MLRNHeatmapLayerManager.m +4 -5
  29. package/ios/MLRN/MLRNImageQueue.h +4 -1
  30. package/ios/MLRN/MLRNImageQueue.m +29 -32
  31. package/ios/MLRN/MLRNImageQueueOperation.h +1 -1
  32. package/ios/MLRN/MLRNImageQueueOperation.m +92 -91
  33. package/ios/MLRN/MLRNImageSource.m +36 -38
  34. package/ios/MLRN/MLRNImageSourceManager.m +2 -3
  35. package/ios/MLRN/MLRNImageUtils.h +3 -3
  36. package/ios/MLRN/MLRNImageUtils.m +15 -14
  37. package/ios/MLRN/MLRNImages.h +0 -1
  38. package/ios/MLRN/MLRNImages.m +89 -91
  39. package/ios/MLRN/MLRNImagesManager.m +4 -5
  40. package/ios/MLRN/MLRNLayer.h +9 -11
  41. package/ios/MLRN/MLRNLayer.m +170 -182
  42. package/ios/MLRN/MLRNLight.m +21 -23
  43. package/ios/MLRN/MLRNLightManager.m +2 -3
  44. package/ios/MLRN/MLRNLineLayer.m +17 -15
  45. package/ios/MLRN/MLRNLineLayerManager.m +4 -6
  46. package/ios/MLRN/MLRNLocation.h +1 -1
  47. package/ios/MLRN/MLRNLocation.m +16 -17
  48. package/ios/MLRN/MLRNLocationManager.m +109 -124
  49. package/ios/MLRN/MLRNLocationManagerDelegate.h +3 -3
  50. package/ios/MLRN/MLRNLocationModule.h +1 -1
  51. package/ios/MLRN/MLRNLocationModule.m +40 -55
  52. package/ios/MLRN/MLRNLogging.h +1 -4
  53. package/ios/MLRN/MLRNLogging.m +84 -89
  54. package/ios/MLRN/MLRNMapTouchEvent.h +2 -2
  55. package/ios/MLRN/MLRNMapTouchEvent.m +50 -49
  56. package/ios/MLRN/MLRNMapView.h +43 -36
  57. package/ios/MLRN/MLRNMapView.m +409 -440
  58. package/ios/MLRN/MLRNMapViewManager.m +489 -502
  59. package/ios/MLRN/MLRNModule.h +1 -1
  60. package/ios/MLRN/MLRNModule.m +111 -105
  61. package/ios/MLRN/MLRNNativeUserLocation.m +24 -27
  62. package/ios/MLRN/MLRNNativeUserLocationManager.m +4 -8
  63. package/ios/MLRN/MLRNOfflineModule.h +1 -1
  64. package/ios/MLRN/MLRNOfflineModule.m +416 -421
  65. package/ios/MLRN/MLRNPointAnnotation.h +2 -2
  66. package/ios/MLRN/MLRNPointAnnotation.m +154 -175
  67. package/ios/MLRN/MLRNPointAnnotationManager.m +2 -3
  68. package/ios/MLRN/MLRNRasterLayer.m +16 -12
  69. package/ios/MLRN/MLRNRasterLayerManager.m +4 -5
  70. package/ios/MLRN/MLRNRasterSource.m +21 -17
  71. package/ios/MLRN/MLRNRasterSourceManager.m +2 -3
  72. package/ios/MLRN/MLRNShapeSource.h +17 -16
  73. package/ios/MLRN/MLRNShapeSource.m +94 -102
  74. package/ios/MLRN/MLRNShapeSourceManager.h +2 -2
  75. package/ios/MLRN/MLRNShapeSourceManager.m +86 -90
  76. package/ios/MLRN/MLRNSnapshotModule.h +1 -1
  77. package/ios/MLRN/MLRNSnapshotModule.m +51 -53
  78. package/ios/MLRN/MLRNSource.h +12 -12
  79. package/ios/MLRN/MLRNSource.m +82 -88
  80. package/ios/MLRN/MLRNStyleValue.h +1 -1
  81. package/ios/MLRN/MLRNStyleValue.m +128 -128
  82. package/ios/MLRN/MLRNSymbolLayer.m +17 -13
  83. package/ios/MLRN/MLRNSymbolLayerManager.m +4 -5
  84. package/ios/MLRN/MLRNTileSource.h +1 -1
  85. package/ios/MLRN/MLRNTileSource.m +21 -20
  86. package/ios/MLRN/MLRNUserLocation.h +1 -1
  87. package/ios/MLRN/MLRNUserLocation.m +10 -12
  88. package/ios/MLRN/MLRNUtils.h +18 -11
  89. package/ios/MLRN/MLRNUtils.m +168 -160
  90. package/ios/MLRN/MLRNVectorLayer.m +28 -34
  91. package/ios/MLRN/MLRNVectorSource.h +3 -1
  92. package/ios/MLRN/MLRNVectorSource.m +14 -11
  93. package/ios/MLRN/MLRNVectorSourceManager.h +2 -2
  94. package/ios/MLRN/MLRNVectorSourceManager.m +36 -39
  95. package/ios/MLRN/ViewManager.h +1 -1
  96. package/ios/MLRN/ViewManager.m +29 -35
  97. package/lib/commonjs/components/MarkerView.js +1 -1
  98. package/lib/commonjs/components/UserLocation.js +8 -38
  99. package/lib/commonjs/components/UserLocation.js.map +1 -1
  100. package/lib/commonjs/components/UserLocationPuck.js +52 -0
  101. package/lib/commonjs/components/UserLocationPuck.js.map +1 -0
  102. package/lib/commonjs/components/{HeadingIndicator.js → UserLocationPuckHeading.js} +12 -9
  103. package/lib/commonjs/components/UserLocationPuckHeading.js.map +1 -0
  104. package/lib/module/components/MarkerView.js +1 -1
  105. package/lib/module/components/UserLocation.js +7 -36
  106. package/lib/module/components/UserLocation.js.map +1 -1
  107. package/lib/module/components/UserLocationPuck.js +48 -0
  108. package/lib/module/components/UserLocationPuck.js.map +1 -0
  109. package/lib/module/components/{HeadingIndicator.js → UserLocationPuckHeading.js} +11 -7
  110. package/lib/module/components/UserLocationPuckHeading.js.map +1 -0
  111. package/lib/typescript/commonjs/src/components/MarkerView.d.ts +1 -1
  112. package/lib/typescript/commonjs/src/components/UserLocation.d.ts +0 -1
  113. package/lib/typescript/commonjs/src/components/UserLocation.d.ts.map +1 -1
  114. package/lib/typescript/commonjs/src/components/UserLocationPuck.d.ts +9 -0
  115. package/lib/typescript/commonjs/src/components/UserLocationPuck.d.ts.map +1 -0
  116. package/lib/typescript/commonjs/src/components/UserLocationPuckHeading.d.ts +9 -0
  117. package/lib/typescript/commonjs/src/components/UserLocationPuckHeading.d.ts.map +1 -0
  118. package/lib/typescript/commonjs/src/utils/animated/AbstractAnimatedCoordinates.d.ts +0 -1
  119. package/lib/typescript/commonjs/src/utils/animated/AbstractAnimatedCoordinates.d.ts.map +1 -1
  120. package/lib/typescript/commonjs/src/utils/animated/AnimatedExtractCoordinateFromArray.d.ts +0 -1
  121. package/lib/typescript/commonjs/src/utils/animated/AnimatedExtractCoordinateFromArray.d.ts.map +1 -1
  122. package/lib/typescript/commonjs/src/utils/animated/AnimatedPoint.d.ts +0 -1
  123. package/lib/typescript/commonjs/src/utils/animated/AnimatedPoint.d.ts.map +1 -1
  124. package/lib/typescript/commonjs/src/utils/animated/AnimatedShape.d.ts +0 -1
  125. package/lib/typescript/commonjs/src/utils/animated/AnimatedShape.d.ts.map +1 -1
  126. package/lib/typescript/module/src/components/MarkerView.d.ts +1 -1
  127. package/lib/typescript/module/src/components/UserLocation.d.ts +0 -1
  128. package/lib/typescript/module/src/components/UserLocation.d.ts.map +1 -1
  129. package/lib/typescript/module/src/components/UserLocationPuck.d.ts +9 -0
  130. package/lib/typescript/module/src/components/UserLocationPuck.d.ts.map +1 -0
  131. package/lib/typescript/module/src/components/UserLocationPuckHeading.d.ts +9 -0
  132. package/lib/typescript/module/src/components/UserLocationPuckHeading.d.ts.map +1 -0
  133. package/lib/typescript/module/src/utils/animated/AbstractAnimatedCoordinates.d.ts +0 -1
  134. package/lib/typescript/module/src/utils/animated/AbstractAnimatedCoordinates.d.ts.map +1 -1
  135. package/lib/typescript/module/src/utils/animated/AnimatedExtractCoordinateFromArray.d.ts +0 -1
  136. package/lib/typescript/module/src/utils/animated/AnimatedExtractCoordinateFromArray.d.ts.map +1 -1
  137. package/lib/typescript/module/src/utils/animated/AnimatedPoint.d.ts +0 -1
  138. package/lib/typescript/module/src/utils/animated/AnimatedPoint.d.ts.map +1 -1
  139. package/lib/typescript/module/src/utils/animated/AnimatedShape.d.ts +0 -1
  140. package/lib/typescript/module/src/utils/animated/AnimatedShape.d.ts.map +1 -1
  141. package/package.json +8 -8
  142. package/src/components/MarkerView.tsx +1 -1
  143. package/src/components/UserLocation.tsx +13 -51
  144. package/src/components/UserLocationPuck.tsx +62 -0
  145. package/src/components/UserLocationPuckHeading.tsx +33 -0
  146. package/lib/commonjs/components/HeadingIndicator.js.map +0 -1
  147. package/lib/module/components/HeadingIndicator.js.map +0 -1
  148. package/lib/typescript/commonjs/src/components/HeadingIndicator.d.ts +0 -7
  149. package/lib/typescript/commonjs/src/components/HeadingIndicator.d.ts.map +0 -1
  150. package/lib/typescript/module/src/components/HeadingIndicator.d.ts +0 -7
  151. package/lib/typescript/module/src/components/HeadingIndicator.d.ts.map +0 -1
  152. package/src/components/HeadingIndicator.tsx +0 -26
@@ -1,172 +1,157 @@
1
- #import <CoreLocation/CoreLocation.h>
2
1
  #import "MLRNLocationManager.h"
2
+ #import <CoreLocation/CoreLocation.h>
3
3
 
4
- @interface MLRNLocationManager()<CLLocationManagerDelegate>
4
+ @interface MLRNLocationManager () <CLLocationManagerDelegate>
5
5
  @end
6
6
 
7
- @implementation MLRNLocationManager
8
- {
9
- CLLocationManager *locationManager;
10
- CLLocation *lastKnownLocation;
11
- CLHeading *lastKnownHeading;
12
- CLLocationDistance displacement;
13
- NSMutableArray<MLRNLocationBlock> *listeners;
14
- BOOL isListening;
15
- }
16
-
17
- + (id)sharedInstance
18
- {
19
- static MLRNLocationManager *manager = nil;
20
- static dispatch_once_t onceToken;
21
- dispatch_once(&onceToken, ^{ manager = [[self alloc] init]; });
22
- return manager;
23
- }
24
-
25
- - (instancetype)init
26
- {
27
- if (self = [super init]) {
28
- [self _setupLocationManager];
29
- listeners = [[NSMutableArray alloc] init];
30
- displacement = 0.0;
31
- }
32
- return self;
7
+ @implementation MLRNLocationManager {
8
+ CLLocationManager *locationManager;
9
+ CLLocation *lastKnownLocation;
10
+ CLHeading *lastKnownHeading;
11
+ CLLocationDistance displacement;
12
+ NSMutableArray<MLRNLocationBlock> *listeners;
13
+ BOOL isListening;
14
+ }
15
+
16
+ + (id)sharedInstance {
17
+ static MLRNLocationManager *manager = nil;
18
+ static dispatch_once_t onceToken;
19
+ dispatch_once(&onceToken, ^{
20
+ manager = [[self alloc] init];
21
+ });
22
+ return manager;
33
23
  }
34
24
 
35
- - (void)dealloc
36
- {
37
- locationManager.delegate = nil;
38
- [self stop];
25
+ - (instancetype)init {
26
+ if (self = [super init]) {
27
+ [self _setupLocationManager];
28
+ listeners = [[NSMutableArray alloc] init];
29
+ displacement = 0.0;
30
+ }
31
+ return self;
39
32
  }
40
33
 
41
- - (void)start:(CLLocationDistance)minDisplacement
42
- {
34
+ - (void)dealloc {
35
+ locationManager.delegate = nil;
36
+ [self stop];
37
+ }
43
38
 
44
- displacement = minDisplacement;
39
+ - (void)start:(CLLocationDistance)minDisplacement {
40
+ displacement = minDisplacement;
45
41
 
46
- if ([self isEnabled]) {
47
- return;
48
- }
42
+ if ([self isEnabled]) {
43
+ return;
44
+ }
49
45
 
50
- dispatch_async(dispatch_get_main_queue(), ^{
51
- [self->locationManager requestWhenInUseAuthorization];
52
- [self->locationManager startUpdatingLocation];
53
- [self->locationManager startUpdatingHeading];
54
- [self->locationManager setDistanceFilter:(minDisplacement)];
55
- self->isListening = YES;
56
- });
46
+ dispatch_async(dispatch_get_main_queue(), ^{
47
+ [self->locationManager requestWhenInUseAuthorization];
48
+ [self->locationManager startUpdatingLocation];
49
+ [self->locationManager startUpdatingHeading];
50
+ [self->locationManager setDistanceFilter:(minDisplacement)];
51
+ self->isListening = YES;
52
+ });
57
53
  }
58
54
 
59
- - (void)setMinDisplacement:(CLLocationDistance)minDisplacement
60
- {
61
-
62
- displacement = minDisplacement;
55
+ - (void)setMinDisplacement:(CLLocationDistance)minDisplacement {
56
+ displacement = minDisplacement;
63
57
 
64
- dispatch_async(dispatch_get_main_queue(), ^{
65
- [self->locationManager setDistanceFilter:(minDisplacement)];
66
- });
58
+ dispatch_async(dispatch_get_main_queue(), ^{
59
+ [self->locationManager setDistanceFilter:(minDisplacement)];
60
+ });
67
61
  }
68
62
 
69
- - (void)stop
70
- {
71
- if (![self isEnabled]) {
72
- return;
73
- }
63
+ - (void)stop {
64
+ if (![self isEnabled]) {
65
+ return;
66
+ }
74
67
 
75
- dispatch_async(dispatch_get_main_queue(), ^{
76
- [self->locationManager stopUpdatingLocation];
77
- [self->locationManager stopUpdatingHeading];
78
- self->isListening = NO;
79
- });
68
+ dispatch_async(dispatch_get_main_queue(), ^{
69
+ [self->locationManager stopUpdatingLocation];
70
+ [self->locationManager stopUpdatingHeading];
71
+ self->isListening = NO;
72
+ });
80
73
  }
81
74
 
82
- - (BOOL)isEnabled
83
- {
84
- return isListening;
75
+ - (BOOL)isEnabled {
76
+ return isListening;
85
77
  }
86
78
 
87
- - (MLRNLocation *)getLastKnownLocation
88
- {
89
- CLLocation* newLastLocation = locationManager.location;
90
- if (newLastLocation) {
91
- lastKnownLocation = newLastLocation;
92
- }
93
- MLRNLocation *location = [self _convertToMapboxLocation:lastKnownLocation];
94
- return location;
79
+ - (MLRNLocation *)getLastKnownLocation {
80
+ CLLocation *newLastLocation = locationManager.location;
81
+ if (newLastLocation) {
82
+ lastKnownLocation = newLastLocation;
83
+ }
84
+ MLRNLocation *location = [self _convertToMapboxLocation:lastKnownLocation];
85
+ return location;
95
86
  }
96
87
 
97
- - (void)addListener:(MLRNLocationBlock)listener
98
- {
99
- if (![listeners containsObject:listener]) {
100
- [listeners addObject:listener];
101
- }
88
+ - (void)addListener:(MLRNLocationBlock)listener {
89
+ if (![listeners containsObject:listener]) {
90
+ [listeners addObject:listener];
91
+ }
102
92
  }
103
93
 
104
- - (void)removeListener:(MLRNLocationBlock)listener
105
- {
106
- NSUInteger indexOf = [listeners indexOfObject:listener];
94
+ - (void)removeListener:(MLRNLocationBlock)listener {
95
+ NSUInteger indexOf = [listeners indexOfObject:listener];
107
96
 
108
- if (indexOf == NSNotFound) {
109
- return;
110
- }
97
+ if (indexOf == NSNotFound) {
98
+ return;
99
+ }
111
100
 
112
- [listeners removeObjectAtIndex:indexOf];
101
+ [listeners removeObjectAtIndex:indexOf];
113
102
  }
114
103
 
115
- - (void)locationManager:(CLLocationManager *)manager didUpdateHeading:(CLHeading *)heading
116
- {
117
- lastKnownHeading = heading;
104
+ - (void)locationManager:(CLLocationManager *)manager didUpdateHeading:(CLHeading *)heading {
105
+ lastKnownHeading = heading;
118
106
 
119
- if (displacement > 0) {
120
- return;
121
- }
107
+ if (displacement > 0) {
108
+ return;
109
+ }
122
110
 
123
- [self _updateDelegate];
111
+ [self _updateDelegate];
124
112
  }
125
113
 
126
- - (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray<CLLocation *> *)locations
127
- {
128
- lastKnownLocation = [locations lastObject];
129
- [self _updateDelegate];
114
+ - (void)locationManager:(CLLocationManager *)manager
115
+ didUpdateLocations:(NSArray<CLLocation *> *)locations {
116
+ lastKnownLocation = [locations lastObject];
117
+ [self _updateDelegate];
130
118
  }
131
119
 
132
- - (void)_setupLocationManager
133
- {
134
- __weak MLRNLocationManager *weakSelf = self;
120
+ - (void)_setupLocationManager {
121
+ __weak MLRNLocationManager *weakSelf = self;
135
122
 
136
- dispatch_async(dispatch_get_main_queue(), ^{
137
- self->locationManager = [[CLLocationManager alloc] init];
138
- self->locationManager.delegate = weakSelf;
139
- });
123
+ dispatch_async(dispatch_get_main_queue(), ^{
124
+ self->locationManager = [[CLLocationManager alloc] init];
125
+ self->locationManager.delegate = weakSelf;
126
+ });
140
127
  }
141
128
 
142
- - (void)_updateDelegate
143
- {
144
- if (_delegate == nil) {
145
- return;
146
- }
129
+ - (void)_updateDelegate {
130
+ if (_delegate == nil) {
131
+ return;
132
+ }
147
133
 
148
- MLRNLocation *userLocation = [self _convertToMapboxLocation:lastKnownLocation];
134
+ MLRNLocation *userLocation = [self _convertToMapboxLocation:lastKnownLocation];
149
135
 
150
- if (listeners.count > 0) {
151
- for (int i = 0; i < listeners.count; i++) {
152
- MLRNLocationBlock listener = listeners[i];
153
- listener(userLocation);
154
- }
136
+ if (listeners.count > 0) {
137
+ for (int i = 0; i < listeners.count; i++) {
138
+ MLRNLocationBlock listener = listeners[i];
139
+ listener(userLocation);
155
140
  }
141
+ }
156
142
 
157
- [_delegate locationManager:self didUpdateLocation:userLocation];
143
+ [_delegate locationManager:self didUpdateLocation:userLocation];
158
144
  }
159
145
 
160
- - (MLRNLocation *)_convertToMapboxLocation:(CLLocation *)location
161
- {
162
- if (location == nil) {
163
- return nil;
164
- }
146
+ - (MLRNLocation *)_convertToMapboxLocation:(CLLocation *)location {
147
+ if (location == nil) {
148
+ return nil;
149
+ }
165
150
 
166
- MLRNLocation *userLocation = [[MLRNLocation alloc] init];
167
- userLocation.location = location;
168
- userLocation.heading = lastKnownHeading;
169
- return userLocation;
151
+ MLRNLocation *userLocation = [[MLRNLocation alloc] init];
152
+ userLocation.location = location;
153
+ userLocation.heading = lastKnownHeading;
154
+ return userLocation;
170
155
  }
171
156
 
172
157
  @end
@@ -4,9 +4,9 @@
4
4
 
5
5
  @class MLRNLocationManager;
6
6
 
7
- @protocol MLRNLocationManagerDelegate<NSObject>
7
+ @protocol MLRNLocationManagerDelegate <NSObject>
8
8
 
9
- - (void)locationManager:(MLRNLocationManager *)locationManager didUpdateLocation:(MLRNLocation *)location;
9
+ - (void)locationManager:(MLRNLocationManager *)locationManager
10
+ didUpdateLocation:(MLRNLocation *)location;
10
11
 
11
12
  @end
12
-
@@ -2,6 +2,6 @@
2
2
  #import <React/RCTBridgeModule.h>
3
3
  #import <React/RCTEventEmitter.h>
4
4
 
5
- @interface MLRNLocationModule : RCTEventEmitter<RCTBridgeModule>
5
+ @interface MLRNLocationModule : RCTEventEmitter <RCTBridgeModule>
6
6
 
7
7
  @end
@@ -1,91 +1,76 @@
1
1
  #import <CoreLocation/CoreLocation.h>
2
2
 
3
+ #import "MLRNEventTypes.h"
3
4
  #import "MLRNLocation.h"
4
- #import "MLRNLocationModule.h"
5
5
  #import "MLRNLocationManager.h"
6
6
  #import "MLRNLocationManagerDelegate.h"
7
- #import "MLRNEventTypes.h"
7
+ #import "MLRNLocationModule.h"
8
8
 
9
- @interface MLRNLocationModule() <MLRNLocationManagerDelegate>
9
+ @interface MLRNLocationModule () <MLRNLocationManagerDelegate>
10
10
  @end
11
11
 
12
- @implementation MLRNLocationModule
13
- {
14
- MLRNLocationManager *locationManager;
15
- BOOL hasListeners;
12
+ @implementation MLRNLocationModule {
13
+ MLRNLocationManager *locationManager;
14
+ BOOL hasListeners;
16
15
  }
17
16
 
18
17
  RCT_EXPORT_MODULE();
19
18
 
20
- + (BOOL)requiresMainQueueSetup
21
- {
22
- return NO;
19
+ + (BOOL)requiresMainQueueSetup {
20
+ return NO;
23
21
  }
24
22
 
25
- - (instancetype)init
26
- {
27
- if (self = [super init]) {
28
- locationManager = [[MLRNLocationManager alloc] init];
29
- locationManager.delegate = self;
30
- }
31
- return self;
23
+ - (instancetype)init {
24
+ if (self = [super init]) {
25
+ locationManager = [[MLRNLocationManager alloc] init];
26
+ locationManager.delegate = self;
27
+ }
28
+ return self;
32
29
  }
33
30
 
34
- - (void)startObserving
35
- {
36
- [super startObserving];
37
- hasListeners = YES;
31
+ - (void)startObserving {
32
+ [super startObserving];
33
+ hasListeners = YES;
38
34
  }
39
35
 
40
- - (void)stopObserving
41
- {
42
- [super stopObserving];
43
- hasListeners = NO;
36
+ - (void)stopObserving {
37
+ [super stopObserving];
38
+ hasListeners = NO;
44
39
  }
45
40
 
46
- - (NSArray<NSString *> *)supportedEvents
47
- {
48
- return @[RCT_MAPBOX_USER_LOCATION_UPDATE];
41
+ - (NSArray<NSString *> *)supportedEvents {
42
+ return @[ RCT_MAPBOX_USER_LOCATION_UPDATE ];
49
43
  }
50
44
 
51
- RCT_EXPORT_METHOD(start:(CLLocationDistance)minDisplacement)
52
- {
45
+ RCT_EXPORT_METHOD(start : (CLLocationDistance)minDisplacement) {
53
46
  [locationManager start:minDisplacement];
54
47
  }
55
48
 
56
- RCT_EXPORT_METHOD(pause)
57
- {
58
- [locationManager stop];
59
- }
49
+ RCT_EXPORT_METHOD(pause) { [locationManager stop]; }
60
50
 
61
- RCT_EXPORT_METHOD(stop)
62
- {
63
- [locationManager stop];
64
- }
51
+ RCT_EXPORT_METHOD(stop) { [locationManager stop]; }
65
52
 
66
- RCT_EXPORT_METHOD(setMinDisplacement:(CLLocationDistance)minDisplacement)
67
- {
68
- [locationManager setMinDisplacement:minDisplacement];
53
+ RCT_EXPORT_METHOD(setMinDisplacement : (CLLocationDistance)minDisplacement) {
54
+ [locationManager setMinDisplacement:minDisplacement];
69
55
  }
70
56
 
71
- RCT_EXPORT_METHOD(getLastKnownLocation:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
72
- {
73
- MLRNLocation *lastKnownLocation = [locationManager getLastKnownLocation];
74
- resolve(lastKnownLocation);
57
+ RCT_EXPORT_METHOD(getLastKnownLocation : (RCTPromiseResolveBlock)
58
+ resolve rejecter : (RCTPromiseRejectBlock)reject) {
59
+ MLRNLocation *lastKnownLocation = [locationManager getLastKnownLocation];
60
+ resolve(lastKnownLocation);
75
61
  }
76
62
 
77
- - (void)locationManager:(MLRNLocationManager *)locationManager didUpdateLocation:(MLRNLocation *)location
78
- {
79
- if (!hasListeners) {
80
- return;
81
- }
63
+ - (void)locationManager:(MLRNLocationManager *)locationManager
64
+ didUpdateLocation:(MLRNLocation *)location {
65
+ if (!hasListeners) {
66
+ return;
67
+ }
82
68
 
83
- if (self.bridge == nil) {
84
- return;
85
- }
69
+ if (self.bridge == nil) {
70
+ return;
71
+ }
86
72
 
87
- [self sendEventWithName:RCT_MAPBOX_USER_LOCATION_UPDATE body:[location toJSON]];
73
+ [self sendEventWithName:RCT_MAPBOX_USER_LOCATION_UPDATE body:[location toJSON]];
88
74
  }
89
75
 
90
76
  @end
91
-
@@ -4,14 +4,11 @@
4
4
  #import <Foundation/Foundation.h>
5
5
  #import <React/RCTEventEmitter.h>
6
6
 
7
-
8
7
  @class MLNLoggingConfiguration;
9
8
 
10
9
  @interface MLRNLogging : RCTEventEmitter <RCTBridgeModule>
11
10
 
12
- @property (nonatomic, nonnull) MLNLoggingConfiguration* loggingConfiguration;
13
-
14
- - (void)setLoggingLevel:(nonnull NSString*) logLevel;
11
+ @property (nonatomic, nonnull) MLNLoggingConfiguration* loggingConfiguration;
15
12
 
16
13
  @end
17
14
 
@@ -2,131 +2,126 @@
2
2
 
3
3
  @import MapLibre;
4
4
 
5
- @interface MLRNLogging()
5
+ @interface MLRNLogging ()
6
6
  @property (nonatomic) BOOL hasListeners;
7
7
  @end
8
8
 
9
9
  @implementation MLRNLogging
10
10
 
11
11
  + (id)allocWithZone:(NSZone *)zone {
12
- static MLRNLogging *sharedInstance = nil;
13
- static dispatch_once_t onceToken;
14
- dispatch_once(&onceToken, ^{
15
- sharedInstance = [super allocWithZone:zone];
16
- });
17
- return sharedInstance;
12
+ static MLRNLogging *sharedInstance = nil;
13
+ static dispatch_once_t onceToken;
14
+ dispatch_once(&onceToken, ^{
15
+ sharedInstance = [super allocWithZone:zone];
16
+ });
17
+ return sharedInstance;
18
18
  }
19
19
 
20
- -(id)init {
21
- if ( self = [super init] ) {
22
- self.loggingConfiguration = [MLNLoggingConfiguration sharedConfiguration];
23
- [self.loggingConfiguration setLoggingLevel:MLNLoggingLevelWarning];
24
- __weak typeof(self) weakSelf = self;
25
- self.loggingConfiguration.handler = ^(MLNLoggingLevel loggingLevel, NSString *filePath, NSUInteger line, NSString *message) {
26
- [weakSelf sendLogWithLevel:loggingLevel filePath: filePath line: line message: message];
20
+ - (id)init {
21
+ if (self = [super init]) {
22
+ self.loggingConfiguration = [MLNLoggingConfiguration sharedConfiguration];
23
+ [self.loggingConfiguration setLoggingLevel:MLNLoggingLevelWarning];
24
+ __weak typeof(self) weakSelf = self;
25
+ self.loggingConfiguration.handler =
26
+ ^(MLNLoggingLevel loggingLevel, NSString *filePath, NSUInteger line, NSString *message) {
27
+ [weakSelf sendLogWithLevel:loggingLevel filePath:filePath line:line message:message];
27
28
  };
28
- }
29
- return self;
29
+ }
30
+ return self;
30
31
  }
31
32
 
32
33
  RCT_EXPORT_MODULE();
33
34
 
34
- + (BOOL)requiresMainQueueSetup
35
- {
36
- return YES;
35
+ + (BOOL)requiresMainQueueSetup {
36
+ return YES;
37
37
  }
38
38
 
39
- - (NSArray<NSString *> *)supportedEvents
40
- {
41
- return @[@"LogEvent"];
39
+ - (NSArray<NSString *> *)supportedEvents {
40
+ return @[ @"LogEvent" ];
42
41
  }
43
42
 
44
- - (void)startObserving
45
- {
46
- [super startObserving];
47
- self.hasListeners = true;
43
+ - (void)startObserving {
44
+ [super startObserving];
45
+ self.hasListeners = true;
48
46
  }
49
47
 
50
- - (void)stopObserving
51
- {
52
- [super stopObserving];
53
- self.hasListeners = false;
48
+ - (void)stopObserving {
49
+ [super stopObserving];
50
+ self.hasListeners = false;
54
51
  }
55
52
 
56
- - (void)sendLogWithLevel:(MLNLoggingLevel)loggingLevel filePath:(NSString*)filePath line:(NSUInteger)line message:(NSString*)message
57
- {
58
- if (!self.hasListeners) return;
53
+ - (void)sendLogWithLevel:(MLNLoggingLevel)loggingLevel
54
+ filePath:(NSString *)filePath
55
+ line:(NSUInteger)line
56
+ message:(NSString *)message {
57
+ if (!self.hasListeners) return;
59
58
 
60
- NSString* level = @"n/a";
61
- switch (loggingLevel) {
59
+ NSString *level = @"n/a";
60
+ switch (loggingLevel) {
62
61
  case MLNLoggingLevelInfo:
63
- level = @"info";
64
- break;
62
+ level = @"info";
63
+ break;
65
64
  case MLNLoggingLevelError:
66
- level = @"error";
67
- break;
65
+ level = @"error";
66
+ break;
68
67
  #if MLN_LOGGING_ENABLE_DEBUG
69
68
  case MLNLoggingLevelDebug:
70
- level = @"debug";
71
- break;
69
+ level = @"debug";
70
+ break;
72
71
  #endif
73
72
  case MLNLoggingLevelWarning:
74
- level = @"warning";
75
- break;
73
+ level = @"warning";
74
+ break;
76
75
  case MLNLoggingLevelNone:
77
- level = @"none";
78
- break;
76
+ level = @"none";
77
+ break;
79
78
  case MLNLoggingLevelFault:
80
- level = @"fault";
81
- break;
79
+ level = @"fault";
80
+ break;
82
81
  case MLNLoggingLevelVerbose:
83
- level = @"verbose";
84
- break;
85
- }
86
-
87
- NSString* type = nil;
88
- if ([message hasPrefix:@"Failed to load glyph range"]) {
89
- type = @"missing_font";
90
- }
91
-
92
- NSMutableDictionary* body = [@{
93
- @"level": level,
94
- @"message": message,
95
- @"filePath": filePath,
96
- @"line": @(line)
97
- } mutableCopy];
98
-
99
- if (type != nil) {
100
- body[@"type"] = type;
101
- }
102
- [self sendEventWithName:@"LogEvent" body:body];
82
+ level = @"verbose";
83
+ break;
84
+ }
85
+
86
+ NSString *type = nil;
87
+ if ([message hasPrefix:@"Failed to load glyph range"]) {
88
+ type = @"missing_font";
89
+ }
90
+
91
+ NSMutableDictionary *body =
92
+ [@{@"level" : level, @"message" : message, @"filePath" : filePath, @"line" : @(line)}
93
+ mutableCopy];
94
+
95
+ if (type != nil) {
96
+ body[@"type"] = type;
97
+ }
98
+ [self sendEventWithName:@"LogEvent" body:body];
103
99
  }
104
100
 
105
- RCT_EXPORT_METHOD(setLogLevel: (nonnull NSString*)logLevel)
106
- {
107
- MLNLoggingLevel mlnLogLevel = MLNLoggingLevelNone;
108
- if ([logLevel isEqualToString:@"none"]) {
109
- mlnLogLevel = MLNLoggingLevelNone;
110
- } else if ([logLevel isEqualToString:@"debug"]) {
111
- mlnLogLevel = MLNLoggingLevelInfo;
112
- } else if ([logLevel isEqualToString:@"fault"]) {
113
- mlnLogLevel = MLNLoggingLevelFault;
114
- } else if ([logLevel isEqualToString:@"error"]) {
115
- mlnLogLevel = MLNLoggingLevelError;
116
- } else if ([logLevel isEqualToString:@"warning"]) {
117
- mlnLogLevel = MLNLoggingLevelWarning;
118
- } else if ([logLevel isEqualToString:@"info"]) {
119
- mlnLogLevel = MLNLoggingLevelInfo;
120
- } else if ([logLevel isEqualToString:@"debug"]) {
101
+ RCT_EXPORT_METHOD(setLogLevel : (nonnull NSString *)logLevel) {
102
+ MLNLoggingLevel mlnLogLevel = MLNLoggingLevelNone;
103
+ if ([logLevel isEqualToString:@"none"]) {
104
+ mlnLogLevel = MLNLoggingLevelNone;
105
+ } else if ([logLevel isEqualToString:@"debug"]) {
106
+ mlnLogLevel = MLNLoggingLevelInfo;
107
+ } else if ([logLevel isEqualToString:@"fault"]) {
108
+ mlnLogLevel = MLNLoggingLevelFault;
109
+ } else if ([logLevel isEqualToString:@"error"]) {
110
+ mlnLogLevel = MLNLoggingLevelError;
111
+ } else if ([logLevel isEqualToString:@"warning"]) {
112
+ mlnLogLevel = MLNLoggingLevelWarning;
113
+ } else if ([logLevel isEqualToString:@"info"]) {
114
+ mlnLogLevel = MLNLoggingLevelInfo;
115
+ } else if ([logLevel isEqualToString:@"debug"]) {
121
116
  #if MLN_LOGGING_ENABLE_DEBUG
122
- mlnLogLevel = MLNLoggingLevelDebug;
117
+ mlnLogLevel = MLNLoggingLevelDebug;
123
118
  #else
124
- mlnLogLevel = MLNLoggingLevelVerbose;
119
+ mlnLogLevel = MLNLoggingLevelVerbose;
125
120
  #endif
126
- } else if ([logLevel isEqualToString:@"verbose"]) {
127
- mlnLogLevel = MLNLoggingLevelVerbose;
128
- }
129
- self.loggingConfiguration.loggingLevel = mlnLogLevel;
121
+ } else if ([logLevel isEqualToString:@"verbose"]) {
122
+ mlnLogLevel = MLNLoggingLevelVerbose;
123
+ }
124
+ self.loggingConfiguration.loggingLevel = mlnLogLevel;
130
125
  }
131
126
 
132
127
  @end