32
32
import com .instabug .featuresrequest .ActionType ;
33
33
import com .instabug .library .Feature ;
34
34
import com .instabug .library .Instabug ;
35
+ import com .instabug .library .InstabugState ;
35
36
import com .instabug .library .OnSdkDismissCallback ;
36
37
import com .instabug .library .extendedbugreport .ExtendedBugReport ;
37
38
import com .instabug .library .internal .module .InstabugLocale ;
@@ -471,9 +472,9 @@ public void sendHandledJSCrash(String exceptionObject) {
471
472
public void setCrashReportingEnabled (boolean isEnabled ) {
472
473
try {
473
474
if (isEnabled ) {
474
- Instabug . setCrashReportingState (Feature .State .ENABLED );
475
+ CrashReporting . setState (Feature .State .ENABLED );
475
476
} else {
476
- Instabug . setCrashReportingState (Feature .State .DISABLED );
477
+ CrashReporting . setState (Feature .State .DISABLED );
477
478
}
478
479
} catch (Exception e ) {
479
480
e .printStackTrace ();
@@ -608,11 +609,16 @@ public boolean isEnabled() {
608
609
*/
609
610
@ ReactMethod
610
611
public void enable () {
611
- try {
612
- mInstabug .enable ();
613
- } catch (Exception e ) {
614
- e .printStackTrace ();
615
- }
612
+ new Handler (Looper .getMainLooper ()).post (new Runnable () {
613
+ @ Override
614
+ public void run () {
615
+ try {
616
+ Instabug .setState (InstabugState .ENABLED );
617
+ } catch (Exception e ) {
618
+ e .printStackTrace ();
619
+ }
620
+ }
621
+ });
616
622
}
617
623
618
624
/**
@@ -1584,12 +1590,22 @@ public void setReportTypes(ReadableArray types) {
1584
1590
}
1585
1591
1586
1592
@ ReactMethod
1587
- public void setBugReportingEnabled (boolean isEnabled ) {
1588
- if (isEnabled ) {
1589
- BugReporting .setState (Feature .State .ENABLED );
1590
- } else {
1591
- BugReporting .setState (Feature .State .DISABLED );
1592
- }
1593
+ public void setBugReportingEnabled (final boolean isEnabled ) {
1594
+ new Handler (Looper .getMainLooper ()).post (new Runnable () {
1595
+ @ Override
1596
+ public void run () {
1597
+ try {
1598
+ if (isEnabled ) {
1599
+ BugReporting .setState (Feature .State .ENABLED );
1600
+ } else {
1601
+ BugReporting .setState (Feature .State .DISABLED );
1602
+ }
1603
+ } catch (Exception e ) {
1604
+ e .printStackTrace ();
1605
+ }
1606
+ }
1607
+ });
1608
+
1593
1609
}
1594
1610
1595
1611
@ ReactMethod
@@ -1607,12 +1623,21 @@ public void showBugReportingWithReportTypeAndOptions(String reportType, Readable
1607
1623
}
1608
1624
1609
1625
@ ReactMethod
1610
- public void setChatsEnabled (boolean isEnabled ) {
1611
- if (isEnabled ) {
1612
- Chats .setState (Feature .State .ENABLED );
1613
- } else {
1614
- Chats .setState (Feature .State .DISABLED );
1615
- }
1626
+ public void setChatsEnabled (final boolean isEnabled ) {
1627
+ new Handler (Looper .getMainLooper ()).post (new Runnable () {
1628
+ @ Override
1629
+ public void run () {
1630
+ try {
1631
+ if (isEnabled ) {
1632
+ Chats .setState (Feature .State .ENABLED );
1633
+ } else {
1634
+ Chats .setState (Feature .State .DISABLED );
1635
+ }
1636
+ } catch (Exception e ) {
1637
+ e .printStackTrace ();
1638
+ }
1639
+ }
1640
+ });
1616
1641
}
1617
1642
1618
1643
@ ReactMethod
@@ -1621,12 +1646,21 @@ public void showChats() {
1621
1646
}
1622
1647
1623
1648
@ ReactMethod
1624
- public void setRepliesEnabled (boolean isEnabled ) {
1625
- if (isEnabled ) {
1626
- Replies .setState (Feature .State .ENABLED );
1627
- } else {
1628
- Replies .setState (Feature .State .DISABLED );
1629
- }
1649
+ public void setRepliesEnabled (final boolean isEnabled ) {
1650
+ new Handler (Looper .getMainLooper ()).post (new Runnable () {
1651
+ @ Override
1652
+ public void run () {
1653
+ try {
1654
+ if (isEnabled ) {
1655
+ Replies .setState (Feature .State .ENABLED );
1656
+ } else {
1657
+ Replies .setState (Feature .State .DISABLED );
1658
+ }
1659
+ } catch (Exception e ) {
1660
+ e .printStackTrace ();
1661
+ }
1662
+ }
1663
+ });
1630
1664
}
1631
1665
1632
1666
@ ReactMethod
@@ -2099,4 +2133,4 @@ public Map<String, Object> getConstants() {
2099
2133
2100
2134
return constants ;
2101
2135
}
2102
- }
2136
+ }
0 commit comments