@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.
- package/ios/MLRN/CameraStop.h +1 -1
- package/ios/MLRN/CameraStop.m +58 -60
- package/ios/MLRN/CameraUpdateItem.h +2 -1
- package/ios/MLRN/CameraUpdateItem.m +132 -132
- package/ios/MLRN/CameraUpdateQueue.m +43 -47
- package/ios/MLRN/FilterParser.h +1 -1
- package/ios/MLRN/FilterParser.m +5 -6
- package/ios/MLRN/MLRNBackgroundLayer.m +10 -9
- package/ios/MLRN/MLRNBackgroundLayerManager.m +4 -5
- package/ios/MLRN/MLRNCallout.h +1 -1
- package/ios/MLRN/MLRNCallout.m +37 -36
- package/ios/MLRN/MLRNCalloutManager.m +2 -3
- package/ios/MLRN/MLRNCamera.h +1 -1
- package/ios/MLRN/MLRNCamera.m +169 -182
- package/ios/MLRN/MLRNCameraManager.m +4 -6
- package/ios/MLRN/MLRNCircleLayer.m +17 -14
- package/ios/MLRN/MLRNCircleLayerManager.m +4 -5
- package/ios/MLRN/MLRNCustomHeaders.h +2 -2
- package/ios/MLRN/MLRNCustomHeaders.m +63 -63
- package/ios/MLRN/MLRNEvent.h +3 -3
- package/ios/MLRN/MLRNEvent.m +19 -24
- package/ios/MLRN/MLRNEventProtocol.h +1 -1
- package/ios/MLRN/MLRNFillExtrusionLayer.m +18 -14
- package/ios/MLRN/MLRNFillExtrusionLayerManager.m +4 -5
- package/ios/MLRN/MLRNFillLayer.m +16 -14
- package/ios/MLRN/MLRNFillLayerManager.m +4 -5
- package/ios/MLRN/MLRNHeatmapLayer.m +17 -14
- package/ios/MLRN/MLRNHeatmapLayerManager.m +4 -5
- package/ios/MLRN/MLRNImageQueue.h +4 -1
- package/ios/MLRN/MLRNImageQueue.m +29 -32
- package/ios/MLRN/MLRNImageQueueOperation.h +1 -1
- package/ios/MLRN/MLRNImageQueueOperation.m +92 -91
- package/ios/MLRN/MLRNImageSource.m +36 -38
- package/ios/MLRN/MLRNImageSourceManager.m +2 -3
- package/ios/MLRN/MLRNImageUtils.h +3 -3
- package/ios/MLRN/MLRNImageUtils.m +15 -14
- package/ios/MLRN/MLRNImages.h +0 -1
- package/ios/MLRN/MLRNImages.m +89 -91
- package/ios/MLRN/MLRNImagesManager.m +4 -5
- package/ios/MLRN/MLRNLayer.h +9 -11
- package/ios/MLRN/MLRNLayer.m +170 -182
- package/ios/MLRN/MLRNLight.m +21 -23
- package/ios/MLRN/MLRNLightManager.m +2 -3
- package/ios/MLRN/MLRNLineLayer.m +17 -15
- package/ios/MLRN/MLRNLineLayerManager.m +4 -6
- package/ios/MLRN/MLRNLocation.h +1 -1
- package/ios/MLRN/MLRNLocation.m +16 -17
- package/ios/MLRN/MLRNLocationManager.m +109 -124
- package/ios/MLRN/MLRNLocationManagerDelegate.h +3 -3
- package/ios/MLRN/MLRNLocationModule.h +1 -1
- package/ios/MLRN/MLRNLocationModule.m +40 -55
- package/ios/MLRN/MLRNLogging.h +1 -4
- package/ios/MLRN/MLRNLogging.m +84 -89
- package/ios/MLRN/MLRNMapTouchEvent.h +2 -2
- package/ios/MLRN/MLRNMapTouchEvent.m +50 -49
- package/ios/MLRN/MLRNMapView.h +43 -36
- package/ios/MLRN/MLRNMapView.m +409 -440
- package/ios/MLRN/MLRNMapViewManager.m +489 -502
- package/ios/MLRN/MLRNModule.h +1 -1
- package/ios/MLRN/MLRNModule.m +111 -105
- package/ios/MLRN/MLRNNativeUserLocation.m +24 -27
- package/ios/MLRN/MLRNNativeUserLocationManager.m +4 -8
- package/ios/MLRN/MLRNOfflineModule.h +1 -1
- package/ios/MLRN/MLRNOfflineModule.m +416 -421
- package/ios/MLRN/MLRNPointAnnotation.h +2 -2
- package/ios/MLRN/MLRNPointAnnotation.m +154 -175
- package/ios/MLRN/MLRNPointAnnotationManager.m +2 -3
- package/ios/MLRN/MLRNRasterLayer.m +16 -12
- package/ios/MLRN/MLRNRasterLayerManager.m +4 -5
- package/ios/MLRN/MLRNRasterSource.m +21 -17
- package/ios/MLRN/MLRNRasterSourceManager.m +2 -3
- package/ios/MLRN/MLRNShapeSource.h +17 -16
- package/ios/MLRN/MLRNShapeSource.m +94 -102
- package/ios/MLRN/MLRNShapeSourceManager.h +2 -2
- package/ios/MLRN/MLRNShapeSourceManager.m +86 -90
- package/ios/MLRN/MLRNSnapshotModule.h +1 -1
- package/ios/MLRN/MLRNSnapshotModule.m +51 -53
- package/ios/MLRN/MLRNSource.h +12 -12
- package/ios/MLRN/MLRNSource.m +82 -88
- package/ios/MLRN/MLRNStyleValue.h +1 -1
- package/ios/MLRN/MLRNStyleValue.m +128 -128
- package/ios/MLRN/MLRNSymbolLayer.m +17 -13
- package/ios/MLRN/MLRNSymbolLayerManager.m +4 -5
- package/ios/MLRN/MLRNTileSource.h +1 -1
- package/ios/MLRN/MLRNTileSource.m +21 -20
- package/ios/MLRN/MLRNUserLocation.h +1 -1
- package/ios/MLRN/MLRNUserLocation.m +10 -12
- package/ios/MLRN/MLRNUtils.h +18 -11
- package/ios/MLRN/MLRNUtils.m +168 -160
- package/ios/MLRN/MLRNVectorLayer.m +28 -34
- package/ios/MLRN/MLRNVectorSource.h +3 -1
- package/ios/MLRN/MLRNVectorSource.m +14 -11
- package/ios/MLRN/MLRNVectorSourceManager.h +2 -2
- package/ios/MLRN/MLRNVectorSourceManager.m +36 -39
- package/ios/MLRN/ViewManager.h +1 -1
- package/ios/MLRN/ViewManager.m +29 -35
- package/lib/commonjs/components/MarkerView.js +1 -1
- package/lib/commonjs/components/UserLocation.js +8 -38
- package/lib/commonjs/components/UserLocation.js.map +1 -1
- package/lib/commonjs/components/UserLocationPuck.js +52 -0
- package/lib/commonjs/components/UserLocationPuck.js.map +1 -0
- package/lib/commonjs/components/{HeadingIndicator.js → UserLocationPuckHeading.js} +12 -9
- package/lib/commonjs/components/UserLocationPuckHeading.js.map +1 -0
- package/lib/module/components/MarkerView.js +1 -1
- package/lib/module/components/UserLocation.js +7 -36
- package/lib/module/components/UserLocation.js.map +1 -1
- package/lib/module/components/UserLocationPuck.js +48 -0
- package/lib/module/components/UserLocationPuck.js.map +1 -0
- package/lib/module/components/{HeadingIndicator.js → UserLocationPuckHeading.js} +11 -7
- package/lib/module/components/UserLocationPuckHeading.js.map +1 -0
- package/lib/typescript/commonjs/src/components/MarkerView.d.ts +1 -1
- package/lib/typescript/commonjs/src/components/UserLocation.d.ts +0 -1
- package/lib/typescript/commonjs/src/components/UserLocation.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/UserLocationPuck.d.ts +9 -0
- package/lib/typescript/commonjs/src/components/UserLocationPuck.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/UserLocationPuckHeading.d.ts +9 -0
- package/lib/typescript/commonjs/src/components/UserLocationPuckHeading.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/utils/animated/AbstractAnimatedCoordinates.d.ts +0 -1
- package/lib/typescript/commonjs/src/utils/animated/AbstractAnimatedCoordinates.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/animated/AnimatedExtractCoordinateFromArray.d.ts +0 -1
- package/lib/typescript/commonjs/src/utils/animated/AnimatedExtractCoordinateFromArray.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/animated/AnimatedPoint.d.ts +0 -1
- package/lib/typescript/commonjs/src/utils/animated/AnimatedPoint.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/animated/AnimatedShape.d.ts +0 -1
- package/lib/typescript/commonjs/src/utils/animated/AnimatedShape.d.ts.map +1 -1
- package/lib/typescript/module/src/components/MarkerView.d.ts +1 -1
- package/lib/typescript/module/src/components/UserLocation.d.ts +0 -1
- package/lib/typescript/module/src/components/UserLocation.d.ts.map +1 -1
- package/lib/typescript/module/src/components/UserLocationPuck.d.ts +9 -0
- package/lib/typescript/module/src/components/UserLocationPuck.d.ts.map +1 -0
- package/lib/typescript/module/src/components/UserLocationPuckHeading.d.ts +9 -0
- package/lib/typescript/module/src/components/UserLocationPuckHeading.d.ts.map +1 -0
- package/lib/typescript/module/src/utils/animated/AbstractAnimatedCoordinates.d.ts +0 -1
- package/lib/typescript/module/src/utils/animated/AbstractAnimatedCoordinates.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/animated/AnimatedExtractCoordinateFromArray.d.ts +0 -1
- package/lib/typescript/module/src/utils/animated/AnimatedExtractCoordinateFromArray.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/animated/AnimatedPoint.d.ts +0 -1
- package/lib/typescript/module/src/utils/animated/AnimatedPoint.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/animated/AnimatedShape.d.ts +0 -1
- package/lib/typescript/module/src/utils/animated/AnimatedShape.d.ts.map +1 -1
- package/package.json +8 -8
- package/src/components/MarkerView.tsx +1 -1
- package/src/components/UserLocation.tsx +13 -51
- package/src/components/UserLocationPuck.tsx +62 -0
- package/src/components/UserLocationPuckHeading.tsx +33 -0
- package/lib/commonjs/components/HeadingIndicator.js.map +0 -1
- package/lib/module/components/HeadingIndicator.js.map +0 -1
- package/lib/typescript/commonjs/src/components/HeadingIndicator.d.ts +0 -7
- package/lib/typescript/commonjs/src/components/HeadingIndicator.d.ts.map +0 -1
- package/lib/typescript/module/src/components/HeadingIndicator.d.ts +0 -7
- package/lib/typescript/module/src/components/HeadingIndicator.d.ts.map +0 -1
- package/src/components/HeadingIndicator.tsx +0 -26
|
@@ -5,94 +5,94 @@
|
|
|
5
5
|
|
|
6
6
|
#import <objc/runtime.h>
|
|
7
7
|
|
|
8
|
-
#import "MLRNCustomHeaders.h"
|
|
9
|
-
#import <MapLibre/MapLibre.h>
|
|
10
8
|
#import <MapLibre/MLNNetworkConfiguration.h>
|
|
9
|
+
#import <MapLibre/MapLibre.h>
|
|
10
|
+
#import "MLRNCustomHeaders.h"
|
|
11
11
|
|
|
12
12
|
@implementation NSMutableURLRequest (CustomHeaders)
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
return req;
|
|
14
|
+
+ (NSMutableURLRequest *)__swizzle_requestWithURL:(NSURL *)url {
|
|
15
|
+
if ([url.scheme isEqualToString:@"ws"]) {
|
|
16
|
+
return [NSMutableURLRequest __swizzle_requestWithURL:url];
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
NSArray<NSString *> *stack = [NSThread callStackSymbols];
|
|
20
|
+
if ([stack count] < 2) {
|
|
21
|
+
return [NSMutableURLRequest __swizzle_requestWithURL:url];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if ([stack[1] containsString:@"MapLibre"] == NO) {
|
|
25
|
+
return [NSMutableURLRequest __swizzle_requestWithURL:url];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
NSMutableURLRequest *req = [NSMutableURLRequest __swizzle_requestWithURL:url];
|
|
29
|
+
NSDictionary<NSString *, NSString *> *currentHeaders =
|
|
30
|
+
[[[MLRNCustomHeaders sharedInstance] currentHeaders] copy];
|
|
31
|
+
if (currentHeaders != nil && [currentHeaders count] > 0) {
|
|
32
|
+
for (NSString *headerName in currentHeaders) {
|
|
33
|
+
id headerValue = currentHeaders[headerName];
|
|
34
|
+
[req setValue:headerValue forHTTPHeaderField:headerName];
|
|
37
35
|
}
|
|
36
|
+
}
|
|
37
|
+
return req;
|
|
38
|
+
}
|
|
38
39
|
|
|
39
40
|
@end
|
|
40
41
|
|
|
41
42
|
@implementation MLRNCustomHeaders {
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
NSMutableDictionary<NSString *, NSString *> *_currentHeaders;
|
|
44
|
+
BOOL areHeadersAdded;
|
|
44
45
|
}
|
|
45
46
|
|
|
46
|
-
+ (id)sharedInstance
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
47
|
+
+ (id)sharedInstance {
|
|
48
|
+
static MLRNCustomHeaders *customHeaders;
|
|
49
|
+
static dispatch_once_t onceToken;
|
|
50
|
+
dispatch_once(&onceToken, ^{
|
|
51
|
+
customHeaders = [[self alloc] init];
|
|
52
|
+
});
|
|
53
|
+
return customHeaders;
|
|
52
54
|
}
|
|
53
55
|
|
|
54
56
|
// This replaces the [NSMutableURLRequest requestWithURL:] with custom implementation which
|
|
55
57
|
// adds runtime headers copied from [MLRNCustomHeaders _currentHeaders]
|
|
56
|
-
-(void)initHeaders
|
|
57
|
-
{
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
58
|
+
- (void)initHeaders {
|
|
59
|
+
if (!areHeadersAdded) {
|
|
60
|
+
areHeadersAdded = YES;
|
|
61
|
+
NSLog(@"Replace method [NSMutableURLRequest requestWithURL]");
|
|
62
|
+
static dispatch_once_t onceToken;
|
|
63
|
+
dispatch_once(&onceToken, ^{
|
|
64
|
+
Class targetClass = [NSMutableURLRequest class];
|
|
65
|
+
Method oldMethod = class_getClassMethod(targetClass, @selector(requestWithURL:));
|
|
66
|
+
Method newMethod = class_getClassMethod(targetClass, @selector(__swizzle_requestWithURL:));
|
|
67
|
+
method_exchangeImplementations(oldMethod, newMethod);
|
|
68
|
+
});
|
|
69
|
+
}
|
|
69
70
|
}
|
|
70
71
|
|
|
71
|
-
- (instancetype)init
|
|
72
|
-
{
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
return self;
|
|
72
|
+
- (instancetype)init {
|
|
73
|
+
if (self = [super init]) {
|
|
74
|
+
_currentHeaders = [[NSMutableDictionary alloc] init];
|
|
75
|
+
areHeadersAdded = NO;
|
|
76
|
+
}
|
|
77
|
+
return self;
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
- (void)addHeader:(NSString *)value forHeaderName:(NSString *)headerName {
|
|
81
|
+
if (!areHeadersAdded) {
|
|
82
|
+
areHeadersAdded = YES;
|
|
83
|
+
}
|
|
81
84
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
[_currentHeaders setObject:value forKey:headerName];
|
|
87
|
-
[[[MLNNetworkConfiguration sharedManager] sessionConfiguration] setHTTPAdditionalHeaders:_currentHeaders];
|
|
85
|
+
[_currentHeaders setObject:value forKey:headerName];
|
|
86
|
+
[[[MLNNetworkConfiguration sharedManager] sessionConfiguration]
|
|
87
|
+
setHTTPAdditionalHeaders:_currentHeaders];
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
- (void)removeHeader:(NSString *)header {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
91
|
+
if (!areHeadersAdded) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
94
|
|
|
95
|
-
|
|
95
|
+
[_currentHeaders removeObjectForKey:header];
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
@end
|
package/ios/MLRN/MLRNEvent.h
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
#import <Foundation/Foundation.h>
|
|
2
2
|
#import "MLRNEventProtocol.h"
|
|
3
3
|
|
|
4
|
-
@interface MLRNEvent : NSObject<MLRNEventProtocol>
|
|
4
|
+
@interface MLRNEvent : NSObject <MLRNEventProtocol>
|
|
5
5
|
|
|
6
6
|
@property (nonatomic, copy) NSString *type;
|
|
7
7
|
@property (nonatomic, strong) NSDictionary *payload;
|
|
8
8
|
@property (nonatomic, readonly) NSTimeInterval timestamp;
|
|
9
9
|
|
|
10
|
-
+ (MLRNEvent*)makeEvent:(NSString*)eventType;
|
|
11
|
-
+ (MLRNEvent*)makeEvent:(NSString*)eventType withPayload:(NSDictionary*)payload;
|
|
10
|
+
+ (MLRNEvent *)makeEvent:(NSString *)eventType;
|
|
11
|
+
+ (MLRNEvent *)makeEvent:(NSString *)eventType withPayload:(NSDictionary *)payload;
|
|
12
12
|
|
|
13
13
|
@end
|
package/ios/MLRN/MLRNEvent.m
CHANGED
|
@@ -2,38 +2,33 @@
|
|
|
2
2
|
|
|
3
3
|
@implementation MLRNEvent
|
|
4
4
|
|
|
5
|
-
- (instancetype)init
|
|
6
|
-
{
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return self;
|
|
5
|
+
- (instancetype)init {
|
|
6
|
+
if (self = [super init]) {
|
|
7
|
+
_timestamp = [[NSDate date] timeIntervalSince1970];
|
|
8
|
+
}
|
|
9
|
+
return self;
|
|
11
10
|
}
|
|
12
11
|
|
|
13
|
-
- (NSDictionary*)payload
|
|
14
|
-
{
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return _payload;
|
|
12
|
+
- (NSDictionary *)payload {
|
|
13
|
+
if (_payload == nil) {
|
|
14
|
+
return @{};
|
|
15
|
+
}
|
|
16
|
+
return _payload;
|
|
19
17
|
}
|
|
20
18
|
|
|
21
|
-
- (NSDictionary*)toJSON
|
|
22
|
-
{
|
|
23
|
-
return @{ @"type": self.type, @"payload": self.payload };
|
|
19
|
+
- (NSDictionary *)toJSON {
|
|
20
|
+
return @{@"type" : self.type, @"payload" : self.payload};
|
|
24
21
|
}
|
|
25
22
|
|
|
26
|
-
+ (MLRNEvent*)makeEvent:(NSString*)type
|
|
27
|
-
{
|
|
28
|
-
return [MLRNEvent makeEvent:type withPayload:@{}];
|
|
23
|
+
+ (MLRNEvent *)makeEvent:(NSString *)type {
|
|
24
|
+
return [MLRNEvent makeEvent:type withPayload:@{}];
|
|
29
25
|
}
|
|
30
26
|
|
|
31
|
-
+ (MLRNEvent*)makeEvent:(NSString*)type withPayload:(NSDictionary*)payload
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
return event;
|
|
27
|
+
+ (MLRNEvent *)makeEvent:(NSString *)type withPayload:(NSDictionary *)payload {
|
|
28
|
+
MLRNEvent *event = [[MLRNEvent alloc] init];
|
|
29
|
+
event.type = type;
|
|
30
|
+
event.payload = payload;
|
|
31
|
+
return event;
|
|
37
32
|
}
|
|
38
33
|
|
|
39
34
|
@end
|
|
@@ -1,24 +1,28 @@
|
|
|
1
1
|
#import "MLRNFillExtrusionLayer.h"
|
|
2
|
-
#import "MLRNStyle.h"
|
|
3
2
|
#import <React/RCTLog.h>
|
|
3
|
+
#import "MLRNStyle.h"
|
|
4
4
|
|
|
5
5
|
@implementation MLRNFillExtrusionLayer
|
|
6
6
|
|
|
7
|
-
- (MLNFillExtrusionStyleLayer*)makeLayer:(MLNStyle*)style
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
- (MLNFillExtrusionStyleLayer *)makeLayer:(MLNStyle *)style {
|
|
8
|
+
MLNSource *source = [self layerWithSourceIDInStyle:style];
|
|
9
|
+
if (source == nil) {
|
|
10
|
+
return nil;
|
|
11
|
+
}
|
|
12
|
+
MLNFillExtrusionStyleLayer *layer =
|
|
13
|
+
[[MLNFillExtrusionStyleLayer alloc] initWithIdentifier:self.id source:source];
|
|
14
|
+
layer.sourceLayerIdentifier = self.sourceLayerID;
|
|
15
|
+
return layer;
|
|
14
16
|
}
|
|
15
17
|
|
|
16
|
-
- (void)addStyles
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
- (void)addStyles {
|
|
19
|
+
MLRNStyle *style = [[MLRNStyle alloc] initWithMLNStyle:self.style];
|
|
20
|
+
style.bridge = self.bridge;
|
|
21
|
+
[style fillExtrusionLayer:(MLNFillExtrusionStyleLayer *)self.styleLayer
|
|
22
|
+
withReactStyle:self.reactStyle
|
|
23
|
+
isValid:^{
|
|
24
|
+
return [self isAddedToMap];
|
|
25
|
+
}];
|
|
22
26
|
}
|
|
23
27
|
|
|
24
28
|
@end
|
|
@@ -21,11 +21,10 @@ RCT_EXPORT_VIEW_PROPERTY(reactStyle, NSDictionary);
|
|
|
21
21
|
RCT_EXPORT_VIEW_PROPERTY(maxZoomLevel, NSNumber);
|
|
22
22
|
RCT_EXPORT_VIEW_PROPERTY(minZoomLevel, NSNumber);
|
|
23
23
|
|
|
24
|
-
- (UIView*)view
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
return layer;
|
|
24
|
+
- (UIView *)view {
|
|
25
|
+
MLRNFillExtrusionLayer *layer = [MLRNFillExtrusionLayer new];
|
|
26
|
+
layer.bridge = self.bridge;
|
|
27
|
+
return layer;
|
|
29
28
|
}
|
|
30
29
|
|
|
31
30
|
@end
|
package/ios/MLRN/MLRNFillLayer.m
CHANGED
|
@@ -5,22 +5,24 @@
|
|
|
5
5
|
|
|
6
6
|
@implementation MLRNFillLayer
|
|
7
7
|
|
|
8
|
-
- (MLNStyleLayer*)makeLayer:(MLNStyle*)style
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
- (MLNStyleLayer *)makeLayer:(MLNStyle *)style {
|
|
9
|
+
MLNSource *source = [self layerWithSourceIDInStyle:style];
|
|
10
|
+
if (source == nil) {
|
|
11
|
+
return nil;
|
|
12
|
+
}
|
|
13
|
+
MLNFillStyleLayer *layer = [[MLNFillStyleLayer alloc] initWithIdentifier:self.id source:source];
|
|
14
|
+
layer.sourceLayerIdentifier = self.sourceLayerID;
|
|
15
|
+
return layer;
|
|
15
16
|
}
|
|
16
17
|
|
|
17
|
-
- (void)addStyles
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
- (void)addStyles {
|
|
19
|
+
MLRNStyle *style = [[MLRNStyle alloc] initWithMLNStyle:self.style];
|
|
20
|
+
style.bridge = self.bridge;
|
|
21
|
+
[style fillLayer:(MLNFillStyleLayer *)self.styleLayer
|
|
22
|
+
withReactStyle:self.reactStyle
|
|
23
|
+
isValid:^{
|
|
24
|
+
return [self isAddedToMap];
|
|
25
|
+
}];
|
|
24
26
|
}
|
|
25
27
|
|
|
26
28
|
@end
|
|
@@ -19,11 +19,10 @@ RCT_EXPORT_VIEW_PROPERTY(reactStyle, NSDictionary);
|
|
|
19
19
|
RCT_EXPORT_VIEW_PROPERTY(maxZoomLevel, NSNumber);
|
|
20
20
|
RCT_EXPORT_VIEW_PROPERTY(minZoomLevel, NSNumber);
|
|
21
21
|
|
|
22
|
-
- (UIView*)view
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
return layer;
|
|
22
|
+
- (UIView *)view {
|
|
23
|
+
MLRNFillLayer *layer = [MLRNFillLayer new];
|
|
24
|
+
layer.bridge = self.bridge;
|
|
25
|
+
return layer;
|
|
27
26
|
}
|
|
28
27
|
|
|
29
28
|
@end
|
|
@@ -3,22 +3,25 @@
|
|
|
3
3
|
|
|
4
4
|
@implementation MLRNHeatmapLayer
|
|
5
5
|
|
|
6
|
-
- (MLNHeatmapStyleLayer*)makeLayer:(MLNStyle*)style
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
- (MLNHeatmapStyleLayer *)makeLayer:(MLNStyle *)style {
|
|
7
|
+
MLNSource *source = [self layerWithSourceIDInStyle:style];
|
|
8
|
+
if (source == nil) {
|
|
9
|
+
return nil;
|
|
10
|
+
}
|
|
11
|
+
MLNHeatmapStyleLayer *layer = [[MLNHeatmapStyleLayer alloc] initWithIdentifier:self.id
|
|
12
|
+
source:source];
|
|
13
|
+
layer.sourceLayerIdentifier = self.sourceLayerID;
|
|
14
|
+
return layer;
|
|
13
15
|
}
|
|
14
16
|
|
|
15
|
-
- (void)addStyles
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
- (void)addStyles {
|
|
18
|
+
MLRNStyle *style = [[MLRNStyle alloc] initWithMLNStyle:self.style];
|
|
19
|
+
style.bridge = self.bridge;
|
|
20
|
+
[style heatmapLayer:(MLNHeatmapStyleLayer *)self.styleLayer
|
|
21
|
+
withReactStyle:self.reactStyle
|
|
22
|
+
isValid:^{
|
|
23
|
+
return [self isAddedToMap];
|
|
24
|
+
}];
|
|
22
25
|
}
|
|
23
26
|
|
|
24
27
|
@end
|
|
@@ -21,11 +21,10 @@ RCT_EXPORT_VIEW_PROPERTY(reactStyle, NSDictionary);
|
|
|
21
21
|
RCT_EXPORT_VIEW_PROPERTY(maxZoomLevel, NSNumber);
|
|
22
22
|
RCT_EXPORT_VIEW_PROPERTY(minZoomLevel, NSNumber);
|
|
23
23
|
|
|
24
|
-
- (UIView*)view
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
return layer;
|
|
24
|
+
- (UIView *)view {
|
|
25
|
+
MLRNHeatmapLayer *layer = [MLRNHeatmapLayer new];
|
|
26
|
+
layer.bridge = self.bridge;
|
|
27
|
+
return layer;
|
|
29
28
|
}
|
|
30
29
|
|
|
31
30
|
@end
|
|
@@ -6,6 +6,9 @@
|
|
|
6
6
|
+ (instancetype)sharedInstance;
|
|
7
7
|
|
|
8
8
|
- (void)cancelAllOperations;
|
|
9
|
-
- (void)addImage:(NSString *)imageURL
|
|
9
|
+
- (void)addImage:(NSString *)imageURL
|
|
10
|
+
scale:(double)scale
|
|
11
|
+
bridge:(RCTBridge *)bridge
|
|
12
|
+
completionHandler:(RCTImageLoaderCompletionBlock)handler;
|
|
10
13
|
|
|
11
14
|
@end
|
|
@@ -2,48 +2,45 @@
|
|
|
2
2
|
#import "MLRNImageQueueOperation.h"
|
|
3
3
|
#import "MLRNUtils.h"
|
|
4
4
|
|
|
5
|
-
@implementation MLRNImageQueue
|
|
6
|
-
|
|
7
|
-
NSOperationQueue *imageQueue;
|
|
5
|
+
@implementation MLRNImageQueue {
|
|
6
|
+
NSOperationQueue *imageQueue;
|
|
8
7
|
}
|
|
9
8
|
|
|
10
|
-
- (id)init
|
|
11
|
-
{
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
return self;
|
|
9
|
+
- (id)init {
|
|
10
|
+
if (self = [super init]) {
|
|
11
|
+
imageQueue = [[NSOperationQueue alloc] init];
|
|
12
|
+
imageQueue.name = @"org.maplibre.reactnative.DownloadImageQueue";
|
|
13
|
+
}
|
|
14
|
+
return self;
|
|
17
15
|
}
|
|
18
16
|
|
|
19
|
-
- (void)dealloc
|
|
20
|
-
|
|
21
|
-
[self cancelAllOperations];
|
|
17
|
+
- (void)dealloc {
|
|
18
|
+
[self cancelAllOperations];
|
|
22
19
|
}
|
|
23
20
|
|
|
24
|
-
+ (instancetype)sharedInstance
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
return sharedInstance;
|
|
21
|
+
+ (instancetype)sharedInstance {
|
|
22
|
+
static MLRNImageQueue *sharedInstance = nil;
|
|
23
|
+
static dispatch_once_t onceToken;
|
|
24
|
+
dispatch_once(&onceToken, ^{
|
|
25
|
+
sharedInstance = [[MLRNImageQueue alloc] init];
|
|
26
|
+
});
|
|
27
|
+
return sharedInstance;
|
|
32
28
|
}
|
|
33
29
|
|
|
34
|
-
- (void)cancelAllOperations
|
|
35
|
-
|
|
36
|
-
[imageQueue cancelAllOperations];
|
|
30
|
+
- (void)cancelAllOperations {
|
|
31
|
+
[imageQueue cancelAllOperations];
|
|
37
32
|
}
|
|
38
33
|
|
|
39
|
-
- (void)addImage:(NSString *)imageURL
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
34
|
+
- (void)addImage:(NSString *)imageURL
|
|
35
|
+
scale:(double)scale
|
|
36
|
+
bridge:(RCTBridge *)bridge
|
|
37
|
+
completionHandler:(RCTImageLoaderCompletionBlock)handler {
|
|
38
|
+
MLRNImageQueueOperation *operation = [[MLRNImageQueueOperation alloc] init];
|
|
39
|
+
operation.bridge = bridge;
|
|
40
|
+
operation.urlRequest = [RCTConvert NSURLRequest:imageURL];
|
|
41
|
+
operation.completionHandler = handler;
|
|
42
|
+
operation.scale = scale;
|
|
43
|
+
[imageQueue addOperation:operation];
|
|
47
44
|
}
|
|
48
45
|
|
|
49
46
|
@end
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
@property (nonatomic, weak) RCTBridge *bridge;
|
|
6
6
|
@property (nonatomic, copy) RCTImageLoaderCompletionBlock completionHandler;
|
|
7
7
|
@property (nonatomic, copy) NSURLRequest *urlRequest;
|
|
8
|
-
@property (nonatomic)
|
|
8
|
+
@property (nonatomic) double scale;
|
|
9
9
|
|
|
10
10
|
@end
|