|
12 | 12 | import com.facebook.react.bridge.ReactMethod;
|
13 | 13 | import com.facebook.react.bridge.ReadableArray;
|
14 | 14 | import com.facebook.react.bridge.ReadableMap;
|
| 15 | +import com.facebook.react.bridge.ReadableType; |
15 | 16 | import com.facebook.react.bridge.WritableArray;
|
16 | 17 | import com.facebook.react.bridge.WritableNativeArray;
|
17 | 18 | import com.facebook.react.bridge.WritableMap;
|
|
73 | 74 | import java.util.Locale;
|
74 | 75 | import java.util.Map;
|
75 | 76 |
|
| 77 | +import static com.instabug.reactlibrary.utils.InstabugUtil.getMethod; |
| 78 | + |
76 | 79 |
|
77 | 80 | /**
|
78 | 81 | * The type Rn instabug reactnative module.
|
@@ -490,7 +493,7 @@ public void setCrashReportingEnabled(boolean isEnabled) {
|
490 | 493 | private void sendJSCrashByReflection(String exceptionObject, boolean isHandled) {
|
491 | 494 | try {
|
492 | 495 | JSONObject newJSONObject = new JSONObject(exceptionObject);
|
493 |
| - Method method = InstabugUtil.getMethod(Class.forName("com.instabug.crash.CrashReporting"), "reportException", JSONObject.class, boolean.class); |
| 496 | + Method method = getMethod(Class.forName("com.instabug.crash.CrashReporting"), "reportException", JSONObject.class, boolean.class); |
494 | 497 | if (method != null) {
|
495 | 498 | method.invoke(null, newJSONObject, isHandled);
|
496 | 499 | }
|
@@ -541,24 +544,6 @@ public void run() {
|
541 | 544 | });
|
542 | 545 | }
|
543 | 546 |
|
544 |
| - /** |
545 |
| - * Sets whether attachments in bug reporting and in-app messaging are enabled or not. |
546 |
| - * |
547 |
| - * @param screenshot A boolean to enable or disable screenshot attachments. |
548 |
| - * @param {boolean} extraScreenShot A boolean to enable or disable extra screenshot attachments. |
549 |
| - * @param {boolean} galleryImage A boolean to enable or disable gallery image attachments. |
550 |
| - * @param {boolean} screenRecording A boolean to enable or disable screen recording attachments. |
551 |
| - */ |
552 |
| - @ReactMethod |
553 |
| - public void setEnabledAttachmentTypes(boolean screenshot, boolean extraScreenshot, boolean |
554 |
| - galleryImage, boolean screenRecording) { |
555 |
| - try { |
556 |
| - BugReporting.setAttachmentTypesEnabled(screenshot, extraScreenshot, galleryImage, |
557 |
| - screenRecording); |
558 |
| - } catch (Exception e) { |
559 |
| - e.printStackTrace(); |
560 |
| - } |
561 |
| - } |
562 | 547 |
|
563 | 548 | /**
|
564 | 549 | * Sets whether attachments in bug reporting and in-app messaging are enabled or not.
|
@@ -1904,6 +1889,30 @@ public void setEmailFieldRequiredForFeatureRequests(boolean isEmailRequired, Rea
|
1904 | 1889 | }
|
1905 | 1890 | }
|
1906 | 1891 |
|
| 1892 | + @ReactMethod |
| 1893 | + public void setSecureViews(ReadableArray ids) { |
| 1894 | + int[] arrayOfIds = new int[ids.size()]; |
| 1895 | + for (int i = 0; i < ids.size(); i++) { |
| 1896 | + int viewId = (int) ids.getDouble(i); |
| 1897 | + arrayOfIds[i] = viewId; |
| 1898 | + } |
| 1899 | + Method method = null; |
| 1900 | + try { |
| 1901 | + method = InstabugUtil.getMethod(Class.forName("com.instabug.library.Instabug"), "setSecureViewsId", int[].class); |
| 1902 | + } catch (ClassNotFoundException e) { |
| 1903 | + e.printStackTrace(); |
| 1904 | + } |
| 1905 | + if (method != null) { |
| 1906 | + try { |
| 1907 | + method.invoke(null, arrayOfIds); |
| 1908 | + } catch (IllegalAccessException e) { |
| 1909 | + e.printStackTrace(); |
| 1910 | + } catch (InvocationTargetException e) { |
| 1911 | + e.printStackTrace(); |
| 1912 | + } |
| 1913 | + } |
| 1914 | + } |
| 1915 | + |
1907 | 1916 | private InstabugCustomTextPlaceHolder.Key getStringToKeyConstant(String key) {
|
1908 | 1917 | switch (key) {
|
1909 | 1918 | case SHAKE_HINT:
|
|
0 commit comments