@mapsindoors/react-native-maps-indoors-mapbox 2.6.2-rc.1 → 2.7.0
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/README.md +10 -1
- package/android/build.gradle +17 -70
- package/android/src/main/java/com/mapsindoorsrn/MapsIndoorsPackage.java +69 -18
- package/android/src/main/java/com/mapsindoorsrn/core/DirectionsRendererModule.java +5 -1
- package/android/src/main/java/com/mapsindoorsrn/core/DirectionsServiceModule.java +5 -2
- package/android/src/main/java/com/mapsindoorsrn/core/MPDisplayRuleModule.java +5 -1
- package/android/src/main/java/com/mapsindoorsrn/core/MapControlModule.java +5 -1
- package/android/src/main/java/com/mapsindoorsrn/core/MapsIndoorsModule.java +4 -1
- package/android/src/main/java/com/mapsindoorsrn/core/UtilsModule.java +4 -1
- package/ios/core/DirectionsRendererBridge.m +5 -0
- package/ios/core/DirectionsRendererModule.swift +92 -72
- package/ios/core/DirectionsServiceBridge.m +1 -1
- package/ios/core/DirectionsServiceModule.swift +44 -51
- package/ios/core/IconStopUrl.swift +1 -1
- package/ios/core/MPDisplayRuleModule.swift +208 -210
- package/ios/core/MapControlModule.swift +284 -216
- package/ios/core/MapsIndoorsData.swift +48 -49
- package/ios/core/MapsIndoorsModule.swift +46 -52
- package/ios/core/RCMapView.swift +1 -1
- package/ios/core/ReactPositionProvider.swift +1 -2
- package/ios/core/RouteIcon.swift +6 -6
- package/ios/core/UtilsModule.swift +37 -42
- package/ios/core/helpers.swift +16 -11
- package/package.json +10 -1
- package/react-native-maps-indoors-mapbox.podspec +3 -3
- package/specs/MapsIndoorsViewNativeComponent.ts +10 -0
- package/specs/NativeDirectionsRendererModule.ts +23 -0
- package/specs/NativeDirectionsServiceModule.ts +22 -0
- package/specs/NativeMPDisplayRuleModule.ts +155 -0
- package/specs/NativeMapControlModule.ts +62 -0
- package/specs/NativeMapsIndoorsModule.ts +43 -0
- package/specs/NativeUtilsModule.ts +21 -0
- package/src/core/MPDirectionsRenderer.ts +15 -0
- package/src/core/MPDirectionsService.ts +1 -1
|
@@ -1,30 +1,31 @@
|
|
|
1
1
|
import Foundation
|
|
2
|
-
|
|
3
2
|
import MapsIndoors
|
|
4
3
|
import MapsIndoorsCore
|
|
5
4
|
|
|
6
5
|
public struct IconSizeStruct: Codable {
|
|
7
6
|
public var width: Int
|
|
8
7
|
public var height: Int
|
|
9
|
-
}
|
|
8
|
+
}
|
|
9
|
+
extension IconSizeStruct { // Don't want to lose default initializer, so this must be in an extension
|
|
10
10
|
public init(withCGSize: CGSize) {
|
|
11
11
|
height = Int(withCGSize.height)
|
|
12
12
|
width = Int(withCGSize.width)
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
private func doReject(
|
|
17
|
-
|
|
16
|
+
private func doReject(
|
|
17
|
+
_ reject: RCTPromiseRejectBlock, displayRuleId: String,
|
|
18
|
+
_file: String = #fileID, _func: String = #function, _line: Int = #line, _col: Int = #column
|
|
19
|
+
) {
|
|
18
20
|
return doReject(reject, message: "The DisplayRule (id: \"\(displayRuleId)\") cannot be found", _file: _file, _func: _func, _line: _line, _col: _col)
|
|
19
21
|
}
|
|
20
22
|
|
|
21
23
|
@objc(DisplayRule)
|
|
22
24
|
public class MPDisplayRuleModule: NSObject {
|
|
25
|
+
@objc public static func requiresMainQueueSetup() -> Bool { return false }
|
|
23
26
|
|
|
24
|
-
@objc public static func requiresMainQueueSetup() -> Bool {return false}
|
|
25
|
-
|
|
26
27
|
private func getIconPlacement(iconPlacement: NSNumber) -> MPIconPlacement {
|
|
27
|
-
switch
|
|
28
|
+
switch iconPlacement.intValue {
|
|
28
29
|
case 1:
|
|
29
30
|
return .above
|
|
30
31
|
case 2:
|
|
@@ -37,9 +38,9 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
37
38
|
return .center
|
|
38
39
|
}
|
|
39
40
|
}
|
|
40
|
-
|
|
41
|
+
|
|
41
42
|
private func getIconPlacementIntValue(iconPlacement: MPIconPlacement) -> Int {
|
|
42
|
-
switch
|
|
43
|
+
switch iconPlacement {
|
|
43
44
|
case .above:
|
|
44
45
|
return 1
|
|
45
46
|
case .below:
|
|
@@ -53,9 +54,8 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
53
54
|
}
|
|
54
55
|
}
|
|
55
56
|
|
|
56
|
-
|
|
57
57
|
private func getLabelPosition(labelPosition: NSNumber) -> MPLabelPosition {
|
|
58
|
-
switch
|
|
58
|
+
switch labelPosition.intValue {
|
|
59
59
|
case 0:
|
|
60
60
|
return .left
|
|
61
61
|
case 1:
|
|
@@ -68,9 +68,9 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
68
68
|
return .bottom
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
-
|
|
71
|
+
|
|
72
72
|
private func getLabelPositionIntValue(labelPosition: MPLabelPosition) -> Int {
|
|
73
|
-
switch
|
|
73
|
+
switch labelPosition {
|
|
74
74
|
case .left:
|
|
75
75
|
return 0
|
|
76
76
|
case .bottom:
|
|
@@ -83,9 +83,9 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
83
83
|
return 2
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
|
-
|
|
86
|
+
|
|
87
87
|
private func getLabelType(labelType: NSNumber) -> MPLabelType {
|
|
88
|
-
switch
|
|
88
|
+
switch labelType.intValue {
|
|
89
89
|
case 0:
|
|
90
90
|
return .flat
|
|
91
91
|
case 1:
|
|
@@ -96,9 +96,9 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
96
96
|
return .floating
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
|
-
|
|
99
|
+
|
|
100
100
|
private func getLabelTypeIntValue(labelType: MPLabelType) -> Int {
|
|
101
|
-
switch
|
|
101
|
+
switch labelType {
|
|
102
102
|
case .flat:
|
|
103
103
|
return 0
|
|
104
104
|
case .floating:
|
|
@@ -109,9 +109,9 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
109
109
|
return 1
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
|
-
|
|
112
|
+
|
|
113
113
|
private func getBadgePosition(badgePosition: NSNumber) -> MPBadgePosition {
|
|
114
|
-
switch
|
|
114
|
+
switch badgePosition.intValue {
|
|
115
115
|
case 1:
|
|
116
116
|
return .bottomRight
|
|
117
117
|
case 2:
|
|
@@ -122,9 +122,9 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
122
122
|
return .bottomLeft
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
|
-
|
|
125
|
+
|
|
126
126
|
private func getBadgePositionIntValue(badgePosition: MPBadgePosition) -> Int {
|
|
127
|
-
switch
|
|
127
|
+
switch badgePosition {
|
|
128
128
|
case .bottomRight:
|
|
129
129
|
return 1
|
|
130
130
|
case .topLeft:
|
|
@@ -135,11 +135,11 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
135
135
|
return 0
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
|
-
|
|
138
|
+
|
|
139
139
|
private func getTypeRule(typeName: String) -> MPDisplayRuleType? {
|
|
140
|
-
|
|
141
|
-
switch
|
|
142
|
-
case "buildingOutline":
|
|
140
|
+
// TODO: very similar to FLutter code, maybe combine shared functions somewhere
|
|
141
|
+
switch typeName {
|
|
142
|
+
case "buildingOutline": // TODO: OutLine?
|
|
143
143
|
return .buildingOutline
|
|
144
144
|
case "selectionHighlight":
|
|
145
145
|
return .selectionHighlight
|
|
@@ -161,10 +161,10 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
161
161
|
private func getRule(name: String) -> MPDisplayRule? {
|
|
162
162
|
if let typeRule = getTypeRule(typeName: name) {
|
|
163
163
|
return MPMapsIndoors.shared.displayRuleFor(displayRuleType: typeRule)
|
|
164
|
-
} else if let namedRule = MPMapsIndoors.shared.displayRuleFor(type: name.lowercased()){
|
|
164
|
+
} else if let namedRule = MPMapsIndoors.shared.displayRuleFor(type: name.lowercased()) {
|
|
165
165
|
return namedRule
|
|
166
166
|
} else if let loc = MPMapsIndoors.shared.locationWith(locationId: name) {
|
|
167
|
-
return MPMapsIndoors.shared.displayRuleFor(location: loc)
|
|
167
|
+
return MPMapsIndoors.shared.displayRuleFor(location: loc)
|
|
168
168
|
} else {
|
|
169
169
|
return nil
|
|
170
170
|
}
|
|
@@ -188,7 +188,7 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
188
188
|
let regex = try! NSRegularExpression(pattern: "^#[0-9A-Fa-f]{6}$|^#[0-9A-Fa-f]{8}$")
|
|
189
189
|
let range = NSRange(location: 0, length: hex.utf16.count)
|
|
190
190
|
|
|
191
|
-
if
|
|
191
|
+
if regex.matches(in: hex, range: range).count == 1 {
|
|
192
192
|
return UIColor(hex: hex)!
|
|
193
193
|
} else {
|
|
194
194
|
throw HexParsingError.invalidHexString(hex)
|
|
@@ -205,7 +205,7 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
205
205
|
return toJSON(iconSize)
|
|
206
206
|
}
|
|
207
207
|
|
|
208
|
-
// End of head
|
|
208
|
+
// End of head
|
|
209
209
|
|
|
210
210
|
// Getter isVisible->visible
|
|
211
211
|
@objc public func isVisible(_ displayRuleId: String, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
|
|
@@ -361,11 +361,11 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
361
361
|
guard let displayRule = getRule(name: displayRuleId) else {
|
|
362
362
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
363
363
|
}
|
|
364
|
-
|
|
365
|
-
if
|
|
364
|
+
|
|
365
|
+
if value != -1 {
|
|
366
366
|
displayRule.zoomFrom = value
|
|
367
367
|
}
|
|
368
|
-
|
|
368
|
+
|
|
369
369
|
return resolve(nil)
|
|
370
370
|
}
|
|
371
371
|
|
|
@@ -384,10 +384,10 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
384
384
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
385
385
|
}
|
|
386
386
|
|
|
387
|
-
if
|
|
387
|
+
if value != -1 {
|
|
388
388
|
displayRule.zoomTo = value
|
|
389
389
|
}
|
|
390
|
-
|
|
390
|
+
|
|
391
391
|
return resolve(nil)
|
|
392
392
|
}
|
|
393
393
|
|
|
@@ -470,7 +470,7 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
470
470
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
471
471
|
}
|
|
472
472
|
|
|
473
|
-
if
|
|
473
|
+
if value != -1 {
|
|
474
474
|
displayRule.labelZoomFrom = value
|
|
475
475
|
}
|
|
476
476
|
|
|
@@ -492,7 +492,7 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
492
492
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
493
493
|
}
|
|
494
494
|
|
|
495
|
-
if
|
|
495
|
+
if value != -1 {
|
|
496
496
|
displayRule.labelZoomTo = value
|
|
497
497
|
}
|
|
498
498
|
|
|
@@ -508,7 +508,7 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
508
508
|
let maxWidth = displayRule.labelMaxWidth
|
|
509
509
|
if maxWidth == UInt.max {
|
|
510
510
|
return resolve(-1)
|
|
511
|
-
}else {
|
|
511
|
+
} else {
|
|
512
512
|
return resolve(displayRule.labelMaxWidth)
|
|
513
513
|
}
|
|
514
514
|
}
|
|
@@ -519,7 +519,7 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
519
519
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
520
520
|
}
|
|
521
521
|
|
|
522
|
-
if
|
|
522
|
+
if value != -1 {
|
|
523
523
|
displayRule.labelMaxWidth = UInt(value)
|
|
524
524
|
}
|
|
525
525
|
|
|
@@ -541,7 +541,7 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
541
541
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
542
542
|
}
|
|
543
543
|
|
|
544
|
-
if
|
|
544
|
+
if value != -1 {
|
|
545
545
|
displayRule.polygonZoomFrom = value
|
|
546
546
|
}
|
|
547
547
|
|
|
@@ -563,10 +563,10 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
563
563
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
564
564
|
}
|
|
565
565
|
|
|
566
|
-
if
|
|
566
|
+
if value != -1 {
|
|
567
567
|
displayRule.polygonZoomTo = value
|
|
568
568
|
}
|
|
569
|
-
|
|
569
|
+
|
|
570
570
|
return resolve(nil)
|
|
571
571
|
}
|
|
572
572
|
|
|
@@ -584,8 +584,8 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
584
584
|
guard let displayRule = getRule(name: displayRuleId) else {
|
|
585
585
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
586
586
|
}
|
|
587
|
-
|
|
588
|
-
if
|
|
587
|
+
|
|
588
|
+
if value != -1 {
|
|
589
589
|
displayRule.polygonStrokeWidth = value
|
|
590
590
|
}
|
|
591
591
|
|
|
@@ -597,7 +597,7 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
597
597
|
guard let displayRule = getRule(name: displayRuleId) else {
|
|
598
598
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
599
599
|
}
|
|
600
|
-
|
|
600
|
+
|
|
601
601
|
guard let color = displayRule.polygonStrokeColor else {
|
|
602
602
|
return resolve(nil)
|
|
603
603
|
}
|
|
@@ -635,9 +635,9 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
635
635
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
636
636
|
}
|
|
637
637
|
|
|
638
|
-
if
|
|
638
|
+
if value != -1 {
|
|
639
639
|
displayRule.polygonStrokeOpacity = value
|
|
640
|
-
}else {
|
|
640
|
+
} else {
|
|
641
641
|
displayRule.polygonStrokeOpacity = nil
|
|
642
642
|
}
|
|
643
643
|
|
|
@@ -649,7 +649,7 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
649
649
|
guard let displayRule = getRule(name: displayRuleId) else {
|
|
650
650
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
651
651
|
}
|
|
652
|
-
|
|
652
|
+
|
|
653
653
|
guard let color = displayRule.polygonFillColor else {
|
|
654
654
|
return resolve(nil)
|
|
655
655
|
}
|
|
@@ -687,9 +687,9 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
687
687
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
688
688
|
}
|
|
689
689
|
|
|
690
|
-
if
|
|
690
|
+
if value != -1 {
|
|
691
691
|
displayRule.polygonFillOpacity = value
|
|
692
|
-
}else {
|
|
692
|
+
} else {
|
|
693
693
|
displayRule.polygonFillOpacity = nil
|
|
694
694
|
}
|
|
695
695
|
|
|
@@ -701,7 +701,7 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
701
701
|
guard let displayRule = getRule(name: displayRuleId) else {
|
|
702
702
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
703
703
|
}
|
|
704
|
-
|
|
704
|
+
|
|
705
705
|
guard let color = displayRule.wallsColor else {
|
|
706
706
|
return resolve(nil)
|
|
707
707
|
}
|
|
@@ -739,7 +739,7 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
739
739
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
740
740
|
}
|
|
741
741
|
|
|
742
|
-
if
|
|
742
|
+
if value != -1 {
|
|
743
743
|
displayRule.wallsHeight = value
|
|
744
744
|
}
|
|
745
745
|
|
|
@@ -761,7 +761,7 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
761
761
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
762
762
|
}
|
|
763
763
|
|
|
764
|
-
if
|
|
764
|
+
if value != -1 {
|
|
765
765
|
displayRule.wallsZoomFrom = value
|
|
766
766
|
}
|
|
767
767
|
|
|
@@ -783,7 +783,7 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
783
783
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
784
784
|
}
|
|
785
785
|
|
|
786
|
-
if
|
|
786
|
+
if value != -1 {
|
|
787
787
|
displayRule.wallsZoomTo = value
|
|
788
788
|
}
|
|
789
789
|
|
|
@@ -795,7 +795,7 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
795
795
|
guard let displayRule = getRule(name: displayRuleId) else {
|
|
796
796
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
797
797
|
}
|
|
798
|
-
|
|
798
|
+
|
|
799
799
|
guard let color = displayRule.extrusionColor else {
|
|
800
800
|
return resolve(nil)
|
|
801
801
|
}
|
|
@@ -833,7 +833,7 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
833
833
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
834
834
|
}
|
|
835
835
|
|
|
836
|
-
if
|
|
836
|
+
if value != -1 {
|
|
837
837
|
displayRule.extrusionHeight = value
|
|
838
838
|
}
|
|
839
839
|
|
|
@@ -855,7 +855,7 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
855
855
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
856
856
|
}
|
|
857
857
|
|
|
858
|
-
if
|
|
858
|
+
if value != -1 {
|
|
859
859
|
displayRule.extrusionZoomFrom = value
|
|
860
860
|
}
|
|
861
861
|
|
|
@@ -877,7 +877,7 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
877
877
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
878
878
|
}
|
|
879
879
|
|
|
880
|
-
if
|
|
880
|
+
if value != -1 {
|
|
881
881
|
displayRule.extrusionZoomTo = value
|
|
882
882
|
}
|
|
883
883
|
|
|
@@ -899,7 +899,7 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
899
899
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
900
900
|
}
|
|
901
901
|
|
|
902
|
-
if
|
|
902
|
+
if value != -1 {
|
|
903
903
|
displayRule.model2DZoomFrom = value
|
|
904
904
|
}
|
|
905
905
|
|
|
@@ -921,7 +921,7 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
921
921
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
922
922
|
}
|
|
923
923
|
|
|
924
|
-
if
|
|
924
|
+
if value != -1 {
|
|
925
925
|
displayRule.model2DZoomTo = value
|
|
926
926
|
}
|
|
927
927
|
|
|
@@ -943,7 +943,7 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
943
943
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
944
944
|
}
|
|
945
945
|
|
|
946
|
-
if
|
|
946
|
+
if value != -1 {
|
|
947
947
|
displayRule.model2DWidthMeters = value
|
|
948
948
|
}
|
|
949
949
|
|
|
@@ -965,7 +965,7 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
965
965
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
966
966
|
}
|
|
967
967
|
|
|
968
|
-
if
|
|
968
|
+
if value != -1 {
|
|
969
969
|
displayRule.model2DHeightMeters = value
|
|
970
970
|
}
|
|
971
971
|
|
|
@@ -987,7 +987,7 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
987
987
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
988
988
|
}
|
|
989
989
|
|
|
990
|
-
if
|
|
990
|
+
if value != -1 {
|
|
991
991
|
displayRule.model2DBearing = value
|
|
992
992
|
}
|
|
993
993
|
|
|
@@ -1013,19 +1013,19 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
1013
1013
|
|
|
1014
1014
|
return resolve(nil)
|
|
1015
1015
|
}
|
|
1016
|
-
|
|
1016
|
+
|
|
1017
1017
|
@objc public func getBadgeFillColor(_ displayRuleId: String, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
|
|
1018
1018
|
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1019
1019
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
1020
1020
|
}
|
|
1021
|
-
|
|
1021
|
+
|
|
1022
1022
|
guard let color = displayRule.badgeFillColor else {
|
|
1023
1023
|
return resolve(nil)
|
|
1024
1024
|
}
|
|
1025
1025
|
|
|
1026
1026
|
return resolve(hexStringFromColor(color: color))
|
|
1027
1027
|
}
|
|
1028
|
-
|
|
1028
|
+
|
|
1029
1029
|
@objc public func setBadgeFillColor(_ displayRuleId: String, value: String, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
|
|
1030
1030
|
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1031
1031
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
@@ -1035,23 +1035,22 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
1035
1035
|
} catch let e {
|
|
1036
1036
|
return doReject(reject, error: e)
|
|
1037
1037
|
}
|
|
1038
|
-
|
|
1039
|
-
|
|
1038
|
+
|
|
1040
1039
|
return resolve(nil)
|
|
1041
1040
|
}
|
|
1042
|
-
|
|
1041
|
+
|
|
1043
1042
|
@objc public func getBadgeStrokeColor(_ displayRuleId: String, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
|
|
1044
1043
|
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1045
1044
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
1046
1045
|
}
|
|
1047
|
-
|
|
1046
|
+
|
|
1048
1047
|
guard let color = displayRule.badgeStrokeColor else {
|
|
1049
1048
|
return resolve(nil)
|
|
1050
1049
|
}
|
|
1051
1050
|
|
|
1052
1051
|
return resolve(hexStringFromColor(color: color))
|
|
1053
1052
|
}
|
|
1054
|
-
|
|
1053
|
+
|
|
1055
1054
|
@objc public func setBadgeStrokeColor(_ displayRuleId: String, value: String, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
|
|
1056
1055
|
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1057
1056
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
@@ -1059,13 +1058,13 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
1059
1058
|
|
|
1060
1059
|
do {
|
|
1061
1060
|
displayRule.badgeStrokeColor = try colorFromHexString(hex: value)
|
|
1062
|
-
}catch let e {
|
|
1063
|
-
|
|
1061
|
+
} catch let e {
|
|
1062
|
+
return doReject(reject, error: e)
|
|
1064
1063
|
}
|
|
1065
|
-
|
|
1064
|
+
|
|
1066
1065
|
return resolve(nil)
|
|
1067
1066
|
}
|
|
1068
|
-
|
|
1067
|
+
|
|
1069
1068
|
@objc public func getBadgeRadius(_ displayRuleId: String, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
|
|
1070
1069
|
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1071
1070
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
@@ -1073,19 +1072,19 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
1073
1072
|
|
|
1074
1073
|
return resolve(displayRule.badgeRadius)
|
|
1075
1074
|
}
|
|
1076
|
-
|
|
1075
|
+
|
|
1077
1076
|
@objc public func setBadgeRadius(_ displayRuleId: String, value: NSNumber, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
|
|
1078
1077
|
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1079
1078
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
1080
1079
|
}
|
|
1081
1080
|
|
|
1082
|
-
if
|
|
1081
|
+
if value != -1 {
|
|
1083
1082
|
displayRule.badgeRadius = value.intValue
|
|
1084
1083
|
}
|
|
1085
|
-
|
|
1084
|
+
|
|
1086
1085
|
return resolve(nil)
|
|
1087
1086
|
}
|
|
1088
|
-
|
|
1087
|
+
|
|
1089
1088
|
@objc public func getBadgeStrokeWidth(_ displayRuleId: String, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
|
|
1090
1089
|
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1091
1090
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
@@ -1093,19 +1092,19 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
1093
1092
|
|
|
1094
1093
|
return resolve(displayRule.badgeStrokeWidth)
|
|
1095
1094
|
}
|
|
1096
|
-
|
|
1095
|
+
|
|
1097
1096
|
@objc public func setBadgeStrokeWidth(_ displayRuleId: String, value: NSNumber, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
|
|
1098
1097
|
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1099
1098
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
1100
1099
|
}
|
|
1101
1100
|
|
|
1102
|
-
if
|
|
1101
|
+
if value != -1 {
|
|
1103
1102
|
displayRule.badgeStrokeWidth = value.doubleValue
|
|
1104
1103
|
}
|
|
1105
|
-
|
|
1104
|
+
|
|
1106
1105
|
return resolve(nil)
|
|
1107
1106
|
}
|
|
1108
|
-
|
|
1107
|
+
|
|
1109
1108
|
@objc public func getBadgePosition(_ displayRuleId: String, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
|
|
1110
1109
|
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1111
1110
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
@@ -1113,21 +1112,21 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
1113
1112
|
|
|
1114
1113
|
return resolve(getBadgePositionIntValue(badgePosition: displayRule.badgePosition ?? MPBadgePosition.bottomLeft))
|
|
1115
1114
|
}
|
|
1116
|
-
|
|
1115
|
+
|
|
1117
1116
|
@objc public func setBadgePosition(_ displayRuleId: String, value: NSNumber, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
|
|
1118
1117
|
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1119
1118
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
1120
1119
|
}
|
|
1121
1120
|
|
|
1122
|
-
if
|
|
1121
|
+
if value != -1 {
|
|
1123
1122
|
displayRule.badgePosition = getBadgePosition(badgePosition: value)
|
|
1124
|
-
}else {
|
|
1123
|
+
} else {
|
|
1125
1124
|
displayRule.badgePosition = nil
|
|
1126
1125
|
}
|
|
1127
|
-
|
|
1126
|
+
|
|
1128
1127
|
return resolve(nil)
|
|
1129
1128
|
}
|
|
1130
|
-
|
|
1129
|
+
|
|
1131
1130
|
@objc public func getIconPlacement(_ displayRuleId: String, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
|
|
1132
1131
|
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1133
1132
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
@@ -1135,21 +1134,21 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
1135
1134
|
|
|
1136
1135
|
return resolve(getIconPlacementIntValue(iconPlacement: displayRule.iconPlacement ?? MPIconPlacement.center))
|
|
1137
1136
|
}
|
|
1138
|
-
|
|
1137
|
+
|
|
1139
1138
|
@objc public func setIconPlacement(_ displayRuleId: String, value: NSNumber, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
|
|
1140
1139
|
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1141
1140
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
1142
1141
|
}
|
|
1143
|
-
|
|
1144
|
-
if
|
|
1142
|
+
|
|
1143
|
+
if value != -1 {
|
|
1145
1144
|
displayRule.iconPlacement = getIconPlacement(iconPlacement: value)
|
|
1146
|
-
}else {
|
|
1145
|
+
} else {
|
|
1147
1146
|
displayRule.iconPlacement = nil
|
|
1148
1147
|
}
|
|
1149
|
-
|
|
1148
|
+
|
|
1150
1149
|
return resolve(nil)
|
|
1151
1150
|
}
|
|
1152
|
-
|
|
1151
|
+
|
|
1153
1152
|
@objc public func getLabelType(_ displayRuleId: String, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
|
|
1154
1153
|
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1155
1154
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
@@ -1157,21 +1156,21 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
1157
1156
|
|
|
1158
1157
|
return resolve(getLabelTypeIntValue(labelType: displayRule.labelType ?? MPLabelType.floating))
|
|
1159
1158
|
}
|
|
1160
|
-
|
|
1159
|
+
|
|
1161
1160
|
@objc public func setLabelType(_ displayRuleId: String, value: NSNumber, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
|
|
1162
1161
|
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1163
1162
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
1164
1163
|
}
|
|
1165
|
-
|
|
1166
|
-
if
|
|
1164
|
+
|
|
1165
|
+
if value != -1 {
|
|
1167
1166
|
displayRule.labelType = getLabelType(labelType: value)
|
|
1168
|
-
}else {
|
|
1167
|
+
} else {
|
|
1169
1168
|
displayRule.labelType = nil
|
|
1170
1169
|
}
|
|
1171
|
-
|
|
1170
|
+
|
|
1172
1171
|
return resolve(nil)
|
|
1173
1172
|
}
|
|
1174
|
-
|
|
1173
|
+
|
|
1175
1174
|
@objc public func getLabelStyleTextSize(_ displayRuleId: String, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
|
|
1176
1175
|
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1177
1176
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
@@ -1179,31 +1178,31 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
1179
1178
|
|
|
1180
1179
|
return resolve(displayRule.labelStyleTextSize)
|
|
1181
1180
|
}
|
|
1182
|
-
|
|
1181
|
+
|
|
1183
1182
|
@objc public func setLabelStyleTextSize(_ displayRuleId: String, value: NSNumber, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
|
|
1184
1183
|
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1185
1184
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
1186
1185
|
}
|
|
1187
1186
|
|
|
1188
|
-
if
|
|
1187
|
+
if value != -1 {
|
|
1189
1188
|
displayRule.labelStyleTextSize = value.intValue
|
|
1190
1189
|
}
|
|
1191
|
-
|
|
1190
|
+
|
|
1192
1191
|
return resolve(nil)
|
|
1193
1192
|
}
|
|
1194
|
-
|
|
1193
|
+
|
|
1195
1194
|
@objc public func getLabelStyleTextColor(_ displayRuleId: String, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
|
|
1196
1195
|
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1197
1196
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
1198
1197
|
}
|
|
1199
|
-
|
|
1198
|
+
|
|
1200
1199
|
guard let color = displayRule.labelStyleTextColor else {
|
|
1201
1200
|
return resolve(nil)
|
|
1202
1201
|
}
|
|
1203
1202
|
|
|
1204
1203
|
return resolve(hexStringFromColor(color: color))
|
|
1205
1204
|
}
|
|
1206
|
-
|
|
1205
|
+
|
|
1207
1206
|
@objc public func setLabelStyleTextColor(_ displayRuleId: String, value: String, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
|
|
1208
1207
|
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1209
1208
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
@@ -1214,27 +1213,27 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
1214
1213
|
} catch let e {
|
|
1215
1214
|
return doReject(reject, error: e)
|
|
1216
1215
|
}
|
|
1217
|
-
|
|
1216
|
+
|
|
1218
1217
|
return resolve(nil)
|
|
1219
1218
|
}
|
|
1220
|
-
|
|
1219
|
+
|
|
1221
1220
|
@objc public func getLabelStyleHaloColor(_ displayRuleId: String, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
|
|
1222
1221
|
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1223
1222
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
1224
1223
|
}
|
|
1225
|
-
|
|
1224
|
+
|
|
1226
1225
|
guard let color = displayRule.labelStyleHaloColor else {
|
|
1227
1226
|
return resolve(nil)
|
|
1228
1227
|
}
|
|
1229
1228
|
|
|
1230
1229
|
return resolve(hexStringFromColor(color: color))
|
|
1231
1230
|
}
|
|
1232
|
-
|
|
1231
|
+
|
|
1233
1232
|
@objc public func setLabelStyleHaloColor(_ displayRuleId: String, value: String, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
|
|
1234
1233
|
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1235
1234
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
1236
1235
|
}
|
|
1237
|
-
|
|
1236
|
+
|
|
1238
1237
|
do {
|
|
1239
1238
|
displayRule.labelStyleHaloColor = try colorFromHexString(hex: value)
|
|
1240
1239
|
} catch let e {
|
|
@@ -1243,7 +1242,7 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
1243
1242
|
|
|
1244
1243
|
return resolve(nil)
|
|
1245
1244
|
}
|
|
1246
|
-
|
|
1245
|
+
|
|
1247
1246
|
@objc public func getLabelStyleTextOpacity(_ displayRuleId: String, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
|
|
1248
1247
|
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1249
1248
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
@@ -1251,19 +1250,19 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
1251
1250
|
|
|
1252
1251
|
return resolve(displayRule.labelStyleTextOpacity)
|
|
1253
1252
|
}
|
|
1254
|
-
|
|
1253
|
+
|
|
1255
1254
|
@objc public func setLabelStyleTextOpacity(_ displayRuleId: String, value: NSNumber, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
|
|
1256
1255
|
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1257
1256
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
1258
1257
|
}
|
|
1259
|
-
|
|
1260
|
-
if
|
|
1258
|
+
|
|
1259
|
+
if value != -1 {
|
|
1261
1260
|
displayRule.labelStyleTextOpacity = value.doubleValue
|
|
1262
1261
|
}
|
|
1263
|
-
|
|
1262
|
+
|
|
1264
1263
|
return resolve(nil)
|
|
1265
1264
|
}
|
|
1266
|
-
|
|
1265
|
+
|
|
1267
1266
|
@objc public func getLabelStyleHaloWidth(_ displayRuleId: String, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
|
|
1268
1267
|
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1269
1268
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
@@ -1271,19 +1270,19 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
1271
1270
|
|
|
1272
1271
|
return resolve(displayRule.labelStyleHaloWidth)
|
|
1273
1272
|
}
|
|
1274
|
-
|
|
1273
|
+
|
|
1275
1274
|
@objc public func setLabelStyleHaloWidth(_ displayRuleId: String, value: NSNumber, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
|
|
1276
1275
|
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1277
1276
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
1278
1277
|
}
|
|
1279
|
-
|
|
1280
|
-
if
|
|
1278
|
+
|
|
1279
|
+
if value != -1 {
|
|
1281
1280
|
displayRule.labelStyleHaloWidth = value.intValue
|
|
1282
1281
|
}
|
|
1283
|
-
|
|
1282
|
+
|
|
1284
1283
|
return resolve(nil)
|
|
1285
1284
|
}
|
|
1286
|
-
|
|
1285
|
+
|
|
1287
1286
|
@objc public func getLabelStyleHaloBlur(_ displayRuleId: String, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
|
|
1288
1287
|
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1289
1288
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
@@ -1291,19 +1290,19 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
1291
1290
|
|
|
1292
1291
|
return resolve(displayRule.labelStyleHaloBlur)
|
|
1293
1292
|
}
|
|
1294
|
-
|
|
1293
|
+
|
|
1295
1294
|
@objc public func setLabelStyleHaloBlur(_ displayRuleId: String, value: NSNumber, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
|
|
1296
1295
|
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1297
1296
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
1298
1297
|
}
|
|
1299
|
-
|
|
1300
|
-
if
|
|
1298
|
+
|
|
1299
|
+
if value != -1 {
|
|
1301
1300
|
displayRule.labelStyleHaloBlur = value.intValue
|
|
1302
1301
|
}
|
|
1303
|
-
|
|
1302
|
+
|
|
1304
1303
|
return resolve(nil)
|
|
1305
1304
|
}
|
|
1306
|
-
|
|
1305
|
+
|
|
1307
1306
|
@objc public func getLabelStyleBearing(_ displayRuleId: String, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
|
|
1308
1307
|
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1309
1308
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
@@ -1311,16 +1310,16 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
1311
1310
|
|
|
1312
1311
|
return resolve(displayRule.labelStyleBearing)
|
|
1313
1312
|
}
|
|
1314
|
-
|
|
1313
|
+
|
|
1315
1314
|
@objc public func setLabelStyleBearing(_ displayRuleId: String, value: NSNumber, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
|
|
1316
1315
|
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1317
1316
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
1318
1317
|
}
|
|
1319
|
-
|
|
1320
|
-
if
|
|
1318
|
+
|
|
1319
|
+
if value != -1 {
|
|
1321
1320
|
displayRule.labelStyleBearing = value.doubleValue
|
|
1322
1321
|
}
|
|
1323
|
-
|
|
1322
|
+
|
|
1324
1323
|
return resolve(nil)
|
|
1325
1324
|
}
|
|
1326
1325
|
|
|
@@ -1336,11 +1335,11 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
1336
1335
|
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1337
1336
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
1338
1337
|
}
|
|
1339
|
-
|
|
1340
|
-
if
|
|
1338
|
+
|
|
1339
|
+
if value != -1 {
|
|
1341
1340
|
displayRule.labelStylePosition = getLabelPosition(labelPosition: value)
|
|
1342
1341
|
}
|
|
1343
|
-
|
|
1342
|
+
|
|
1344
1343
|
return resolve(nil)
|
|
1345
1344
|
}
|
|
1346
1345
|
|
|
@@ -1348,16 +1347,16 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
1348
1347
|
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1349
1348
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
1350
1349
|
}
|
|
1351
|
-
|
|
1350
|
+
|
|
1352
1351
|
guard let labelGraphic = try? JSONDecoder().decode(LabelGraphic.self, from: value.data(using: .utf8)!) else {
|
|
1353
1352
|
return doReject(reject, message: "Could not parse label graphic")
|
|
1354
1353
|
}
|
|
1355
|
-
|
|
1354
|
+
|
|
1356
1355
|
displayRule.labelStyleGraphicBackgroundImage = labelGraphic.backgroundImage
|
|
1357
1356
|
displayRule.labelStyleGraphicStretchX = labelGraphic.stretchX
|
|
1358
1357
|
displayRule.labelStyleGraphicStretchY = labelGraphic.stretchY
|
|
1359
1358
|
displayRule.labelStyleGraphicContent = labelGraphic.content
|
|
1360
|
-
|
|
1359
|
+
|
|
1361
1360
|
return resolve(nil)
|
|
1362
1361
|
}
|
|
1363
1362
|
|
|
@@ -1365,36 +1364,36 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
1365
1364
|
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1366
1365
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
1367
1366
|
}
|
|
1368
|
-
|
|
1367
|
+
|
|
1369
1368
|
let labelGraphic = LabelGraphic(backgroundImage: displayRule.labelStyleGraphicBackgroundImage, stretchX: displayRule.labelStyleGraphicStretchX, stretchY: displayRule.labelStyleGraphicStretchY, content: displayRule.labelStyleGraphicContent)
|
|
1370
|
-
|
|
1369
|
+
|
|
1371
1370
|
guard let graphicJson = try? JSONEncoder().encode(labelGraphic) else {
|
|
1372
1371
|
return doReject(reject, message: "Could not encode label graphic")
|
|
1373
1372
|
}
|
|
1374
|
-
|
|
1373
|
+
|
|
1375
1374
|
return resolve(String(data: graphicJson, encoding: String.Encoding.utf8))
|
|
1376
1375
|
}
|
|
1377
|
-
|
|
1376
|
+
|
|
1378
1377
|
@objc public func getPolygonLightnessFactor(_ displayRuleId: String, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
|
|
1379
1378
|
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1380
1379
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
1381
1380
|
}
|
|
1382
|
-
|
|
1381
|
+
|
|
1383
1382
|
return resolve(displayRule.polygonLightnessFactor)
|
|
1384
1383
|
}
|
|
1385
|
-
|
|
1384
|
+
|
|
1386
1385
|
@objc public func setPolygonLightnessFactor(_ displayRuleId: String, value: NSNumber, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
|
|
1387
1386
|
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1388
1387
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
1389
1388
|
}
|
|
1390
|
-
|
|
1391
|
-
if
|
|
1389
|
+
|
|
1390
|
+
if value != -2 {
|
|
1392
1391
|
displayRule.polygonLightnessFactor = value.doubleValue
|
|
1393
1392
|
}
|
|
1394
|
-
|
|
1393
|
+
|
|
1395
1394
|
return resolve(nil)
|
|
1396
1395
|
}
|
|
1397
|
-
|
|
1396
|
+
|
|
1398
1397
|
@objc public func getWallLightnessFactor(_ displayRuleId: String, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
|
|
1399
1398
|
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1400
1399
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
@@ -1402,19 +1401,19 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
1402
1401
|
|
|
1403
1402
|
return resolve(displayRule.wallsLightnessFactor)
|
|
1404
1403
|
}
|
|
1405
|
-
|
|
1404
|
+
|
|
1406
1405
|
@objc public func setWallLightnessFactor(_ displayRuleId: String, value: NSNumber, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
|
|
1407
1406
|
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1408
1407
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
1409
1408
|
}
|
|
1410
|
-
|
|
1411
|
-
if
|
|
1409
|
+
|
|
1410
|
+
if value != -2 {
|
|
1412
1411
|
displayRule.wallsLightnessFactor = value.doubleValue
|
|
1413
1412
|
}
|
|
1414
|
-
|
|
1413
|
+
|
|
1415
1414
|
return resolve(nil)
|
|
1416
1415
|
}
|
|
1417
|
-
|
|
1416
|
+
|
|
1418
1417
|
@objc public func getExtrusionLightnessFactor(_ displayRuleId: String, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
|
|
1419
1418
|
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1420
1419
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
@@ -1422,19 +1421,19 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
1422
1421
|
|
|
1423
1422
|
return resolve(displayRule.extrusionLightnessFactor)
|
|
1424
1423
|
}
|
|
1425
|
-
|
|
1424
|
+
|
|
1426
1425
|
@objc public func setExtrusionLightnessFactor(_ displayRuleId: String, value: NSNumber, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
|
|
1427
1426
|
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1428
1427
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
1429
1428
|
}
|
|
1430
|
-
|
|
1431
|
-
if
|
|
1429
|
+
|
|
1430
|
+
if value != -2 {
|
|
1432
1431
|
displayRule.extrusionLightnessFactor = value.doubleValue
|
|
1433
1432
|
}
|
|
1434
|
-
|
|
1433
|
+
|
|
1435
1434
|
return resolve(nil)
|
|
1436
1435
|
}
|
|
1437
|
-
|
|
1436
|
+
|
|
1438
1437
|
@objc public func getIconScale(_ displayRuleId: String, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
|
|
1439
1438
|
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1440
1439
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
@@ -1442,19 +1441,19 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
1442
1441
|
|
|
1443
1442
|
return resolve(displayRule.iconScale)
|
|
1444
1443
|
}
|
|
1445
|
-
|
|
1444
|
+
|
|
1446
1445
|
@objc public func setIconScale(_ displayRuleId: String, value: NSNumber, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
|
|
1447
1446
|
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1448
1447
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
1449
1448
|
}
|
|
1450
|
-
|
|
1451
|
-
if
|
|
1449
|
+
|
|
1450
|
+
if value != -1 {
|
|
1452
1451
|
displayRule.iconScale = value.doubleValue
|
|
1453
1452
|
}
|
|
1454
|
-
|
|
1453
|
+
|
|
1455
1454
|
return resolve(nil)
|
|
1456
1455
|
}
|
|
1457
|
-
|
|
1456
|
+
|
|
1458
1457
|
@objc public func getBadgeScale(_ displayRuleId: String, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
|
|
1459
1458
|
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1460
1459
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
@@ -1462,16 +1461,16 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
1462
1461
|
|
|
1463
1462
|
return resolve(displayRule.badgeScale)
|
|
1464
1463
|
}
|
|
1465
|
-
|
|
1464
|
+
|
|
1466
1465
|
@objc public func setBadgeScale(_ displayRuleId: String, value: NSNumber, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
|
|
1467
1466
|
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1468
1467
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
1469
1468
|
}
|
|
1470
|
-
|
|
1471
|
-
if
|
|
1469
|
+
|
|
1470
|
+
if value != -1 {
|
|
1472
1471
|
displayRule.badgeScale = value.doubleValue
|
|
1473
1472
|
}
|
|
1474
|
-
|
|
1473
|
+
|
|
1475
1474
|
return resolve(nil)
|
|
1476
1475
|
}
|
|
1477
1476
|
|
|
@@ -1482,19 +1481,19 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
1482
1481
|
|
|
1483
1482
|
return resolve(displayRule.badgeZoomFrom)
|
|
1484
1483
|
}
|
|
1485
|
-
|
|
1484
|
+
|
|
1486
1485
|
@objc public func setBadgeZoomFrom(_ displayRuleId: String, value: NSNumber, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
|
|
1487
1486
|
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1488
1487
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
1489
1488
|
}
|
|
1490
|
-
|
|
1491
|
-
if
|
|
1489
|
+
|
|
1490
|
+
if value != -1 {
|
|
1492
1491
|
displayRule.badgeZoomFrom = value.doubleValue
|
|
1493
1492
|
}
|
|
1494
|
-
|
|
1493
|
+
|
|
1495
1494
|
return resolve(nil)
|
|
1496
1495
|
}
|
|
1497
|
-
|
|
1496
|
+
|
|
1498
1497
|
@objc public func getBadgeZoomTo(_ displayRuleId: String, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
|
|
1499
1498
|
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1500
1499
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
@@ -1502,19 +1501,19 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
1502
1501
|
|
|
1503
1502
|
return resolve(displayRule.badgeZoomTo)
|
|
1504
1503
|
}
|
|
1505
|
-
|
|
1504
|
+
|
|
1506
1505
|
@objc public func setBadgeZoomTo(_ displayRuleId: String, value: NSNumber, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
|
|
1507
1506
|
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1508
1507
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
1509
1508
|
}
|
|
1510
|
-
|
|
1511
|
-
if
|
|
1509
|
+
|
|
1510
|
+
if value != -1 {
|
|
1512
1511
|
displayRule.badgeZoomTo = value.doubleValue
|
|
1513
1512
|
}
|
|
1514
|
-
|
|
1513
|
+
|
|
1515
1514
|
return resolve(nil)
|
|
1516
1515
|
}
|
|
1517
|
-
|
|
1516
|
+
|
|
1518
1517
|
@objc public func isBadgeVisible(_ displayRuleId: String, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
|
|
1519
1518
|
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1520
1519
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
@@ -1522,14 +1521,14 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
1522
1521
|
|
|
1523
1522
|
return resolve(displayRule.badgeVisible)
|
|
1524
1523
|
}
|
|
1525
|
-
|
|
1524
|
+
|
|
1526
1525
|
@objc public func setBadgeVisible(_ displayRuleId: String, value: Bool, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
|
|
1527
1526
|
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1528
1527
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
1529
1528
|
}
|
|
1530
|
-
|
|
1529
|
+
|
|
1531
1530
|
displayRule.badgeVisible = value
|
|
1532
|
-
|
|
1531
|
+
|
|
1533
1532
|
return resolve(nil)
|
|
1534
1533
|
}
|
|
1535
1534
|
|
|
@@ -1537,7 +1536,7 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
1537
1536
|
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1538
1537
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
1539
1538
|
}
|
|
1540
|
-
|
|
1539
|
+
|
|
1541
1540
|
return resolve(displayRule.model3DModel)
|
|
1542
1541
|
}
|
|
1543
1542
|
|
|
@@ -1545,9 +1544,9 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
1545
1544
|
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1546
1545
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
1547
1546
|
}
|
|
1548
|
-
|
|
1547
|
+
|
|
1549
1548
|
displayRule.model3DModel = value
|
|
1550
|
-
|
|
1549
|
+
|
|
1551
1550
|
return resolve(nil)
|
|
1552
1551
|
}
|
|
1553
1552
|
|
|
@@ -1555,7 +1554,7 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
1555
1554
|
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1556
1555
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
1557
1556
|
}
|
|
1558
|
-
|
|
1557
|
+
|
|
1559
1558
|
return resolve(displayRule.model3DRotationX)
|
|
1560
1559
|
}
|
|
1561
1560
|
|
|
@@ -1563,11 +1562,11 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
1563
1562
|
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1564
1563
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
1565
1564
|
}
|
|
1566
|
-
|
|
1567
|
-
if
|
|
1565
|
+
|
|
1566
|
+
if value != -1 {
|
|
1568
1567
|
displayRule.model3DRotationX = value.doubleValue
|
|
1569
1568
|
}
|
|
1570
|
-
|
|
1569
|
+
|
|
1571
1570
|
return resolve(nil)
|
|
1572
1571
|
}
|
|
1573
1572
|
|
|
@@ -1575,7 +1574,7 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
1575
1574
|
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1576
1575
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
1577
1576
|
}
|
|
1578
|
-
|
|
1577
|
+
|
|
1579
1578
|
return resolve(displayRule.model3DRotationY)
|
|
1580
1579
|
}
|
|
1581
1580
|
|
|
@@ -1583,11 +1582,11 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
1583
1582
|
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1584
1583
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
1585
1584
|
}
|
|
1586
|
-
|
|
1587
|
-
if
|
|
1585
|
+
|
|
1586
|
+
if value != -1 {
|
|
1588
1587
|
displayRule.model3DRotationY = value.doubleValue
|
|
1589
1588
|
}
|
|
1590
|
-
|
|
1589
|
+
|
|
1591
1590
|
return resolve(nil)
|
|
1592
1591
|
}
|
|
1593
1592
|
|
|
@@ -1595,7 +1594,7 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
1595
1594
|
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1596
1595
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
1597
1596
|
}
|
|
1598
|
-
|
|
1597
|
+
|
|
1599
1598
|
return resolve(displayRule.model3DRotationZ)
|
|
1600
1599
|
}
|
|
1601
1600
|
|
|
@@ -1603,11 +1602,11 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
1603
1602
|
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1604
1603
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
1605
1604
|
}
|
|
1606
|
-
|
|
1607
|
-
if
|
|
1605
|
+
|
|
1606
|
+
if value != -1 {
|
|
1608
1607
|
displayRule.model3DRotationZ = value.doubleValue
|
|
1609
1608
|
}
|
|
1610
|
-
|
|
1609
|
+
|
|
1611
1610
|
return resolve(nil)
|
|
1612
1611
|
}
|
|
1613
1612
|
|
|
@@ -1615,7 +1614,7 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
1615
1614
|
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1616
1615
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
1617
1616
|
}
|
|
1618
|
-
|
|
1617
|
+
|
|
1619
1618
|
return resolve(displayRule.model3DVisible)
|
|
1620
1619
|
}
|
|
1621
1620
|
|
|
@@ -1623,9 +1622,9 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
1623
1622
|
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1624
1623
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
1625
1624
|
}
|
|
1626
|
-
|
|
1625
|
+
|
|
1627
1626
|
displayRule.model3DVisible = value
|
|
1628
|
-
|
|
1627
|
+
|
|
1629
1628
|
return resolve(nil)
|
|
1630
1629
|
}
|
|
1631
1630
|
|
|
@@ -1633,7 +1632,7 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
1633
1632
|
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1634
1633
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
1635
1634
|
}
|
|
1636
|
-
|
|
1635
|
+
|
|
1637
1636
|
return resolve(displayRule.model3DZoomFrom)
|
|
1638
1637
|
}
|
|
1639
1638
|
|
|
@@ -1641,11 +1640,11 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
1641
1640
|
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1642
1641
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
1643
1642
|
}
|
|
1644
|
-
|
|
1645
|
-
if
|
|
1643
|
+
|
|
1644
|
+
if value != -1 {
|
|
1646
1645
|
displayRule.model3DZoomFrom = value.doubleValue
|
|
1647
1646
|
}
|
|
1648
|
-
|
|
1647
|
+
|
|
1649
1648
|
return resolve(nil)
|
|
1650
1649
|
}
|
|
1651
1650
|
|
|
@@ -1653,7 +1652,7 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
1653
1652
|
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1654
1653
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
1655
1654
|
}
|
|
1656
|
-
|
|
1655
|
+
|
|
1657
1656
|
return resolve(displayRule.model3DZoomTo)
|
|
1658
1657
|
}
|
|
1659
1658
|
|
|
@@ -1661,11 +1660,11 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
1661
1660
|
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1662
1661
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
1663
1662
|
}
|
|
1664
|
-
|
|
1665
|
-
if
|
|
1663
|
+
|
|
1664
|
+
if value != -1 {
|
|
1666
1665
|
displayRule.model3DZoomTo = value.doubleValue
|
|
1667
1666
|
}
|
|
1668
|
-
|
|
1667
|
+
|
|
1669
1668
|
return resolve(nil)
|
|
1670
1669
|
}
|
|
1671
1670
|
|
|
@@ -1673,7 +1672,7 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
1673
1672
|
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1674
1673
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
1675
1674
|
}
|
|
1676
|
-
|
|
1675
|
+
|
|
1677
1676
|
return resolve(displayRule.model3DScale)
|
|
1678
1677
|
}
|
|
1679
1678
|
|
|
@@ -1682,16 +1681,16 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
1682
1681
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
1683
1682
|
}
|
|
1684
1683
|
|
|
1685
|
-
if
|
|
1684
|
+
if value != -1 {
|
|
1686
1685
|
displayRule.model3DScale = value.doubleValue
|
|
1687
1686
|
}
|
|
1688
|
-
|
|
1687
|
+
|
|
1689
1688
|
return resolve(nil)
|
|
1690
1689
|
}
|
|
1691
1690
|
|
|
1692
|
-
// Start of tail
|
|
1691
|
+
// Start of tail
|
|
1693
1692
|
|
|
1694
|
-
@objc public func reset(_ displayRuleId: String,resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
|
|
1693
|
+
@objc public func reset(_ displayRuleId: String, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
|
|
1695
1694
|
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1696
1695
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
1697
1696
|
}
|
|
@@ -1700,5 +1699,4 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
1700
1699
|
|
|
1701
1700
|
return resolve(nil)
|
|
1702
1701
|
}
|
|
1703
|
-
|
|
1704
1702
|
}
|