|
41 | 41 | import com.instabug.library.invocation.util.InstabugVideoRecordingButtonPosition;
|
42 | 42 | import com.instabug.library.logging.InstabugLog;
|
43 | 43 | import com.instabug.library.bugreporting.model.ReportCategory;
|
| 44 | +import com.instabug.library.ui.onboarding.WelcomeMessage; |
44 | 45 | import com.instabug.library.InstabugCustomTextPlaceHolder;
|
45 | 46 | import com.instabug.library.model.Report;
|
46 | 47 | import com.instabug.library.user.UserEventParam;
|
@@ -125,6 +126,11 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
|
125 | 126 | private final String ENABLED = "enabled";
|
126 | 127 | private final String DISABLED = "disabled";
|
127 | 128 |
|
| 129 | + //Instabug welcome message modes |
| 130 | + private final String WELCOME_MESSAGE_MODE_LIVE = "welcomeMessageModeLive"; |
| 131 | + private final String WELCOME_MESSAGE_MODE_BETA = "welcomeMessageModeBeta"; |
| 132 | + private final String WELCOME_MESSAGE_MODE_DISABLED = "welcomeMessageModeDisabled"; |
| 133 | + |
128 | 134 | //Theme colors
|
129 | 135 | private final String COLOR_THEME_LIGHT = "light";
|
130 | 136 | private final String COLOR_THEME_DARK = "dark";
|
@@ -1537,6 +1543,59 @@ public void setReproStepsMode(String reproStepsMode) {
|
1537 | 1543 | }
|
1538 | 1544 | }
|
1539 | 1545 |
|
| 1546 | + /** |
| 1547 | + * Shows the welcome message in a specific mode. |
| 1548 | + * |
| 1549 | + * @param welcomeMessageMode An enum to set the welcome message mode to |
| 1550 | + * live, or beta. |
| 1551 | + */ |
| 1552 | + @ReactMethod |
| 1553 | + public void showWelcomeMessageWithMode(String welcomeMessageMode) { |
| 1554 | + try { |
| 1555 | + switch (welcomeMessageMode) { |
| 1556 | + case WELCOME_MESSAGE_MODE_LIVE: |
| 1557 | + Instabug.showWelcomeMessage(WelcomeMessage.State.LIVE); |
| 1558 | + break; |
| 1559 | + case WELCOME_MESSAGE_MODE_BETA: |
| 1560 | + Instabug.showWelcomeMessage(WelcomeMessage.State.BETA); |
| 1561 | + break; |
| 1562 | + default: |
| 1563 | + Instabug.showWelcomeMessage(WelcomeMessage.State.LIVE); |
| 1564 | + } |
| 1565 | + |
| 1566 | + } catch (Exception e) { |
| 1567 | + e.printStackTrace(); |
| 1568 | + } |
| 1569 | + } |
| 1570 | + |
| 1571 | + /** |
| 1572 | + * Sets the welcome message mode to live, beta or disabled. |
| 1573 | + * |
| 1574 | + * @param welcomeMessageMode An enum to set the welcome message mode to |
| 1575 | + * live, beta or disabled. |
| 1576 | + */ |
| 1577 | + @ReactMethod |
| 1578 | + public void setWelcomeMessageMode(String welcomeMessageMode) { |
| 1579 | + try { |
| 1580 | + switch (welcomeMessageMode) { |
| 1581 | + case WELCOME_MESSAGE_MODE_LIVE: |
| 1582 | + Instabug.showWelcomeMessage(WelcomeMessage.State.LIVE); |
| 1583 | + break; |
| 1584 | + case WELCOME_MESSAGE_MODE_BETA: |
| 1585 | + Instabug.showWelcomeMessage(WelcomeMessage.State.BETA); |
| 1586 | + break; |
| 1587 | + case WELCOME_MESSAGE_MODE_DISABLED: |
| 1588 | + Instabug.showWelcomeMessage(WelcomeMessage.State.DISABLED); |
| 1589 | + break; |
| 1590 | + default: |
| 1591 | + Instabug.showWelcomeMessage(WelcomeMessage.State.LIVE); |
| 1592 | + } |
| 1593 | + |
| 1594 | + } catch (Exception e) { |
| 1595 | + e.printStackTrace(); |
| 1596 | + } |
| 1597 | + } |
| 1598 | + |
1540 | 1599 | /**
|
1541 | 1600 | * Sets the threshold value of the shake gesture for android devices.
|
1542 | 1601 | * Default for android is an integer value equals 350.
|
@@ -1948,6 +2007,10 @@ public Map<String, Object> getConstants() {
|
1948 | 2007 | constants.put("reproStepsEnabled", ENABLED);
|
1949 | 2008 | constants.put("reproStepsDisabled", DISABLED);
|
1950 | 2009 |
|
| 2010 | + constants.put("welcomeMessageModeLive", WELCOME_MESSAGE_MODE_LIVE); |
| 2011 | + constants.put("welcomeMessageModeBeta", WELCOME_MESSAGE_MODE_BETA); |
| 2012 | + constants.put("welcomeMessageModeDisabled", WELCOME_MESSAGE_MODE_DISABLED); |
| 2013 | + |
1951 | 2014 | constants.put("allActions", ACTION_TYPE_ALL_ACTIONS);
|
1952 | 2015 | constants.put("reportBugAction", ACTION_TYPE_REPORT_BUG);
|
1953 | 2016 | constants.put("requestNewFeature", ACTION_TYPE_REQUEST_NEW_FEATURE);
|
|
0 commit comments