react-native-steerpath-smart-map 1.20.0 → 1.22.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/CHANGELOG.md CHANGED
@@ -15,6 +15,18 @@ This package is built on top of Steerpath's Smart SDK, and most of releases are
15
15
  - [iOS](https://s3-eu-west-1.amazonaws.com/steerpath/ios/releases/smart-sdk-changelog/index.html)
16
16
  - [Web](https://s3-eu-west-1.amazonaws.com/steerpath-web-sdk/documentation/smart/latest/index.html)
17
17
 
18
+
19
+ ## [1.22.0] - 2023-04-24
20
+
21
+ - Fixed issues where buildings or some POIs were not selectable when using onSearchResultSelected and selectMapObject combination
22
+ - Bump Android Smart SDK version to android-smart-1.20.0
23
+ - Bump iOS Smart SDK version to 1.16.5
24
+
25
+ ## [1.21.0]- 2023-04-14
26
+
27
+ - Added externalFeedbackUrl to SmartMapObjectProperties
28
+ - Bump iOS Smart SDK version to 1.16.4
29
+
18
30
  ## [1.20.0] - 2023-03-02
19
31
 
20
32
  - Added missing configString prop to ConfigSDK interface
@@ -53,7 +53,7 @@ repositories {
53
53
 
54
54
  dependencies {
55
55
  implementation "com.facebook.react:react-native:${safeExtGet('reactnativeVersion', '+')}"
56
- implementation "com.steerpath:smart:android-smart-1.19.1"
56
+ implementation "com.steerpath:smart:android-smart-1.20.0"
57
57
  implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
58
58
  implementation "androidx.lifecycle:lifecycle-viewmodel:2.2.0"
59
59
  }
@@ -58,7 +58,7 @@ public class RNSmartMapModule extends ReactContextBaseJavaModule {
58
58
 
59
59
  mapView.getMap().getMapObject(localRef, buildingRef, source, (smartMapObject, s) -> {
60
60
  if (smartMapObject != null) {
61
- callback.invoke(mapView.smartMapObjectToWritableMap(smartMapObject, false), s);
61
+ callback.invoke(mapView.smartMapObjectToWritableMap(smartMapObject), s);
62
62
  } else {
63
63
  callback.invoke(null, s);
64
64
  }
@@ -94,7 +94,7 @@ public class RNSmartMapModule extends ReactContextBaseJavaModule {
94
94
 
95
95
  mapView.getMap().getMapObjectByProperties(properties, (smartMapObject, s) -> {
96
96
  if (smartMapObject != null) {
97
- callback.invoke(mapView.smartMapObjectToWritableMap(smartMapObject, false), s);
97
+ callback.invoke(mapView.smartMapObjectToWritableMap(smartMapObject), s);
98
98
  } else {
99
99
  callback.invoke(null, s);
100
100
  }
@@ -130,7 +130,7 @@ public class RNSmartMapView extends FrameLayout
130
130
  WritableArray array = new WritableNativeArray();
131
131
 
132
132
  for (SmartMapObject object : mapObjects) {
133
- array.pushMap(smartMapObjectToWritableMap(object, false));
133
+ array.pushMap(smartMapObjectToWritableMap(object));
134
134
  }
135
135
 
136
136
  WritableMap map = new WritableNativeMap();
@@ -143,7 +143,7 @@ public class RNSmartMapView extends FrameLayout
143
143
  @Override
144
144
  public boolean onSearchResultSelected(SmartMapObject mapObject) {
145
145
  WritableMap map = new WritableNativeMap();
146
- map.putMap("mapObject", smartMapObjectToWritableMap(mapObject, true));
146
+ map.putMap("mapObject", smartMapObjectToWritableMap(mapObject));
147
147
  manager.sendEvent(reactContext, this, SEARCH_RESULT_SELECTED, map);
148
148
  return true;
149
149
  }
@@ -160,7 +160,7 @@ public class RNSmartMapView extends FrameLayout
160
160
  payload.putMap("searchAction", action);
161
161
  WritableNativeArray list = new WritableNativeArray();
162
162
  for (SmartMapObject obj : searchResults) {
163
- list.pushMap(smartMapObjectToWritableMap(obj, true));
163
+ list.pushMap(smartMapObjectToWritableMap(obj));
164
164
  }
165
165
 
166
166
  payload.putArray("searchResults", list);
@@ -225,16 +225,15 @@ public class RNSmartMapView extends FrameLayout
225
225
  if (userTask instanceof NavigationUserTask) {
226
226
  taskMap.putString("type", "navigation");
227
227
  taskMap.putMap("payload",
228
- smartMapObjectToWritableMap(((NavigationUserTask) userTask).getMapObjects().get(0), false));
228
+ smartMapObjectToWritableMap(((NavigationUserTask) userTask).getMapObjects().get(0)));
229
229
  } else if (userTask instanceof POISelectionUserTask) {
230
230
  taskMap.putString("type", "poiSelection");
231
231
  WritableMap payload = new WritableNativeMap();
232
232
  payload.putMap("smartMapObject",
233
- smartMapObjectToWritableMap(((POISelectionUserTask) userTask).getMapObject(), false));
233
+ smartMapObjectToWritableMap(((POISelectionUserTask) userTask).getMapObject()));
234
234
  taskMap.putMap("payload", payload);
235
235
  }
236
236
 
237
- Log.d("nativeTask", "" + taskMap);
238
237
  map.putMap("userTask", taskMap);
239
238
 
240
239
  manager.sendEvent(reactContext, this, USER_TASK_RESPONSE, map);
@@ -319,7 +318,7 @@ public class RNSmartMapView extends FrameLayout
319
318
  }
320
319
 
321
320
  if (smartMapObject != null) {
322
- map.putMap("smartMapObject", smartMapObjectToWritableMap(smartMapObject, false));
321
+ map.putMap("smartMapObject", smartMapObjectToWritableMap(smartMapObject));
323
322
  }
324
323
 
325
324
  map.putString("status", status);
@@ -400,8 +399,8 @@ public class RNSmartMapView extends FrameLayout
400
399
  smartMap.removeMarkers(smartMapObjects);
401
400
  }
402
401
 
403
- public void selectMapObject(String buildingRef, String localRef) {
404
- smartMap.selectMapObject(localRef, buildingRef);
402
+ public void selectMapObject(SmartMapObject mapObject) {
403
+ smartMap.selectMapObject(mapObject);
405
404
  }
406
405
 
407
406
  public void setCamera(double latitude, double longitude, double zoomLevel, double bearing, double pitch,
@@ -436,7 +435,6 @@ public class RNSmartMapView extends FrameLayout
436
435
  }
437
436
 
438
437
  int finalResId = resId;
439
- Log.d("finalResId", "" + finalResId);
440
438
  smartMap.getMapObject(localRef, buildingRef, objectSource, (smartMapObject, s) -> {
441
439
  if (smartMapObject != null) {
442
440
  smartMap.startUserTask(
@@ -453,15 +451,10 @@ public class RNSmartMapView extends FrameLayout
453
451
  * - - - - - PRIVATE METHODS - - - - -
454
452
  */
455
453
 
456
- WritableMap smartMapObjectToWritableMap(SmartMapObject object, boolean removePropertiesKey) {
454
+ WritableMap smartMapObjectToWritableMap(SmartMapObject object) {
457
455
  WritableMap map = new WritableNativeMap();
458
456
  try {
459
- if (removePropertiesKey) {
460
- map.putMap("properties",
461
- convertJsonToWritableMap(object.getProperties().getJSONObject("properties")));
462
- } else {
463
- map.putMap("properties", convertJsonToWritableMap(object.getProperties()));
464
- }
457
+ map.putMap("properties", convertJsonToWritableMap(object.getProperties()));
465
458
  } catch (JSONException e) {
466
459
  e.printStackTrace();
467
460
  }
@@ -39,6 +39,10 @@ import static com.steerpath.rnsmartmap.RNEventKeys.USER_TASK_RESPONSE;
39
39
  import static com.steerpath.rnsmartmap.RNEventKeys.VIEW_STATUS_CHANGED;
40
40
  import static com.steerpath.rnsmartmap.RNEventKeys.VISIBLE_FLOOR_CHANGED;
41
41
  import static com.steerpath.rnsmartmap.RNEventKeys.BOTTOMSHEET_STATE_CHANGED;
42
+ import static com.steerpath.rnsmartmap.Utils.convertMapToJson;
43
+
44
+ import org.json.JSONException;
45
+ import org.json.JSONObject;
42
46
 
43
47
  public class RNSmartMapViewManager extends ViewGroupManager<RNSmartMapView> {
44
48
 
@@ -148,7 +152,6 @@ public class RNSmartMapViewManager extends ViewGroupManager<RNSmartMapView> {
148
152
  args.getString(3), args.getString(4));
149
153
  break;
150
154
  case ANIMATE_CAMERA:
151
- Log.d("animateCamera", args.toString());
152
155
  lat = args.getDouble(0);
153
156
  lon = args.getDouble(1);
154
157
  zoom = args.getDouble(2);
@@ -173,8 +176,7 @@ public class RNSmartMapViewManager extends ViewGroupManager<RNSmartMapView> {
173
176
  mapView.removeMarkers(generateMapObjectsList(args.getArray(0)));
174
177
  break;
175
178
  case SELECT_MAP_OBJECT:
176
- map = args.getMap(0);
177
- mapView.selectMapObject(getBuildingRef(map), getLocalRef(map));
179
+ mapView.selectMapObject(generateMapObject(args.getMap(0)));
178
180
  break;
179
181
  case SET_CAMERA:
180
182
  lat = args.getDouble(0);
@@ -262,8 +264,21 @@ public class RNSmartMapViewManager extends ViewGroupManager<RNSmartMapView> {
262
264
  return map.getString("source");
263
265
  }
264
266
 
265
- void sendEvent(ReactContext reactContext, View view, String eventName, @Nullable WritableMap params) {
266
- reactContext.getJSModule(RCTEventEmitter.class).receiveEvent(view.getId(), eventName, params);
267
+ private String getTitle(ReadableMap map) {
268
+ return map.getString("title");
269
+ }
270
+
271
+ private JSONObject getProperties(ReadableMap map) {
272
+ ReadableMap propertiesMap = map.getMap("properties");
273
+ JSONObject properties = new JSONObject();
274
+ if (propertiesMap != null) {
275
+ try {
276
+ properties = convertMapToJson(propertiesMap);
277
+ } catch (JSONException e) {
278
+ throw new RuntimeException(e);
279
+ }
280
+ }
281
+ return properties;
267
282
  }
268
283
 
269
284
  private List<SmartMapObject> generateMapObjectsList(ReadableArray array) {
@@ -276,7 +291,17 @@ public class RNSmartMapViewManager extends ViewGroupManager<RNSmartMapView> {
276
291
  }
277
292
 
278
293
  private SmartMapObject generateMapObject(ReadableMap map) {
279
- return new SmartMapObject(getLatitude(map), getLongitude(map), getFloorIndex(map), getLocalRef(map),
294
+ SmartMapObject mapObject = new SmartMapObject(getLatitude(map), getLongitude(map), getFloorIndex(map), getLocalRef(map),
280
295
  getBuildingRef(map));
296
+ mapObject.setProperties(getProperties(map));
297
+ mapObject.setSource(getSource(map));
298
+ mapObject.setTitle(getTitle(map));
299
+
300
+ return mapObject;
301
+
302
+ }
303
+
304
+ void sendEvent(ReactContext reactContext, View view, String eventName, @Nullable WritableMap params) {
305
+ reactContext.getJSModule(RCTEventEmitter.class).receiveEvent(view.getId(), eventName, params);
281
306
  }
282
307
  }
@@ -13,10 +13,6 @@ import org.json.JSONObject;
13
13
 
14
14
  import java.util.Iterator;
15
15
 
16
- import static com.facebook.react.bridge.ReadableType.Array;
17
- import static com.facebook.react.bridge.ReadableType.Map;
18
- import static com.facebook.react.bridge.ReadableType.Null;
19
-
20
16
  public class Utils {
21
17
 
22
18
  static WritableMap convertJsonToWritableMap(JSONObject jsonObject) throws JSONException {
@@ -171,6 +171,7 @@ export interface SmartMapObjectProperties {
171
171
  'title:nb'?: string;
172
172
  'title:en'?: string;
173
173
  weekPlannerCapacity?: number;
174
+ externalFeedbackUrl?: string;
174
175
  [key: string]: any;
175
176
  }
176
177
  export interface SmartMapObject {
@@ -19,6 +19,9 @@
19
19
  localRef:[self NSString:json[@"localRef"]]
20
20
  buildingRef:[self NSString:json[@"buildingRef"]]];
21
21
  obj.title = [self NSString:json[@"title"]];
22
+
23
+ NSDictionary* props = [RCTConvert NSDictionary:json[@"properties"]];
24
+ obj.properties = props;
22
25
 
23
26
  NSString* rawSource = [self NSString:json[@"source"]];
24
27
  NSArray *items = @[@"static", @"marker", @"live"];
@@ -291,7 +291,6 @@ RCT_EXPORT_METHOD(selectMapObject:(nonnull NSNumber*) reactTag
291
291
  [view selectMapObject:[RCTConvert SPSmartMapObject:json]];
292
292
  }
293
293
  }];
294
-
295
294
  }
296
295
 
297
296
  RCT_EXPORT_METHOD(getWidgetPadding:(nonnull NSNumber*) reactTag
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "react-native-steerpath-smart-map",
3
3
  "title": "React Native Steerpath Smart Map",
4
- "version": "1.20.0",
4
+ "version": "1.22.0",
5
5
  "description": "Steerpath SmartMapView for React Native",
6
6
  "main": "dist/index.js",
7
7
  "scripts": {
@@ -20,7 +20,7 @@ Pod::Spec.new do |s|
20
20
  s.requires_arc = true
21
21
 
22
22
  s.dependency "React"
23
- s.dependency 'SteerpathSmartSDK', '~> 1.16.3'
23
+ s.dependency 'SteerpathSmartSDK', '~> 1.16.5'
24
24
  # s.dependency "..."
25
25
  end
26
26
 
@@ -235,6 +235,7 @@ export interface SmartMapObjectProperties {
235
235
  'title:nb'?: string;
236
236
  'title:en'?: string;
237
237
  weekPlannerCapacity?: number;
238
+ externalFeedbackUrl?: string;
238
239
  [key: string]: any; // Probably not the best practice, but this way we can get the access to properties that are not typed above.
239
240
  }
240
241