@rnmapbox/maps 10.2.5 → 10.2.7

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 (37) hide show
  1. package/android/src/main/java/com/rnmapbox/rnmbx/components/mapview/RNMBXMapView.kt +4 -4
  2. package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/RNMBXStyle.kt +1 -1
  3. package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/RNMBXStyleFactory.kt +0 -1
  4. package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/RNMBXStyleValue.kt +6 -2
  5. package/android/src/main/java/com/rnmapbox/rnmbx/modules/CustomHttpHeaders.kt +31 -9
  6. package/android/src/main/java/com/rnmapbox/rnmbx/modules/RNMBXModule.kt +15 -1
  7. package/android/src/main/java/com/rnmapbox/rnmbx/utils/ConvertUtils.kt +239 -0
  8. package/android/src/main/java/com/rnmapbox/rnmbx/utils/GeoJSONUtils.kt +5 -2
  9. package/android/src/main/mapbox-v11-compat/v10/com/rnmapbox/rnmbx/v11compat/StyleFactory.kt +29 -0
  10. package/android/src/test/kotlin/com/rnmapbox/rnmbx/components/styles/RNMBXStyleValueTest.kt +2 -2
  11. package/ios/RNMBX/CustomHttpHeaders.swift +36 -7
  12. package/ios/RNMBX/RNMBXCustomLocationProvider.swift +4 -1
  13. package/ios/RNMBX/RNMBXCustomLocationProviderComponentView.mm +12 -2
  14. package/ios/RNMBX/RNMBXFabricPropConvert.h +12 -4
  15. package/ios/RNMBX/RNMBXFabricPropConvert.mm +4 -0
  16. package/ios/RNMBX/RNMBXMapViewComponentView.mm +2 -0
  17. package/ios/RNMBX/RNMBXModule.m +1 -0
  18. package/ios/RNMBX/RNMBXModule.swift +16 -2
  19. package/ios/RNMBX/Utils/RNMBXViewResolver.mm +15 -2
  20. package/lib/commonjs/plugin/build/withMapbox.js +8 -8
  21. package/lib/commonjs/plugin/src/withMapbox.ts +8 -8
  22. package/lib/module/RNMBXModule.js +15 -1
  23. package/lib/module/RNMBXModule.js.map +1 -1
  24. package/lib/module/components/MapView.js +1 -1
  25. package/lib/typescript/plugin/build/withMapbox.d.ts +1 -6
  26. package/lib/typescript/plugin/build/withMapbox.d.ts.map +1 -1
  27. package/lib/typescript/src/RNMBXModule.d.ts +11 -1
  28. package/lib/typescript/src/RNMBXModule.d.ts.map +1 -1
  29. package/lib/typescript/src/components/MapView.d.ts +1 -1
  30. package/package.json +1 -1
  31. package/plugin/build/withMapbox.js +8 -8
  32. package/plugin/src/withMapbox.ts +8 -8
  33. package/src/RNMBXModule.ts +29 -3
  34. package/src/components/MapView.tsx +1 -1
  35. package/android/src/main/java/com/rnmapbox/rnmbx/utils/ConvertUtils.java +0 -253
  36. package/android/src/main/mapbox-v11-compat/v10/com/rnmapbox/rnmbx/v11compat/Layers.kt +0 -35
  37. package/android/src/main/mapbox-v11-compat/v11/com/rnmapbox/rnmbx/v11compat/Layers.kt +0 -1
@@ -1,253 +0,0 @@
1
- package com.rnmapbox.rnmbx.utils;
2
-
3
- import android.graphics.PointF;
4
- import android.graphics.RectF;
5
- import android.util.Log;
6
-
7
- import com.facebook.react.bridge.Arguments;
8
- import com.facebook.react.bridge.NoSuchKeyException;
9
- import com.facebook.react.bridge.ReadableArray;
10
- import com.facebook.react.bridge.ReadableMap;
11
- import com.facebook.react.bridge.ReadableMapKeySetIterator;
12
- import com.facebook.react.bridge.ReadableType;
13
- import com.facebook.react.bridge.WritableArray;
14
- import com.facebook.react.bridge.WritableMap;
15
- import com.google.gson.JsonArray;
16
- import com.google.gson.JsonElement;
17
- import com.google.gson.JsonObject;
18
- import com.google.gson.JsonPrimitive;
19
-
20
- import java.text.NumberFormat;
21
- import java.text.ParseException;
22
- import java.util.ArrayList;
23
- import java.util.List;
24
- import java.util.Map;
25
-
26
- public class ConvertUtils {
27
- public static final String LOG_TAG = "ConvertUtils";
28
-
29
- public static JsonObject toJsonObject(ReadableMap map) {
30
- if (map == null) return null;
31
- JsonObject result = new JsonObject();
32
- ReadableMapKeySetIterator it = map.keySetIterator();
33
-
34
- while (it.hasNextKey()) {
35
- String key = it.nextKey();
36
- switch (map.getType(key)) {
37
- case Map:
38
- result.add(key, toJsonObject(map.getMap(key)));
39
- break;
40
- case Array:
41
- result.add(key, toJsonArray(map.getArray(key)));
42
- break;
43
- case Null:
44
- result.add(key, null);
45
- break;
46
- case Number:
47
- result.addProperty(key, map.getDouble(key));
48
- break;
49
- case String:
50
- result.addProperty(key, map.getString(key));
51
- break;
52
- case Boolean:
53
- result.addProperty(key, map.getBoolean(key));
54
- break;
55
- }
56
- }
57
- return result;
58
- }
59
-
60
- public static JsonArray toJsonArray(ReadableArray array) {
61
- if (array == null) return null;
62
- JsonArray result = new JsonArray(array.size());
63
- for (int i = 0; i < array.size(); i++) {
64
- switch (array.getType(i)) {
65
- case Map:
66
- result.add(toJsonObject(array.getMap(i)));
67
- break;
68
- case Array:
69
- result.add(toJsonArray(array.getArray(i)));
70
- break;
71
- case Null:
72
- result.add((JsonElement)null);
73
- break;
74
- case Number:
75
- result.add(array.getDouble(i));
76
- break;
77
- case String:
78
- result.add(array.getString(i));
79
- break;
80
- case Boolean:
81
- result.add(array.getBoolean(i));
82
- break;
83
- }
84
- }
85
- return result;
86
- }
87
-
88
- public static JsonElement typedToJsonElement(ReadableMap map) {
89
- if (map == null) return null;
90
-
91
- String type = map.getString("type");
92
-
93
- if (type.equals(ExpressionParser.TYPE_MAP)) {
94
- JsonObject result = new JsonObject();
95
-
96
- ReadableArray keyValues = map.getArray("value");
97
- for (int i = 0; i < keyValues.size(); i++) {
98
- ReadableArray keyValue = keyValues.getArray(i);
99
- String key = keyValue.getMap(0).getString("value");
100
-
101
- result.add(key, typedToJsonElement(keyValue.getMap(1)));
102
- }
103
- return result;
104
- }
105
- else if (type.equals(ExpressionParser.TYPE_ARRAY)) {
106
- ReadableArray arrayValue = map.getArray("value");
107
- JsonArray result = new JsonArray(arrayValue.size());
108
- for (int i = 0; i < arrayValue.size(); i++) {
109
- result.add(typedToJsonElement(arrayValue.getMap(i)));
110
- }
111
- return result;
112
- }
113
- else if (type.equals(ExpressionParser.TYPE_BOOL)) {
114
- return new JsonPrimitive(map.getBoolean("value"));
115
- }
116
- else if (type.equals(ExpressionParser.TYPE_NUMBER)) {
117
- return new JsonPrimitive(map.getDouble("value"));
118
- }
119
- else if (type.equals(ExpressionParser.TYPE_STRING)) {
120
- return new JsonPrimitive(map.getString("value"));
121
- }
122
- else {
123
- throw new RuntimeException(String.format("Unrecognized type {}", map.getString("type")));
124
- }
125
- }
126
-
127
- public static WritableArray toWritableArray(JsonArray array) {
128
- WritableArray writableArray = Arguments.createArray();
129
-
130
- for (int i = 0; i < array.size(); i++) {
131
- JsonElement element = array.get(i);
132
-
133
- if (element.isJsonArray()) {
134
- writableArray.pushArray(toWritableArray(element.getAsJsonArray()));
135
- } else if (element.isJsonObject()) {
136
- writableArray.pushMap(toWritableMap(element.getAsJsonObject()));
137
- } else if (element.isJsonPrimitive()) {
138
- JsonPrimitive primitive = element.getAsJsonPrimitive();
139
-
140
- if (primitive.isBoolean()) {
141
- writableArray.pushBoolean(primitive.getAsBoolean());
142
- } else if (primitive.isNumber()) {
143
- writableArray.pushDouble(primitive.getAsDouble());
144
- } else {
145
- writableArray.pushString(primitive.getAsString());
146
- }
147
- }
148
- }
149
-
150
- return writableArray;
151
- }
152
-
153
- public static WritableMap toWritableMap(JsonObject object) {
154
- WritableMap map = Arguments.createMap();
155
-
156
- for (Map.Entry<String, JsonElement> entry : object.entrySet()) {
157
- String propName = entry.getKey();
158
- JsonElement jsonElement = entry.getValue();
159
-
160
- if (jsonElement.isJsonPrimitive()) {
161
- JsonPrimitive primitive = jsonElement.getAsJsonPrimitive();
162
-
163
- if (primitive.isBoolean()) {
164
- map.putBoolean(propName, primitive.getAsBoolean());
165
- } else if (primitive.isNumber()) {
166
- map.putDouble(propName, primitive.getAsDouble());
167
- } else {
168
- map.putString(propName, primitive.getAsString());
169
- }
170
- } else if (jsonElement.isJsonArray()) {
171
- map.putArray(propName, toWritableArray(jsonElement.getAsJsonArray()));
172
- } else if (jsonElement.isJsonObject()) {
173
- map.putMap(propName, toWritableMap(jsonElement.getAsJsonObject()));
174
- }
175
- }
176
-
177
- return map;
178
- }
179
-
180
- public static Object getObjectFromString(String str) {
181
- NumberFormat numberFormat = NumberFormat.getNumberInstance();
182
-
183
- try {
184
- return numberFormat.parse(str);
185
- } catch (ParseException e) {
186
- // ignore we're just figuring out what type this is
187
- }
188
-
189
- return str;
190
- }
191
-
192
- public static List<String> toStringList(ReadableArray array) {
193
- List<String> list = new ArrayList<>();
194
-
195
- if (array == null) {
196
- return list;
197
- }
198
-
199
- for (int i = 0; i < array.size(); i++) {
200
- list.add(array.getString(i));
201
- }
202
-
203
- return list;
204
- }
205
-
206
- public static PointF toPointF(ReadableArray array) {
207
- PointF pointF = new PointF();
208
-
209
- if (array == null) {
210
- return pointF;
211
- }
212
-
213
- pointF.set((float)array.getDouble(0), (float)array.getDouble(1));
214
- return pointF;
215
- }
216
-
217
- public static RectF toRectF(ReadableArray array) {
218
- RectF rectF = new RectF();
219
-
220
- if (array == null || array.size() == 0) {
221
- return rectF;
222
- }
223
-
224
- rectF.set((float)array.getDouble(3), (float)array.getDouble(0), (float)array.getDouble(1), (float)array.getDouble(2));
225
- return rectF;
226
- }
227
-
228
- public static double getDouble(String key, ReadableMap map, double defaultValue) {
229
- double value = defaultValue;
230
-
231
- try {
232
- value = map.getDouble(key);
233
- } catch (NoSuchKeyException e) {
234
- // key not found use default value
235
- Log.d(LOG_TAG, String.format("No key found for %s, using default value %f", key, defaultValue));
236
- }
237
-
238
- return value;
239
- }
240
-
241
- public static String getString(String key, ReadableMap map, String defaultValue) {
242
- String value = defaultValue;
243
-
244
- try {
245
- value = map.getString(key);
246
- } catch (NoSuchKeyException e) {
247
- // key not found use default value
248
- Log.d(LOG_TAG, String.format("No key found for %s, using default value %s", key, defaultValue));
249
- }
250
-
251
- return value;
252
- }
253
- }
@@ -1,35 +0,0 @@
1
- package com.rnmapbox.rnmbx.v11compat.layers;
2
-
3
- import com.mapbox.maps.extension.style.expressions.generated.Expression
4
- import com.mapbox.maps.extension.style.layers.generated.FillExtrusionLayer
5
- import com.mapbox.maps.extension.style.types.StyleTransition
6
-
7
- fun FillExtrusionLayer.fillExtrusionEdgeRadius(
8
- expression: Expression
9
- ) {
10
- // V11 only
11
- }
12
-
13
- fun FillExtrusionLayer.fillExtrusionEdgeRadius(
14
- value: Double
15
- ) {
16
- // V11 only
17
- }
18
-
19
- fun FillExtrusionLayer.fillExtrusionEmissiveStrength(
20
- expression: Expression
21
- ) {
22
- // V11 only
23
- }
24
-
25
- fun FillExtrusionLayer.fillExtrusionEmissiveStrength(
26
- value: Double
27
- ) {
28
- // V11 only
29
- }
30
-
31
- fun FillExtrusionLayer.fillExtrusionEmissiveStrengthTransition(
32
- transition: StyleTransition
33
- ) {
34
- // V11 only
35
- }
@@ -1 +0,0 @@
1
- package com.rnmapbox.rnmbx.v11compat.layers;