|
74 | 74 | */ |
75 | 75 | public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule { |
76 | 76 |
|
| 77 | + private static final String TAG = RNInstabugReactnativeModule.class.getSimpleName(); |
| 78 | + |
77 | 79 | //InvocationEvents |
78 | 80 | private final String INVOCATION_EVENT_NONE = "none"; |
79 | 81 | private final String INVOCATION_EVENT_SHAKE = "shake"; |
@@ -769,31 +771,37 @@ public void setInvocationEvent(String invocationEventValue) { |
769 | 771 | */ |
770 | 772 | @ReactMethod |
771 | 773 | public void setInvocationEvents(ReadableArray invocationEventValues) { |
| 774 | + |
772 | 775 | try { |
773 | 776 | Object[] objectArray = ArrayUtil.toArray(invocationEventValues); |
774 | 777 | String[] stringArray = Arrays.copyOf(objectArray, objectArray.length, String[].class); |
| 778 | + ArrayList<InstabugInvocationEvent> parsedInvocationEvents = new ArrayList<>(); |
| 779 | + |
| 780 | + Log.d(TAG, Arrays.toString(stringArray) + " " + INVOCATION_EVENT_FLOATING_BUTTON); |
| 781 | + |
775 | 782 | for (String action : stringArray) { |
776 | 783 | switch (action) { |
777 | 784 | case INVOCATION_EVENT_FLOATING_BUTTON: |
778 | | - BugReporting.setInvocationEvents(InstabugInvocationEvent.FLOATING_BUTTON); |
779 | | - return; |
| 785 | + parsedInvocationEvents.add(InstabugInvocationEvent.FLOATING_BUTTON); |
| 786 | + break; |
780 | 787 | case INVOCATION_EVENT_TWO_FINGERS_SWIPE: |
781 | | - BugReporting.setInvocationEvents(InstabugInvocationEvent.TWO_FINGER_SWIPE_LEFT); |
| 788 | + parsedInvocationEvents.add(InstabugInvocationEvent.TWO_FINGER_SWIPE_LEFT); |
782 | 789 | break; |
783 | 790 | case INVOCATION_EVENT_SHAKE: |
784 | | - BugReporting.setInvocationEvents(InstabugInvocationEvent.SHAKE); |
| 791 | + parsedInvocationEvents.add(InstabugInvocationEvent.SHAKE); |
785 | 792 | break; |
786 | 793 | case INVOCATION_EVENT_SCREENSHOT: |
787 | | - BugReporting.setInvocationEvents(InstabugInvocationEvent.SCREENSHOT_GESTURE); |
| 794 | + parsedInvocationEvents.add(InstabugInvocationEvent.SCREENSHOT_GESTURE); |
788 | 795 | break; |
789 | 796 | case INVOCATION_EVENT_NONE: |
790 | | - BugReporting.setInvocationEvents(InstabugInvocationEvent.NONE); |
| 797 | + parsedInvocationEvents.add(InstabugInvocationEvent.NONE); |
791 | 798 | break; |
792 | 799 | default: |
793 | | - BugReporting.setInvocationEvents(InstabugInvocationEvent.SHAKE); |
| 800 | + parsedInvocationEvents.add(InstabugInvocationEvent.SHAKE); |
794 | 801 | break; |
795 | 802 | } |
796 | 803 | } |
| 804 | + BugReporting.setInvocationEvents(parsedInvocationEvents.toArray(new InstabugInvocationEvent[0])); |
797 | 805 | } catch (Exception e) { |
798 | 806 | e.printStackTrace(); |
799 | 807 | } |
|
0 commit comments