react-native-map4d-services 0.1.0 → 1.0.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.
Files changed (38) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +24 -24
  3. package/android/build.gradle +60 -59
  4. package/android/src/main/AndroidManifest.xml +4 -4
  5. package/android/src/main/java/com/reactnativemap4dservices/Map4dServicesModule.java +91 -34
  6. package/android/src/main/java/com/reactnativemap4dservices/Map4dServicesPackage.java +28 -28
  7. package/android/src/main/java/com/reactnativemap4dservices/SClient.java +45 -0
  8. package/android/src/main/java/com/reactnativemap4dservices/SConverter.java +166 -0
  9. package/android/src/main/java/com/reactnativemap4dservices/SJsonUtils.java +130 -0
  10. package/android/src/main/java/com/reactnativemap4dservices/SRequest.java +376 -0
  11. package/ios/Map4dServices.h +5 -5
  12. package/ios/Map4dServices.m +81 -81
  13. package/ios/RCTConvert+Services.h +33 -33
  14. package/ios/RCTConvert+Services.m +146 -146
  15. package/ios/SClient.h +23 -23
  16. package/ios/SClient.m +47 -47
  17. package/ios/SRequest.h +40 -40
  18. package/ios/SRequest.m +143 -143
  19. package/lib/commonjs/index.js.map +1 -1
  20. package/lib/module/index.js.map +1 -1
  21. package/lib/typescript/index.d.ts +111 -111
  22. package/package.json +150 -150
  23. package/react-native-map4d-services.podspec +20 -20
  24. package/src/index.tsx +174 -174
  25. package/android/.gradle/7.1.1/dependencies-accessors/dependencies-accessors.lock +0 -0
  26. package/android/.gradle/7.1.1/dependencies-accessors/gc.properties +0 -0
  27. package/android/.gradle/7.1.1/executionHistory/executionHistory.lock +0 -0
  28. package/android/.gradle/7.1.1/fileChanges/last-build.bin +0 -0
  29. package/android/.gradle/7.1.1/fileHashes/fileHashes.lock +0 -0
  30. package/android/.gradle/7.1.1/gc.properties +0 -0
  31. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  32. package/android/.gradle/buildOutputCleanup/cache.properties +0 -2
  33. package/android/.gradle/checksums/checksums.lock +0 -0
  34. package/android/.gradle/checksums/md5-checksums.bin +0 -0
  35. package/android/.gradle/checksums/sha1-checksums.bin +0 -0
  36. package/android/.gradle/vcs-1/gc.properties +0 -0
  37. package/ios/.DS_Store +0 -0
  38. package/ios/Map4dServices.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -4
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2021 IOTLink
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2021 IOTLink
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,24 +1,24 @@
1
- # react-native-map4d-services
2
-
3
- React Native Map4dServices for iOS + Android
4
-
5
- ## Installation
6
-
7
- ```sh
8
- npm install react-native-map4d-services
9
- ```
10
-
11
- ## Usage
12
-
13
- E.g. Auto Suggest
14
-
15
- ```js
16
- import { fetchSuggestion } from "react-native-map4d-services";
17
-
18
- // ...
19
-
20
- fetchSuggestion({text: 'abc'})
21
- .then(result => {
22
- console.log('Suggestion:', result);
23
- })
24
- ```
1
+ # react-native-map4d-services
2
+
3
+ React Native Map4dServices for iOS + Android
4
+
5
+ ## Installation
6
+
7
+ ```sh
8
+ npm install react-native-map4d-services
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ E.g. Auto Suggest
14
+
15
+ ```js
16
+ import { fetchSuggestion } from "react-native-map4d-services";
17
+
18
+ // ...
19
+
20
+ fetchSuggestion({text: 'abc'})
21
+ .then(result => {
22
+ console.log('Suggestion:', result);
23
+ })
24
+ ```
@@ -1,59 +1,60 @@
1
- buildscript {
2
- if (project == rootProject) {
3
- repositories {
4
- google()
5
- mavenCentral()
6
- jcenter()
7
- }
8
-
9
- dependencies {
10
- classpath 'com.android.tools.build:gradle:3.5.3'
11
- }
12
- }
13
- }
14
-
15
- apply plugin: 'com.android.library'
16
-
17
- def safeExtGet(prop, fallback) {
18
- rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
19
- }
20
-
21
- android {
22
- compileSdkVersion safeExtGet('Map4dServices_compileSdkVersion', 29)
23
- defaultConfig {
24
- minSdkVersion safeExtGet('Map4dServices_minSdkVersion', 16)
25
- targetSdkVersion safeExtGet('Map4dServices_targetSdkVersion', 29)
26
- versionCode 1
27
- versionName "1.0"
28
-
29
- }
30
-
31
- buildTypes {
32
- release {
33
- minifyEnabled false
34
- }
35
- }
36
- lintOptions {
37
- disable 'GradleCompatible'
38
- }
39
- compileOptions {
40
- sourceCompatibility JavaVersion.VERSION_1_8
41
- targetCompatibility JavaVersion.VERSION_1_8
42
- }
43
- }
44
-
45
- repositories {
46
- mavenLocal()
47
- maven {
48
- // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
49
- url("$rootDir/../node_modules/react-native/android")
50
- }
51
- google()
52
- mavenCentral()
53
- jcenter()
54
- }
55
-
56
- dependencies {
57
- //noinspection GradleDynamicVersion
58
- implementation "com.facebook.react:react-native:+" // From node_modules
59
- }
1
+ buildscript {
2
+ if (project == rootProject) {
3
+ repositories {
4
+ google()
5
+ mavenCentral()
6
+ jcenter()
7
+ }
8
+
9
+ dependencies {
10
+ classpath 'com.android.tools.build:gradle:3.5.3'
11
+ }
12
+ }
13
+ }
14
+
15
+ apply plugin: 'com.android.library'
16
+
17
+ def safeExtGet(prop, fallback) {
18
+ rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
19
+ }
20
+
21
+ android {
22
+ compileSdkVersion safeExtGet('Map4dServices_compileSdkVersion', 29)
23
+ defaultConfig {
24
+ minSdkVersion safeExtGet('Map4dServices_minSdkVersion', 16)
25
+ targetSdkVersion safeExtGet('Map4dServices_targetSdkVersion', 29)
26
+ versionCode 1
27
+ versionName "1.0"
28
+
29
+ }
30
+
31
+ buildTypes {
32
+ release {
33
+ minifyEnabled false
34
+ }
35
+ }
36
+ lintOptions {
37
+ disable 'GradleCompatible'
38
+ }
39
+ compileOptions {
40
+ sourceCompatibility JavaVersion.VERSION_1_8
41
+ targetCompatibility JavaVersion.VERSION_1_8
42
+ }
43
+ }
44
+
45
+ repositories {
46
+ mavenLocal()
47
+ maven {
48
+ // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
49
+ url("$rootDir/../node_modules/react-native/android")
50
+ }
51
+ google()
52
+ mavenCentral()
53
+ jcenter()
54
+ }
55
+
56
+ dependencies {
57
+ //noinspection GradleDynamicVersion
58
+ implementation "com.facebook.react:react-native:+" // From node_modules
59
+ implementation 'vn.map4d:Map4dServices:2.0.0'
60
+ }
@@ -1,4 +1,4 @@
1
- <manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
- package="com.reactnativemap4dservices">
3
-
4
- </manifest>
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
+ package="com.reactnativemap4dservices">
3
+
4
+ </manifest>
@@ -1,34 +1,91 @@
1
- package com.reactnativemap4dservices;
2
-
3
- import androidx.annotation.NonNull;
4
-
5
- import com.facebook.react.bridge.Promise;
6
- import com.facebook.react.bridge.ReactApplicationContext;
7
- import com.facebook.react.bridge.ReactContextBaseJavaModule;
8
- import com.facebook.react.bridge.ReactMethod;
9
- import com.facebook.react.module.annotations.ReactModule;
10
-
11
- @ReactModule(name = Map4dServicesModule.NAME)
12
- public class Map4dServicesModule extends ReactContextBaseJavaModule {
13
- public static final String NAME = "Map4dServices";
14
-
15
- public Map4dServicesModule(ReactApplicationContext reactContext) {
16
- super(reactContext);
17
- }
18
-
19
- @Override
20
- @NonNull
21
- public String getName() {
22
- return NAME;
23
- }
24
-
25
-
26
- // Example method
27
- // See https://reactnative.dev/docs/native-modules-android
28
- @ReactMethod
29
- public void multiply(int a, int b, Promise promise) {
30
- promise.resolve(a * b);
31
- }
32
-
33
- public static native int nativeMultiply(int a, int b);
34
- }
1
+ package com.reactnativemap4dservices;
2
+
3
+ import androidx.annotation.NonNull;
4
+
5
+ import com.facebook.react.bridge.Promise;
6
+ import com.facebook.react.bridge.ReactApplicationContext;
7
+ import com.facebook.react.bridge.ReactContextBaseJavaModule;
8
+ import com.facebook.react.bridge.ReactMethod;
9
+ import com.facebook.react.bridge.ReadableMap;
10
+ import com.facebook.react.module.annotations.ReactModule;
11
+
12
+ import vn.map4d.services.MFServicesOptions;
13
+
14
+ @ReactModule(name = Map4dServicesModule.NAME)
15
+ public class Map4dServicesModule extends ReactContextBaseJavaModule {
16
+ public static final String NAME = "Map4dServices";
17
+
18
+ private MFServicesOptions servicesOptions;
19
+
20
+ public Map4dServicesModule(ReactApplicationContext reactContext) {
21
+ super(reactContext);
22
+ servicesOptions = new MFServicesOptions.Builder(reactContext).build();
23
+ }
24
+
25
+ @Override
26
+ @NonNull
27
+ public String getName() {
28
+ return NAME;
29
+ }
30
+
31
+ /* Place | Suggestions */
32
+ @ReactMethod
33
+ public void fetchSuggestion(ReadableMap params, @NonNull Promise promise) {
34
+ SClient.fireRequest(servicesOptions, SRequest.buildSuggestionsRequestWithData(params), promise);
35
+ }
36
+
37
+ /* Place | Detail */
38
+ @ReactMethod
39
+ public void fetchPlaceDetail(String placeId, @NonNull Promise promise) {
40
+ SClient.fireRequest(servicesOptions, SRequest.buildPlaceDetailRequestWithId(placeId), promise);
41
+ }
42
+
43
+ /* Place | Text search */
44
+ @ReactMethod
45
+ public void fetchTextSearch(ReadableMap params, @NonNull Promise promise) {
46
+ SClient.fireRequest(servicesOptions, SRequest.buildTextSearchRequestWithData(params), promise);
47
+ }
48
+
49
+ /* Place | Nearby search */
50
+ @ReactMethod
51
+ public void fetchNearbySearch(ReadableMap params, @NonNull Promise promise) {
52
+ SClient.fireRequest(servicesOptions, SRequest.buildNearbySearchRequestWithData(params), promise);
53
+ }
54
+
55
+ /* Place | Viewbox search */
56
+ @ReactMethod
57
+ public void fetchViewboxSearch(ReadableMap params, @NonNull Promise promise) {
58
+ SClient.fireRequest(servicesOptions, SRequest.buildViewboxSearchRequestWithData(params), promise);
59
+ }
60
+
61
+ /* Place | Geocode */
62
+ @ReactMethod
63
+ public void fetchGeocode(ReadableMap params, @NonNull Promise promise) {
64
+ SClient.fireRequest(servicesOptions, SRequest.buildGeocodingRequestWithData(params), promise);
65
+ }
66
+
67
+ /* Route | Directions */
68
+ @ReactMethod
69
+ public void fetchDirections(ReadableMap params, @NonNull Promise promise) {
70
+ SClient.fireRequest(servicesOptions, SRequest.buildDirectionsRequestWithData(params), promise);
71
+ }
72
+
73
+ /* Route | ETA */
74
+ @ReactMethod
75
+ public void fetchRouteETA(ReadableMap params, @NonNull Promise promise) {
76
+ SClient.fireRequest(servicesOptions, SRequest.buildRouteETARequestWithData(params), promise);
77
+ }
78
+
79
+ /* Route | Distance matrix */
80
+ @ReactMethod
81
+ public void fetchDistanceMatrix(ReadableMap params, @NonNull Promise promise) {
82
+ SClient.fireRequest(servicesOptions, SRequest.buildDistanceMatrixRequestWithData(params), promise);
83
+ }
84
+
85
+ /* Route | Graph route */
86
+ @ReactMethod
87
+ public void fetchGraphRoute(ReadableMap params, @NonNull Promise promise) {
88
+ SClient.fireRequest(servicesOptions, SRequest.buildGraphRouteRequestWithData(params), promise);
89
+ }
90
+
91
+ }
@@ -1,28 +1,28 @@
1
- package com.reactnativemap4dservices;
2
-
3
- import androidx.annotation.NonNull;
4
-
5
- import com.facebook.react.ReactPackage;
6
- import com.facebook.react.bridge.NativeModule;
7
- import com.facebook.react.bridge.ReactApplicationContext;
8
- import com.facebook.react.uimanager.ViewManager;
9
-
10
- import java.util.ArrayList;
11
- import java.util.Collections;
12
- import java.util.List;
13
-
14
- public class Map4dServicesPackage implements ReactPackage {
15
- @NonNull
16
- @Override
17
- public List<NativeModule> createNativeModules(@NonNull ReactApplicationContext reactContext) {
18
- List<NativeModule> modules = new ArrayList<>();
19
- modules.add(new Map4dServicesModule(reactContext));
20
- return modules;
21
- }
22
-
23
- @NonNull
24
- @Override
25
- public List<ViewManager> createViewManagers(@NonNull ReactApplicationContext reactContext) {
26
- return Collections.emptyList();
27
- }
28
- }
1
+ package com.reactnativemap4dservices;
2
+
3
+ import androidx.annotation.NonNull;
4
+
5
+ import com.facebook.react.ReactPackage;
6
+ import com.facebook.react.bridge.NativeModule;
7
+ import com.facebook.react.bridge.ReactApplicationContext;
8
+ import com.facebook.react.uimanager.ViewManager;
9
+
10
+ import java.util.ArrayList;
11
+ import java.util.Collections;
12
+ import java.util.List;
13
+
14
+ public class Map4dServicesPackage implements ReactPackage {
15
+ @NonNull
16
+ @Override
17
+ public List<NativeModule> createNativeModules(@NonNull ReactApplicationContext reactContext) {
18
+ List<NativeModule> modules = new ArrayList<>();
19
+ modules.add(new Map4dServicesModule(reactContext));
20
+ return modules;
21
+ }
22
+
23
+ @NonNull
24
+ @Override
25
+ public List<ViewManager> createViewManagers(@NonNull ReactApplicationContext reactContext) {
26
+ return Collections.emptyList();
27
+ }
28
+ }
@@ -0,0 +1,45 @@
1
+ package com.reactnativemap4dservices;
2
+
3
+ import androidx.annotation.NonNull;
4
+ import androidx.annotation.Nullable;
5
+
6
+ import com.facebook.react.bridge.Promise;
7
+ import com.facebook.react.bridge.WritableMap;
8
+
9
+ import org.json.JSONException;
10
+ import org.json.JSONObject;
11
+
12
+ import vn.map4d.services.MFServiceCallback;
13
+ import vn.map4d.services.MFServiceOptions;
14
+ import vn.map4d.services.MFServiceTask;
15
+ import vn.map4d.services.MFServices;
16
+ import vn.map4d.services.MFServicesOptions;
17
+
18
+ class SClient {
19
+ static void fireRequest(MFServicesOptions options, MFServiceOptions serviceOptions, @NonNull Promise promise) {
20
+ MFServiceTask serviceTask = new MFServices(options)
21
+ .request(serviceOptions, new MFServiceCallback<JSONObject>() {
22
+ @Override
23
+ public void onSuccess(@Nullable JSONObject json) {
24
+ if (json == null) {
25
+ promise.resolve(null);
26
+ }
27
+ else {
28
+ try {
29
+ final WritableMap data = SJsonUtils.convertJsonToMap(json);
30
+ promise.resolve(data);
31
+ } catch (JSONException e) {
32
+ promise.reject(
33
+ "Map4dServices",
34
+ "Error when parse JSON data result !");
35
+ }
36
+ }
37
+ }
38
+
39
+ @Override
40
+ public void onError(String code, String message) {
41
+ promise.reject(code, message);
42
+ }
43
+ });
44
+ }
45
+ }
@@ -0,0 +1,166 @@
1
+ package com.reactnativemap4dservices;
2
+
3
+ import androidx.annotation.NonNull;
4
+
5
+ import com.facebook.react.bridge.ReadableArray;
6
+ import com.facebook.react.bridge.ReadableMap;
7
+
8
+ import org.json.JSONArray;
9
+ import org.json.JSONException;
10
+ import org.json.JSONObject;
11
+
12
+ class SConverter {
13
+ private static String toAvoidPath(ReadableArray array) {
14
+ if (array == null) {
15
+ return null;
16
+ }
17
+ StringBuilder resultBuilder = new StringBuilder();
18
+ for (int i = 0; i < array.size(); ++i) {
19
+ resultBuilder.append(toLocation(array.getMap(i)));
20
+ if (i < array.size() - 1) {
21
+ resultBuilder.append(",");
22
+ }
23
+ }
24
+ return resultBuilder.toString();
25
+ }
26
+
27
+ static String toLocation(ReadableMap map) {
28
+ if (map == null) {
29
+ return null;
30
+ }
31
+ double lat = map.getDouble("latitude");
32
+ double lng = map.getDouble("longitude");
33
+ return lat + "," + lng;
34
+ }
35
+
36
+ static String toViewbox(ReadableMap map) {
37
+ if (map == null) {
38
+ return null;
39
+ }
40
+ String southWest = toLocation(map.getMap("southwest"));
41
+ String northEast = toLocation(map.getMap("northeast"));
42
+ return southWest + "," + northEast;
43
+ }
44
+
45
+ static String toDatetime(double time) {
46
+ long datetime = (long) time;
47
+ return String.valueOf(datetime);
48
+ }
49
+
50
+ static String toTypes(@NonNull ReadableArray types) {
51
+ StringBuilder result = new StringBuilder();
52
+ for (int i = 0; i < types.size(); ++i) {
53
+ if (i > 0) {
54
+ result.append("&types=");
55
+ }
56
+ result.append(types.getString(i));
57
+ }
58
+ return result.toString();
59
+ }
60
+
61
+ static String toTags(@NonNull ReadableArray tags) {
62
+ StringBuilder result = new StringBuilder();
63
+ for (int i = 0; i < tags.size(); ++i) {
64
+ if (i > 0) {
65
+ result.append("&tags=");
66
+ }
67
+ result.append(tags.getString(i));
68
+ }
69
+ return result.toString();
70
+ }
71
+
72
+ static int toWeighting(@NonNull String weighting) {
73
+ switch (weighting) {
74
+ case "shortest":
75
+ return 0;
76
+ case "fastest":
77
+ return 1;
78
+ case "balance":
79
+ return 2;
80
+ default:
81
+ return 3;
82
+ }
83
+ }
84
+
85
+ static String toLocationList(ReadableArray map) {
86
+ if (map == null) {
87
+ return null;
88
+ }
89
+
90
+ StringBuilder result = new StringBuilder();
91
+ for (int i = 0; i < map.size(); ++i) {
92
+ result.append(toLocation(map.getMap(i)));
93
+ if (i < map.size() - 1) {
94
+ result.append(";");
95
+ }
96
+ }
97
+ return result.toString();
98
+ }
99
+
100
+ static JSONArray toOriginJsonArray(ReadableArray origins) {
101
+ if (origins == null) {
102
+ return null;
103
+ }
104
+ JSONArray originsJsonArray = null;
105
+ if (origins != null && origins.size() > 0) {
106
+ originsJsonArray = new JSONArray();
107
+ }
108
+ for (int i = 0; i < origins.size(); ++i) {
109
+ ReadableMap origin = origins.getMap(i);
110
+ try {
111
+ JSONObject originJsonObject = new JSONObject();
112
+ String alias = origin.getString("alias");
113
+ originJsonObject.put("alias", alias);
114
+ originJsonObject.put("location", toLocation(origin));
115
+ originsJsonArray.put(originJsonObject);
116
+ } catch (JSONException e) {
117
+ e.printStackTrace();
118
+ }
119
+ }
120
+ return originsJsonArray;
121
+ }
122
+
123
+ static String toAvoid(ReadableMap map) {
124
+ if (map == null) {
125
+ return null;
126
+ }
127
+ StringBuilder resultBuilder = new StringBuilder();
128
+ if (map.hasKey("location")) {
129
+ String location = toLocation(map.getMap("location"));
130
+ if (location != null) {
131
+ resultBuilder.append(location);
132
+ if (map.hasKey("radius")) {
133
+ int radius = map.getInt("radius");
134
+ resultBuilder.append(",").append(radius);
135
+ }
136
+ }
137
+ }
138
+ else if (map.hasKey("viewbox")) {
139
+ resultBuilder.append(toViewbox(map.getMap("viewbox")));
140
+ }
141
+ else if (map.hasKey("path")) {
142
+ resultBuilder.append(toAvoidPath(map.getArray("path")));
143
+ }
144
+
145
+ return resultBuilder.toString();
146
+ }
147
+
148
+ static String toAvoidRoads(ReadableMap map) {
149
+ if (map == null) {
150
+ return null;
151
+ }
152
+ if (map.hasKey("types")) {
153
+ StringBuilder resultBuilder = new StringBuilder();
154
+ ReadableArray array = map.getArray("types");
155
+ for (int i = 0; i < array.size(); ++i) {
156
+ String type = array.getString(i);
157
+ resultBuilder.append(type);
158
+ if (i < array.size() - 1) {
159
+ resultBuilder.append(",");
160
+ }
161
+ }
162
+ return resultBuilder.toString();
163
+ }
164
+ return null;
165
+ }
166
+ }