Skip to content

Commit 7753b5e

Browse files
authored
Merge pull request #273 from mapbox/rl/fix_layer_typecasting
Fix typecasting errors when decoding layer properties
2 parents 2e84334 + b82760b commit 7753b5e

File tree

12 files changed

+75
-27
lines changed

12 files changed

+75
-27
lines changed

.circleci/config.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,15 @@ jobs:
9696
- inject-netrc-credentials
9797
- add-mapbox-submodules-key
9898
- macos/install-rosetta
99+
- run:
100+
name: Use activesupport 7.0.8 so that Cocoapods works
101+
command: |
102+
# activesupport was pinned because of Cocoapods being incompatible with active support 7.0.10,
103+
# more details here - https://github.com/CocoaPods/CocoaPods/issues/12081
104+
# allegedly, this issue is resolved in https://github.com/CocoaPods/CocoaPods/pull/12082,
105+
# pinning can be removed after the above fix is released
106+
gem uninstall activesupport --version '>= 7.0.8' --ignore-dependencies
107+
gem install activesupport --version '7.0.8'
99108
- flutter/install_sdk_and_pub:
100109
version: 3.13.6
101110
app-dir: example

example/integration_test/location_test.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ void main() {
6565
expect(updatedSettings.puckBearingSource, settings.puckBearingSource);
6666
expect(updatedSettings.showAccuracyRing, settings.showAccuracyRing);
6767
// FIXME bitmaps are decoded incorrectly for some reason
68-
expect(updatedSettings.accuracyRingBorderColor, settings.accuracyRingBorderColor);
68+
expect(updatedSettings.accuracyRingBorderColor,
69+
settings.accuracyRingBorderColor);
6970
expect(updatedSettings.accuracyRingColor, settings.accuracyRingColor);
7071
// expect(updatedSettings.locationPuck?.locationPuck2D?.bearingImage,
7172
// settings.locationPuck?.locationPuck2D?.bearingImage);

example/ios/Podfile.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ PODS:
22
- Flutter (1.0.0)
33
- integration_test (0.0.1):
44
- Flutter
5-
- mapbox_maps_flutter (0.4.4):
5+
- mapbox_maps_flutter (0.4.5):
66
- Flutter
77
- MapboxMaps (~> 10.13.1)
88
- MapboxCommon (23.5.0)
@@ -45,7 +45,7 @@ EXTERNAL SOURCES:
4545
SPEC CHECKSUMS:
4646
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
4747
integration_test: 13825b8a9334a850581300559b8839134b124670
48-
mapbox_maps_flutter: b7750303639682268cc7f487bfc6f474a456acab
48+
mapbox_maps_flutter: d86eb8d532ae2f7e5d389fff3aa197b743d3c747
4949
MapboxCommon: fdf7fd31c90b7b607cd9c63e37797f023c01d860
5050
MapboxCoreMaps: 24270c7c6b8cb71819fc2f3c549db9620ee4d019
5151
MapboxMaps: cb76511b98d3b95c74b0771ed105bc69f30ace6b
@@ -55,4 +55,4 @@ SPEC CHECKSUMS:
5555

5656
PODFILE CHECKSUM: 04c8a50f0eb98e8e64bc4237a0712e89ba6c14b8
5757

58-
COCOAPODS: 1.12.1
58+
COCOAPODS: 1.13.0

example/pubspec.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ packages:
144144
path: ".."
145145
relative: true
146146
source: path
147-
version: "0.4.4"
147+
version: "0.4.5"
148148
matcher:
149149
dependency: transitive
150150
description:
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
import 'package:integration_test/integration_test_driver.dart';
22

3-
Future<void> main() => integrationDriver();
3+
Future<void> main() => integrationDriver();

ios/Classes/StyleController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ class StyleController: NSObject, FLTStyleManager {
129129
do {
130130
var mappedValue = value
131131
if let stringValue = value as? String {
132-
if (stringValue.hasPrefix("[") || stringValue.hasPrefix("{")) {
132+
if stringValue.hasPrefix("[") || stringValue.hasPrefix("{") {
133133
if let expressionData = stringValue.data(using: .utf8) {
134134
let expJSONObject = try JSONSerialization.jsonObject(with: expressionData, options: [])
135135
mappedValue = expJSONObject

lib/src/style/layer/background_layer.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,9 @@ class BackgroundLayer extends Layer {
8383
backgroundOpacity: map["paint"]["background-opacity"] is num?
8484
? (map["paint"]["background-opacity"] as num?)?.toDouble()
8585
: null,
86-
backgroundPattern: map["paint"]["background-pattern"],
86+
backgroundPattern: map["paint"]["background-pattern"] is String?
87+
? map["paint"]["background-pattern"] as String?
88+
: null,
8789
);
8890
}
8991
}

lib/src/style/layer/fill_extrusion_layer.dart

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,9 @@ class FillExtrusionLayer extends Layer {
143143
fillExtrusionOpacity: map["paint"]["fill-extrusion-opacity"] is num?
144144
? (map["paint"]["fill-extrusion-opacity"] as num?)?.toDouble()
145145
: null,
146-
fillExtrusionPattern: map["paint"]["fill-extrusion-pattern"],
146+
fillExtrusionPattern: map["paint"]["fill-extrusion-pattern"] is String?
147+
? map["paint"]["fill-extrusion-pattern"] as String?
148+
: null,
147149
fillExtrusionTranslate:
148150
(map["paint"]["fill-extrusion-translate"] as List?)
149151
?.map<double?>((e) => e.toDouble())
@@ -157,8 +159,10 @@ class FillExtrusionLayer extends Layer {
157159
.last
158160
.toLowerCase()
159161
.contains(map["paint"]["fill-extrusion-translate-anchor"])),
160-
fillExtrusionVerticalGradient: map["paint"]
161-
["fill-extrusion-vertical-gradient"],
162+
fillExtrusionVerticalGradient:
163+
map["paint"]["fill-extrusion-vertical-gradient"] is bool?
164+
? map["paint"]["fill-extrusion-vertical-gradient"] as bool?
165+
: null,
162166
);
163167
}
164168
}

lib/src/style/layer/fill_layer.dart

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,14 +132,18 @@ class FillLayer extends Layer {
132132
fillSortKey: map["layout"]["fill-sort-key"] is num?
133133
? (map["layout"]["fill-sort-key"] as num?)?.toDouble()
134134
: null,
135-
fillAntialias: map["paint"]["fill-antialias"],
135+
fillAntialias: map["paint"]["fill-antialias"] is bool?
136+
? map["paint"]["fill-antialias"] as bool?
137+
: null,
136138
fillColor: (map["paint"]["fill-color"] as List?)?.toRGBAInt(),
137139
fillOpacity: map["paint"]["fill-opacity"] is num?
138140
? (map["paint"]["fill-opacity"] as num?)?.toDouble()
139141
: null,
140142
fillOutlineColor:
141143
(map["paint"]["fill-outline-color"] as List?)?.toRGBAInt(),
142-
fillPattern: map["paint"]["fill-pattern"],
144+
fillPattern: map["paint"]["fill-pattern"] is String?
145+
? map["paint"]["fill-pattern"] as String?
146+
: null,
143147
fillTranslate: (map["paint"]["fill-translate"] as List?)
144148
?.map<double?>((e) => e.toDouble())
145149
.toList(),

lib/src/style/layer/line_layer.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,9 @@ class LineLayer extends Layer {
234234
lineOpacity: map["paint"]["line-opacity"] is num?
235235
? (map["paint"]["line-opacity"] as num?)?.toDouble()
236236
: null,
237-
linePattern: map["paint"]["line-pattern"],
237+
linePattern: map["paint"]["line-pattern"] is String?
238+
? map["paint"]["line-pattern"] as String?
239+
: null,
238240
lineTranslate: (map["paint"]["line-translate"] as List?)
239241
?.map<double?>((e) => e.toDouble())
240242
.toList(),

0 commit comments

Comments
 (0)