|
24 | 24 | import com.instabug.library.invocation.InstabugInvocationEvent; |
25 | 25 | import com.instabug.library.invocation.InstabugInvocationMode; |
26 | 26 | import com.instabug.library.InstabugColorTheme; |
| 27 | +import com.instabug.library.invocation.util.InstabugVideoRecordingButtonCorner; |
27 | 28 | import com.instabug.library.logging.InstabugLog; |
28 | 29 | import com.instabug.library.bugreporting.model.ReportCategory; |
29 | 30 | import com.instabug.library.InstabugCustomTextPlaceHolder; |
@@ -79,6 +80,12 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule { |
79 | 80 | private final String LOCALE_SWEDISH = "swedish"; |
80 | 81 | private final String LOCALE_TURKISH = "turkish"; |
81 | 82 |
|
| 83 | + //Instabug Button Corner |
| 84 | + private final String TOP_RIGHT = "topRight"; |
| 85 | + private final String TOP_LEFT = "topLeft"; |
| 86 | + private final String BOTTOM_RIGHT = "bottomRight"; |
| 87 | + private final String BOTTOM_LEFT = "bottomLeft"; |
| 88 | + |
82 | 89 | //Theme colors |
83 | 90 | private final String COLOR_THEME_LIGHT = "light"; |
84 | 91 | private final String COLOR_THEME_DARK = "dark"; |
@@ -240,6 +247,20 @@ public void changeLocale(String instabugLocale) { |
240 | 247 | } |
241 | 248 | } |
242 | 249 |
|
| 250 | + /** |
| 251 | + * Sets the default corner at which the video recording floating button will be shown |
| 252 | + * |
| 253 | + * @param corner corner to stick the video recording floating button to |
| 254 | + */ |
| 255 | + @ReactMethod |
| 256 | + public void setVideoRecordingFloatingButtonPosition(String corner) { |
| 257 | + try { |
| 258 | + mInstabug.setVideoRecordingFloatingButtonCorner(getVideoRecordingButtonCorner(corner)); |
| 259 | + } catch (Exception e) { |
| 260 | + e.printStackTrace(); |
| 261 | + } |
| 262 | + } |
| 263 | + |
243 | 264 | /** |
244 | 265 | * The file at filePath will be uploaded along upcoming reports with the name |
245 | 266 | * fileNameWithExtension |
@@ -527,11 +548,10 @@ private InstabugInvocationEvent getInvocationEventById(String invocationEventVal |
527 | 548 | invocationEvent = InstabugInvocationEvent.NONE; |
528 | 549 | } |
529 | 550 |
|
530 | | - return invocationEvent; |
531 | 551 | } catch (Exception e) { |
532 | 552 | e.printStackTrace(); |
533 | | - return invocationEvent; |
534 | 553 | } |
| 554 | + return invocationEvent; |
535 | 555 | } |
536 | 556 |
|
537 | 557 | /** |
@@ -1211,6 +1231,25 @@ private InstabugCustomTextPlaceHolder.Key getStringToKeyConstant(String key) { |
1211 | 1231 | } |
1212 | 1232 | } |
1213 | 1233 |
|
| 1234 | + private InstabugVideoRecordingButtonCorner getVideoRecordingButtonCorner(String cornerValue) { |
| 1235 | + InstabugVideoRecordingButtonCorner corner = InstabugVideoRecordingButtonCorner.BOTTOM_RIGHT; |
| 1236 | + try { |
| 1237 | + if (cornerValue.equals(BOTTOM_RIGHT)) { |
| 1238 | + corner = InstabugVideoRecordingButtonCorner.BOTTOM_RIGHT; |
| 1239 | + } else if (cornerValue.equals(BOTTOM_LEFT)) { |
| 1240 | + corner = InstabugVideoRecordingButtonCorner.BOTTOM_LEFT; |
| 1241 | + } else if (cornerValue.equals(TOP_LEFT)) { |
| 1242 | + corner = InstabugVideoRecordingButtonCorner.TOP_LEFT; |
| 1243 | + } else if (cornerValue.equals(TOP_RIGHT)) { |
| 1244 | + corner = InstabugVideoRecordingButtonCorner.TOP_RIGHT; |
| 1245 | + } |
| 1246 | + |
| 1247 | + } catch (Exception e) { |
| 1248 | + e.printStackTrace(); |
| 1249 | + } |
| 1250 | + return corner; |
| 1251 | + } |
| 1252 | + |
1214 | 1253 | private Locale getLocaleByKey(String instabugLocale) { |
1215 | 1254 | String localeInLowerCase = instabugLocale.toLowerCase(); |
1216 | 1255 | switch (localeInLowerCase) { |
@@ -1275,7 +1314,7 @@ private void sendEvent(ReactApplicationContext reactContext, |
1275 | 1314 | .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class) |
1276 | 1315 | .emit(eventName, params); |
1277 | 1316 | } |
1278 | | - |
| 1317 | + |
1279 | 1318 | @Override |
1280 | 1319 | public Map<String, Object> getConstants() { |
1281 | 1320 | final Map<String, Object> constants = new HashMap<>(); |
@@ -1313,6 +1352,11 @@ public Map<String, Object> getConstants() { |
1313 | 1352 | constants.put("localeSwedish", LOCALE_SWEDISH); |
1314 | 1353 | constants.put("localeTurkish", LOCALE_TURKISH); |
1315 | 1354 |
|
| 1355 | + constants.put("topRight", TOP_RIGHT); |
| 1356 | + constants.put("topLeft", TOP_LEFT); |
| 1357 | + constants.put("bottomRight", BOTTOM_RIGHT); |
| 1358 | + constants.put("bottomLeft", BOTTOM_LEFT); |
| 1359 | + |
1316 | 1360 | constants.put("shakeHint", SHAKE_HINT); |
1317 | 1361 | constants.put("swipeHint", SWIPE_HINT); |
1318 | 1362 | constants.put("invalidEmailMessage", INVALID_EMAIL_MESSAGE); |
@@ -1340,4 +1384,3 @@ public Map<String, Object> getConstants() { |
1340 | 1384 | return constants; |
1341 | 1385 | } |
1342 | 1386 | } |
1343 | | - |
|
0 commit comments