react-native-steerpath-smart-map 1.29.5 → 2.0.0-alpha.1
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/.eslintrc.js +66 -0
- package/.prettierrc +7 -0
- package/CHANGELOG.md +35 -0
- package/README.md +7 -0
- package/android/bin/src/main/java/com/steerpath/rnsmartmap/RNEventKeys.class +0 -0
- package/android/bin/src/main/java/com/steerpath/rnsmartmap/RNSmartGeofenceManager.class +0 -0
- package/android/bin/src/main/java/com/steerpath/rnsmartmap/RNSmartLocationManager.class +0 -0
- package/android/bin/src/main/java/com/steerpath/rnsmartmap/RNSmartMapManager.class +0 -0
- package/android/bin/src/main/java/com/steerpath/rnsmartmap/RNSmartMapModule.class +0 -0
- package/android/bin/src/main/java/com/steerpath/rnsmartmap/RNSmartMapPackage.class +0 -0
- package/android/bin/src/main/java/com/steerpath/rnsmartmap/RNSmartMapPackage.kt +28 -0
- package/android/bin/src/main/java/com/steerpath/rnsmartmap/RNSmartMapView.class +0 -0
- package/android/bin/src/main/java/com/steerpath/rnsmartmap/RNSmartMapViewManager.class +0 -0
- package/android/bin/src/main/java/com/steerpath/rnsmartmap/Utils.class +0 -0
- package/android/build.gradle +22 -33
- package/android/gradle/wrapper/gradle-wrapper.properties +1 -1
- package/android/src/main/java/com/steerpath/rnsmartmap/RNSmartLocationManager.java +22 -14
- package/android/src/main/java/com/steerpath/rnsmartmap/RNSmartMapManager.java +9 -31
- package/android/src/main/java/com/steerpath/rnsmartmap/RNSmartMapPackage.java +11 -9
- package/android/src/main/java/com/steerpath/rnsmartmap/Utils.java +36 -36
- package/ios/RNSmartLocationManager.m +28 -3
- package/ios/RNSmartMapManager.m +10 -22
- package/lib/commonjs/SmartLocationManager.js +50 -0
- package/lib/commonjs/SmartLocationManager.js.map +1 -0
- package/lib/commonjs/SmartLocationManager.web.js +11 -0
- package/lib/commonjs/SmartLocationManager.web.js.map +1 -0
- package/lib/commonjs/SmartMapManager.js +59 -0
- package/lib/commonjs/SmartMapManager.js.map +1 -0
- package/lib/commonjs/SmartMapManager.web.js +24 -0
- package/lib/commonjs/SmartMapManager.web.js.map +1 -0
- package/lib/commonjs/index.js +28 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/module/SmartLocationManager.js +46 -0
- package/lib/module/SmartLocationManager.js.map +1 -0
- package/lib/module/SmartLocationManager.web.js +7 -0
- package/lib/module/SmartLocationManager.web.js.map +1 -0
- package/lib/module/SmartMapManager.js +54 -0
- package/lib/module/SmartMapManager.js.map +1 -0
- package/lib/module/SmartMapManager.web.js +20 -0
- package/lib/module/SmartMapManager.web.js.map +1 -0
- package/lib/module/index.js +5 -0
- package/lib/module/index.js.map +1 -0
- package/lib/typescript/SmartLocationManager.d.ts +19 -0
- package/lib/typescript/SmartLocationManager.d.ts.map +1 -0
- package/{dist → lib/typescript}/SmartLocationManager.web.d.ts +1 -0
- package/lib/typescript/SmartLocationManager.web.d.ts.map +1 -0
- package/{dist → lib/typescript}/SmartMapManager.d.ts +13 -15
- package/lib/typescript/SmartMapManager.d.ts.map +1 -0
- package/lib/typescript/SmartMapManager.web.d.ts +8 -0
- package/lib/typescript/SmartMapManager.web.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +5 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/package.json +38 -13
- package/react-native-steerpath-smart-map.podspec +15 -12
- package/src/SmartLocationManager.ts +25 -9
- package/src/SmartMapManager.ts +12 -19
- package/src/SmartMapManager.web.ts +3 -24
- package/src/index.ts +3 -4
- package/tsconfig.json +14 -9
- package/.eslintrc.json +0 -81
- package/android/bin/.project +0 -34
- package/android/bin/.settings/org.eclipse.buildship.core.prefs +0 -13
- package/android/bin/README.md +0 -14
- package/android/bin/build.gradle +0 -59
- package/android/bin/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/bin/gradle/wrapper/gradle-wrapper.properties +0 -6
- package/android/bin/gradlew +0 -172
- package/android/bin/gradlew.bat +0 -84
- package/android/bin/src/main/AndroidManifest.xml +0 -4
- package/android/src/main/java/com/steerpath/rnsmartmap/RNEventKeys.java +0 -29
- package/android/src/main/java/com/steerpath/rnsmartmap/RNSmartGeofenceManager.java +0 -103
- package/android/src/main/java/com/steerpath/rnsmartmap/RNSmartMapModule.java +0 -284
- package/android/src/main/java/com/steerpath/rnsmartmap/RNSmartMapView.java +0 -470
- package/android/src/main/java/com/steerpath/rnsmartmap/RNSmartMapViewManager.java +0 -307
- package/dist/SmartGeofenceManager.d.ts +0 -17
- package/dist/SmartGeofenceManager.js +0 -61
- package/dist/SmartGeofenceManager.web.d.ts +0 -9
- package/dist/SmartGeofenceManager.web.js +0 -10
- package/dist/SmartLocationManager.d.ts +0 -11
- package/dist/SmartLocationManager.js +0 -22
- package/dist/SmartLocationManager.web.js +0 -4
- package/dist/SmartMapEventManager.web.d.ts +0 -5
- package/dist/SmartMapEventManager.web.js +0 -10
- package/dist/SmartMapManager.js +0 -53
- package/dist/SmartMapManager.web.d.ts +0 -12
- package/dist/SmartMapManager.web.js +0 -33
- package/dist/SmartMapView.d.ts +0 -3
- package/dist/SmartMapView.js +0 -294
- package/dist/SmartMapView.web.d.ts +0 -3
- package/dist/SmartMapView.web.js +0 -270
- package/dist/SmartMapViewProps.d.ts +0 -267
- package/dist/SmartMapViewProps.js +0 -76
- package/dist/index.d.ts +0 -5
- package/dist/index.js +0 -5
- package/dist/internalUtils.d.ts +0 -1
- package/dist/internalUtils.js +0 -5
- package/ios/RCTConvert+SmartMapView.h +0 -35
- package/ios/RCTConvert+SmartMapView.m +0 -295
- package/ios/RNSmartGeofenceManager.h +0 -24
- package/ios/RNSmartGeofenceManager.m +0 -110
- package/ios/RNSmartMapUserTaskEventManager.h +0 -19
- package/ios/RNSmartMapUserTaskEventManager.m +0 -46
- package/ios/RNSmartMapView.h +0 -37
- package/ios/RNSmartMapView.m +0 -21
- package/ios/RNSmartMapViewManager.h +0 -27
- package/ios/RNSmartMapViewManager.m +0 -608
- package/package-lock.json +0 -6570
- package/src/SmartGeofenceManager.ts +0 -94
- package/src/SmartGeofenceManager.web.ts +0 -11
- package/src/SmartMapEventManager.web.ts +0 -13
- package/src/SmartMapView.tsx +0 -377
- package/src/SmartMapView.web.tsx +0 -342
- package/src/SmartMapViewProps.ts +0 -338
- package/src/internalUtils.ts +0 -5
- package/src/typings/steerpath-smart-sdk.d.ts +0 -5
|
@@ -1,470 +0,0 @@
|
|
|
1
|
-
package com.steerpath.rnsmartmap;
|
|
2
|
-
|
|
3
|
-
import android.util.Log;
|
|
4
|
-
import android.view.Choreographer;
|
|
5
|
-
import android.view.View;
|
|
6
|
-
import android.view.ViewGroup;
|
|
7
|
-
import android.widget.FrameLayout;
|
|
8
|
-
|
|
9
|
-
import androidx.activity.OnBackPressedCallback;
|
|
10
|
-
import androidx.annotation.NonNull;
|
|
11
|
-
import androidx.appcompat.app.AppCompatActivity;
|
|
12
|
-
|
|
13
|
-
import com.facebook.react.bridge.ReactApplicationContext;
|
|
14
|
-
import com.facebook.react.bridge.ReactContext;
|
|
15
|
-
import com.facebook.react.bridge.WritableArray;
|
|
16
|
-
import com.facebook.react.bridge.WritableMap;
|
|
17
|
-
import com.facebook.react.bridge.WritableNativeArray;
|
|
18
|
-
import com.facebook.react.bridge.WritableNativeMap;
|
|
19
|
-
import com.facebook.react.uimanager.ThemedReactContext;
|
|
20
|
-
import com.steerpath.smart.BottomSheetViewState;
|
|
21
|
-
import com.steerpath.smart.Layout;
|
|
22
|
-
import com.steerpath.smart.NavigationError;
|
|
23
|
-
import com.steerpath.smart.NavigationUserTask;
|
|
24
|
-
import com.steerpath.smart.ObjectSource;
|
|
25
|
-
import com.steerpath.smart.POISelectionUserTask;
|
|
26
|
-
import com.steerpath.smart.SmartMapFragment;
|
|
27
|
-
import com.steerpath.smart.SmartMapObject;
|
|
28
|
-
import com.steerpath.smart.UserTask;
|
|
29
|
-
import com.steerpath.smart.UserTaskResponse;
|
|
30
|
-
import com.steerpath.smart.ViewStatus;
|
|
31
|
-
import com.steerpath.smart.listeners.MapEventListener;
|
|
32
|
-
import com.steerpath.smart.listeners.NavigationEventListener;
|
|
33
|
-
import com.steerpath.smart.listeners.UserTaskListener;
|
|
34
|
-
import com.steerpath.smart.listeners.ViewStatusListener;
|
|
35
|
-
|
|
36
|
-
import org.json.JSONException;
|
|
37
|
-
import org.json.JSONObject;
|
|
38
|
-
|
|
39
|
-
import java.util.ArrayList;
|
|
40
|
-
import java.util.List;
|
|
41
|
-
|
|
42
|
-
import javax.annotation.Nullable;
|
|
43
|
-
|
|
44
|
-
import static com.steerpath.rnsmartmap.RNEventKeys.BOTTOMSHEET_STATE_CHANGED;
|
|
45
|
-
import static com.steerpath.rnsmartmap.RNEventKeys.MAP_CLICKED;
|
|
46
|
-
import static com.steerpath.rnsmartmap.RNEventKeys.MAP_LOADED;
|
|
47
|
-
import static com.steerpath.rnsmartmap.RNEventKeys.NAVIGATION_DESTINATION_REACHED;
|
|
48
|
-
import static com.steerpath.rnsmartmap.RNEventKeys.NAVIGATION_ENDED;
|
|
49
|
-
import static com.steerpath.rnsmartmap.RNEventKeys.NAVIGATION_FAILED;
|
|
50
|
-
import static com.steerpath.rnsmartmap.RNEventKeys.NAVIGATION_PREVIEW_APPEARED;
|
|
51
|
-
import static com.steerpath.rnsmartmap.RNEventKeys.NAVIGATION_STARTED;
|
|
52
|
-
import static com.steerpath.rnsmartmap.RNEventKeys.ON_BACK_PRESSED;
|
|
53
|
-
import static com.steerpath.rnsmartmap.RNEventKeys.SEARCH_CATEGORY_SELECTED;
|
|
54
|
-
import static com.steerpath.rnsmartmap.RNEventKeys.SEARCH_RESULT_SELECTED;
|
|
55
|
-
import static com.steerpath.rnsmartmap.RNEventKeys.USER_FLOOR_CHANGED;
|
|
56
|
-
import static com.steerpath.rnsmartmap.RNEventKeys.USER_TASK_RESPONSE;
|
|
57
|
-
import static com.steerpath.rnsmartmap.RNEventKeys.VIEW_STATUS_CHANGED;
|
|
58
|
-
import static com.steerpath.rnsmartmap.RNEventKeys.VISIBLE_FLOOR_CHANGED;
|
|
59
|
-
import static com.steerpath.rnsmartmap.Utils.convertJsonToWritableMap;
|
|
60
|
-
|
|
61
|
-
public class RNSmartMapView extends FrameLayout
|
|
62
|
-
implements MapEventListener, UserTaskListener, NavigationEventListener, ViewStatusListener {
|
|
63
|
-
|
|
64
|
-
private SmartMapFragment smartMap;
|
|
65
|
-
private ReactContext reactContext;
|
|
66
|
-
private RNSmartMapViewManager manager;
|
|
67
|
-
private ArrayList<String> addedIcons = new ArrayList<>();
|
|
68
|
-
|
|
69
|
-
public RNSmartMapView(ThemedReactContext context, ReactApplicationContext reactApplicationContext,
|
|
70
|
-
RNSmartMapViewManager mapViewManager) {
|
|
71
|
-
super(context);
|
|
72
|
-
|
|
73
|
-
SmartMapFragment fragment = SmartMapFragment.newInstance();
|
|
74
|
-
this.reactContext = reactApplicationContext;
|
|
75
|
-
this.manager = mapViewManager;
|
|
76
|
-
|
|
77
|
-
this.smartMap = fragment;
|
|
78
|
-
smartMap.setMapEventListener(this);
|
|
79
|
-
smartMap.setNavigationEventListener(this);
|
|
80
|
-
smartMap.setUserTaskListener(this);
|
|
81
|
-
smartMap.setViewStatusListener(this);
|
|
82
|
-
|
|
83
|
-
OnBackPressedCallback onBackPressedCallback = new OnBackPressedCallback(true) {
|
|
84
|
-
@Override
|
|
85
|
-
public void handleOnBackPressed() {
|
|
86
|
-
WritableMap map = new WritableNativeMap();
|
|
87
|
-
map.putBoolean("smartMapBackPressed", smartMap.onBackPressed());
|
|
88
|
-
manager.sendEvent(reactContext, RNSmartMapView.this, ON_BACK_PRESSED, map);
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
AppCompatActivity activity = (AppCompatActivity) context.getCurrentActivity();
|
|
93
|
-
activity.getSupportFragmentManager().beginTransaction().add(fragment, "tag").commit();
|
|
94
|
-
|
|
95
|
-
activity.getSupportFragmentManager().executePendingTransactions();
|
|
96
|
-
activity.getOnBackPressedDispatcher().addCallback(onBackPressedCallback);
|
|
97
|
-
addView(fragment.getView(), ViewGroup.LayoutParams.MATCH_PARENT);
|
|
98
|
-
|
|
99
|
-
drawChildViews();
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
private void drawChildViews() {
|
|
103
|
-
Choreographer.getInstance().postFrameCallback(new Choreographer.FrameCallback() {
|
|
104
|
-
@Override
|
|
105
|
-
public void doFrame(long l) {
|
|
106
|
-
for (int i = 0; i < RNSmartMapView.this.getChildCount(); i++) {
|
|
107
|
-
View child = RNSmartMapView.this.getChildAt(i);
|
|
108
|
-
child.measure(
|
|
109
|
-
MeasureSpec.makeMeasureSpec(RNSmartMapView.this.getMeasuredWidth(), MeasureSpec.EXACTLY),
|
|
110
|
-
MeasureSpec.makeMeasureSpec(RNSmartMapView.this.getMeasuredHeight(), MeasureSpec.EXACTLY));
|
|
111
|
-
child.layout(0, 0, child.getMeasuredWidth(), child.getMeasuredHeight());
|
|
112
|
-
|
|
113
|
-
RNSmartMapView.this.getViewTreeObserver().dispatchOnGlobalLayout();
|
|
114
|
-
Choreographer.getInstance().postFrameCallback(this);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
SmartMapFragment getMap() {
|
|
121
|
-
return smartMap;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* - - - - - MAP EVENTS - - - - -
|
|
126
|
-
*/
|
|
127
|
-
|
|
128
|
-
@Override
|
|
129
|
-
public boolean onMapClick(List<SmartMapObject> mapObjects) {
|
|
130
|
-
WritableArray array = new WritableNativeArray();
|
|
131
|
-
|
|
132
|
-
for (SmartMapObject object : mapObjects) {
|
|
133
|
-
array.pushMap(smartMapObjectToWritableMap(object));
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
WritableMap map = new WritableNativeMap();
|
|
137
|
-
map.putArray("mapObjects", array);
|
|
138
|
-
|
|
139
|
-
manager.sendEvent(reactContext, this, MAP_CLICKED, map);
|
|
140
|
-
return true;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
@Override
|
|
144
|
-
public boolean onSearchResultSelected(SmartMapObject mapObject) {
|
|
145
|
-
WritableMap map = new WritableNativeMap();
|
|
146
|
-
map.putMap("mapObject", smartMapObjectToWritableMap(mapObject));
|
|
147
|
-
manager.sendEvent(reactContext, this, SEARCH_RESULT_SELECTED, map);
|
|
148
|
-
return true;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
@Override
|
|
152
|
-
public void onSearchCategorySelected(JSONObject searchAction, List<SmartMapObject> searchResults) {
|
|
153
|
-
WritableMap payload = new WritableNativeMap();
|
|
154
|
-
WritableMap action = new WritableNativeMap();
|
|
155
|
-
try {
|
|
156
|
-
action = convertJsonToWritableMap(searchAction);
|
|
157
|
-
} catch (JSONException e) {
|
|
158
|
-
e.printStackTrace();
|
|
159
|
-
}
|
|
160
|
-
payload.putMap("searchAction", action);
|
|
161
|
-
WritableNativeArray list = new WritableNativeArray();
|
|
162
|
-
for (SmartMapObject obj : searchResults) {
|
|
163
|
-
list.pushMap(smartMapObjectToWritableMap(obj));
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
payload.putArray("searchResults", list);
|
|
167
|
-
manager.sendEvent(reactContext, this, SEARCH_CATEGORY_SELECTED, payload);
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
@Override
|
|
171
|
-
public void onMapLoaded() {
|
|
172
|
-
manager.sendEvent(reactContext, this, MAP_LOADED, new WritableNativeMap());
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
@Override
|
|
176
|
-
public void onUserFloorChanged(int floorIndex, String buildingRef) {
|
|
177
|
-
WritableMap map = new WritableNativeMap();
|
|
178
|
-
map.putInt("floorIndex", floorIndex);
|
|
179
|
-
map.putString("buildingRef", buildingRef);
|
|
180
|
-
|
|
181
|
-
manager.sendEvent(reactContext, this, USER_FLOOR_CHANGED, map);
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
@Override
|
|
185
|
-
public void onVisibleFloorChanged(int floorIndex, String buildingRef) {
|
|
186
|
-
WritableMap map = new WritableNativeMap();
|
|
187
|
-
map.putInt("floorIndex", floorIndex);
|
|
188
|
-
map.putString("buildingRef", buildingRef);
|
|
189
|
-
|
|
190
|
-
manager.sendEvent(reactContext, this, VISIBLE_FLOOR_CHANGED, map);
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
@Override
|
|
194
|
-
public void onUserTaskResponse(@NonNull UserTask userTask, String s) {
|
|
195
|
-
String response;
|
|
196
|
-
switch (s) {
|
|
197
|
-
case UserTaskResponse.BUSY:
|
|
198
|
-
response = "busy";
|
|
199
|
-
break;
|
|
200
|
-
case UserTaskResponse.ERROR:
|
|
201
|
-
response = "error";
|
|
202
|
-
break;
|
|
203
|
-
case UserTaskResponse.STARTED:
|
|
204
|
-
response = "started";
|
|
205
|
-
break;
|
|
206
|
-
case UserTaskResponse.CANCELLED:
|
|
207
|
-
response = "cancelled";
|
|
208
|
-
break;
|
|
209
|
-
case UserTaskResponse.COMPLETED:
|
|
210
|
-
response = "completed";
|
|
211
|
-
break;
|
|
212
|
-
case UserTaskResponse.UNSUPPORTED:
|
|
213
|
-
response = "unsupported";
|
|
214
|
-
break;
|
|
215
|
-
default:
|
|
216
|
-
response = "unknownUserTaskResponse";
|
|
217
|
-
break;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
WritableMap map = new WritableNativeMap();
|
|
221
|
-
map.putString("response", response);
|
|
222
|
-
|
|
223
|
-
WritableMap taskMap = new WritableNativeMap();
|
|
224
|
-
|
|
225
|
-
if (userTask instanceof NavigationUserTask) {
|
|
226
|
-
taskMap.putString("type", "navigation");
|
|
227
|
-
taskMap.putMap("payload",
|
|
228
|
-
smartMapObjectToWritableMap(((NavigationUserTask) userTask).getMapObjects().get(0)));
|
|
229
|
-
} else if (userTask instanceof POISelectionUserTask) {
|
|
230
|
-
taskMap.putString("type", "poiSelection");
|
|
231
|
-
WritableMap payload = new WritableNativeMap();
|
|
232
|
-
payload.putMap("smartMapObject",
|
|
233
|
-
smartMapObjectToWritableMap(((POISelectionUserTask) userTask).getMapObject()));
|
|
234
|
-
taskMap.putMap("payload", payload);
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
map.putMap("userTask", taskMap);
|
|
238
|
-
|
|
239
|
-
manager.sendEvent(reactContext, this, USER_TASK_RESPONSE, map);
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
/**
|
|
243
|
-
* - - - - - NAVIGATION EVENTS - - - - -
|
|
244
|
-
*/
|
|
245
|
-
|
|
246
|
-
@Override
|
|
247
|
-
public void onNavigationPreviewAppeared() {
|
|
248
|
-
manager.sendEvent(reactContext, this, NAVIGATION_PREVIEW_APPEARED, new WritableNativeMap());
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
@Override
|
|
252
|
-
public void onNavigationStarted() {
|
|
253
|
-
manager.sendEvent(reactContext, this, NAVIGATION_STARTED, new WritableNativeMap());
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
@Override
|
|
257
|
-
public void onNavigationEnded() {
|
|
258
|
-
manager.sendEvent(reactContext, this, NAVIGATION_ENDED, new WritableNativeMap());
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
@Override
|
|
262
|
-
public void onNavigationDestinationReached() {
|
|
263
|
-
manager.sendEvent(reactContext, this, NAVIGATION_DESTINATION_REACHED, new WritableNativeMap());
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
@Override
|
|
267
|
-
public void onNavigationFailed(String s) {
|
|
268
|
-
WritableMap map = new WritableNativeMap();
|
|
269
|
-
String error;
|
|
270
|
-
switch (s) {
|
|
271
|
-
case NavigationError.POI_NOT_FOUND:
|
|
272
|
-
error = "objectNotFound";
|
|
273
|
-
break;
|
|
274
|
-
case NavigationError.ROUTE_NOT_FOUND:
|
|
275
|
-
error = "routeNotFound";
|
|
276
|
-
break;
|
|
277
|
-
case NavigationError.USER_LOCATION_NOT_FOUND:
|
|
278
|
-
error = "userLocationNotFound";
|
|
279
|
-
break;
|
|
280
|
-
default:
|
|
281
|
-
error = s;
|
|
282
|
-
break;
|
|
283
|
-
}
|
|
284
|
-
map.putString("error", error);
|
|
285
|
-
manager.sendEvent(reactContext, this, NAVIGATION_FAILED, map);
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
/**
|
|
289
|
-
* - - - - - VIEW STATUS LISTENER - - - - -
|
|
290
|
-
*/
|
|
291
|
-
|
|
292
|
-
@Override
|
|
293
|
-
public void onViewStatusChanged(String s, SmartMapObject smartMapObject) {
|
|
294
|
-
WritableMap map = new WritableNativeMap();
|
|
295
|
-
String status;
|
|
296
|
-
switch (s) {
|
|
297
|
-
case ViewStatus.CARD_VIEW:
|
|
298
|
-
status = "cardView";
|
|
299
|
-
break;
|
|
300
|
-
case ViewStatus.ERROR_VIEW:
|
|
301
|
-
status = "errorView";
|
|
302
|
-
break;
|
|
303
|
-
case ViewStatus.SETTINGS_VIEW:
|
|
304
|
-
status = "settingView";
|
|
305
|
-
break;
|
|
306
|
-
case ViewStatus.MAP_ONLY:
|
|
307
|
-
status = "onlyMap";
|
|
308
|
-
break;
|
|
309
|
-
case ViewStatus.NAVIGATION_VIEW:
|
|
310
|
-
status = "navigatingView";
|
|
311
|
-
break;
|
|
312
|
-
case ViewStatus.SEARCH_VIEW:
|
|
313
|
-
status = "searchView";
|
|
314
|
-
break;
|
|
315
|
-
default:
|
|
316
|
-
status = "mapOnly";
|
|
317
|
-
break;
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
if (smartMapObject != null) {
|
|
321
|
-
map.putMap("smartMapObject", smartMapObjectToWritableMap(smartMapObject));
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
map.putString("status", status);
|
|
325
|
-
manager.sendEvent(reactContext, this, VIEW_STATUS_CHANGED, map);
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
@Override
|
|
329
|
-
public void onBottomSheetStateChanged(int status) {
|
|
330
|
-
WritableMap map = new WritableNativeMap();
|
|
331
|
-
switch (status) {
|
|
332
|
-
case BottomSheetViewState.HIDDEN:
|
|
333
|
-
map.putString("state", "hidden");
|
|
334
|
-
break;
|
|
335
|
-
case BottomSheetViewState.COLLAPSED:
|
|
336
|
-
map.putString("state", "collapsed");
|
|
337
|
-
break;
|
|
338
|
-
case BottomSheetViewState.HALF_EXPANDED:
|
|
339
|
-
map.putString("state", "halfExpanded");
|
|
340
|
-
break;
|
|
341
|
-
case BottomSheetViewState.EXPANDED:
|
|
342
|
-
map.putString("state", "expanded");
|
|
343
|
-
break;
|
|
344
|
-
default:
|
|
345
|
-
map.putString("state", "unknownStatus");
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
manager.sendEvent(reactContext, this, BOTTOMSHEET_STATE_CHANGED, map);
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
/**
|
|
352
|
-
* - - - - - PUBLIC METHODS - - - - -
|
|
353
|
-
*/
|
|
354
|
-
|
|
355
|
-
public void addMarker(double lat, double lon, int floorIndex, String localRef, String buildingRef, String layout,
|
|
356
|
-
@Nullable String iconImage, String rgbTextColor, String rgbTextHaloColor) {
|
|
357
|
-
|
|
358
|
-
if (!addedIcons.contains(iconImage)) {
|
|
359
|
-
int resId = this.getResources().getIdentifier(iconImage, "drawable", getContext().getPackageName());
|
|
360
|
-
smartMap.addIconImage(iconImage, resId);
|
|
361
|
-
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
SmartMapObject smartMapObject = new SmartMapObject(lat, lon, floorIndex, localRef, buildingRef);
|
|
365
|
-
if (layout == null && rgbTextColor == null && rgbTextHaloColor == null) {
|
|
366
|
-
smartMap.addMarker(smartMapObject);
|
|
367
|
-
} else {
|
|
368
|
-
smartMap.addMarker(smartMapObject, layout, iconImage, rgbTextColor, rgbTextHaloColor);
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
public void addMarkers(List<SmartMapObject> objects, @Layout String layout, String iconName, String rgbTextColor,
|
|
373
|
-
String rgbTextHaloColor) {
|
|
374
|
-
if (layout == null && rgbTextColor == null && rgbTextHaloColor == null) {
|
|
375
|
-
smartMap.addMarkers(objects);
|
|
376
|
-
} else {
|
|
377
|
-
smartMap.addMarkers(objects, layout, iconName, rgbTextColor, rgbTextHaloColor);
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
public void animateCamera(double latitude, double longitude, double zoomLevel, double bearing, double pitch,
|
|
382
|
-
int floorIndex, String buildingRef) {
|
|
383
|
-
smartMap.animateCamera(latitude, longitude, zoomLevel, bearing, pitch, floorIndex, buildingRef);
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
public void cancelCurrentUserTask() {
|
|
387
|
-
smartMap.cancelCurrentUserTask();
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
public void removeAllMarkers() {
|
|
391
|
-
smartMap.removeAllMarkers();
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
public void removeMarker(double lat, double lon, int floorIndex, String localRef, String buildingRef) {
|
|
395
|
-
smartMap.removeMarker(new SmartMapObject(lat, lon, floorIndex, localRef, buildingRef));
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
public void removeMarkers(List<SmartMapObject> smartMapObjects) {
|
|
399
|
-
smartMap.removeMarkers(smartMapObjects);
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
public void selectMapObject(SmartMapObject mapObject) {
|
|
403
|
-
smartMap.selectMapObject(mapObject);
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
public void setCamera(double latitude, double longitude, double zoomLevel, double bearing, double pitch,
|
|
407
|
-
int floorIndex, String buildingRef) {
|
|
408
|
-
smartMap.setCamera(latitude, longitude, zoomLevel, bearing, pitch, floorIndex, buildingRef);
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
public void setMapMode(String mapMode) {
|
|
412
|
-
smartMap.setMapMode(mapMode);
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
public void startNavigationUserTask(double lat, double lon, int floorIndex, String localRef, String buildingRef) {
|
|
416
|
-
smartMap.startUserTask(new NavigationUserTask(new SmartMapObject(lat, lon, floorIndex, localRef, buildingRef)));
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
public void startPoiSelectionUserTask(String localRef, String buildingRef, String source, boolean addMarker,
|
|
420
|
-
String actionButtonText, String actionButtonIcon) {
|
|
421
|
-
|
|
422
|
-
String objectSource;
|
|
423
|
-
int resId = 0;
|
|
424
|
-
|
|
425
|
-
try {
|
|
426
|
-
resId = this.getResources().getIdentifier(actionButtonIcon, "drawable", getContext().getPackageName());
|
|
427
|
-
} catch (NullPointerException e) {
|
|
428
|
-
Log.w("RNSmartMapView", "Couldn't find resource for actionButtonIcon");
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
if (source.toLowerCase().equals("marker")) {
|
|
432
|
-
objectSource = ObjectSource.MARKER;
|
|
433
|
-
} else {
|
|
434
|
-
objectSource = ObjectSource.STATIC;
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
int finalResId = resId;
|
|
438
|
-
smartMap.getMapObject(localRef, buildingRef, objectSource, (smartMapObject, s) -> {
|
|
439
|
-
if (smartMapObject != null) {
|
|
440
|
-
smartMap.startUserTask(
|
|
441
|
-
new POISelectionUserTask(smartMapObject, addMarker, actionButtonText, finalResId));
|
|
442
|
-
}
|
|
443
|
-
});
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
public void setWidgetPadding(int left, int top, int right, int bottom) {
|
|
447
|
-
smartMap.setWidgetPadding(left, top, right, bottom);
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
/**
|
|
451
|
-
* - - - - - PRIVATE METHODS - - - - -
|
|
452
|
-
*/
|
|
453
|
-
|
|
454
|
-
WritableMap smartMapObjectToWritableMap(SmartMapObject object) {
|
|
455
|
-
WritableMap map = new WritableNativeMap();
|
|
456
|
-
try {
|
|
457
|
-
map.putMap("properties", convertJsonToWritableMap(object.getProperties()));
|
|
458
|
-
} catch (JSONException e) {
|
|
459
|
-
e.printStackTrace();
|
|
460
|
-
}
|
|
461
|
-
map.putString("source", object.getSource());
|
|
462
|
-
map.putDouble("longitude", object.getLongitude());
|
|
463
|
-
map.putDouble("latitude", object.getLatitude());
|
|
464
|
-
map.putInt("floorIndex", object.getFloorIndex());
|
|
465
|
-
map.putString("buildingRef", object.getBuildingRef());
|
|
466
|
-
map.putString("localRef", object.getLocalRef());
|
|
467
|
-
map.putString("title", object.getTitle());
|
|
468
|
-
return map;
|
|
469
|
-
}
|
|
470
|
-
}
|