Skip to content

Commit 27a7d85

Browse files
SalmaAliSalmaAli
authored andcommitted
Merge branch 'master' of https://github.com/Instabug/instabug-reactnative-private into feature/new_public_apis
# Conflicts: # android/build.gradle # index.js # ios/RNInstabug/InstabugReactBridge.m
2 parents 1309390 + 1be7ddd commit 27a7d85

File tree

6 files changed

+114
-4
lines changed

6 files changed

+114
-4
lines changed

android/build.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,4 @@ dependencies {
2424
compile ('com.instabug.library:instabug:8.0.1'){
2525
exclude group: 'com.android.support:appcompat-v7'
2626
}
27-
2827
}

android/src/main/java/com/instabug/reactlibrary/RNInstabugReactnativeModule.java

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
import com.instabug.library.invocation.util.InstabugVideoRecordingButtonPosition;
4242
import com.instabug.library.logging.InstabugLog;
4343
import com.instabug.library.bugreporting.model.ReportCategory;
44+
import com.instabug.library.ui.onboarding.WelcomeMessage;
4445
import com.instabug.library.InstabugCustomTextPlaceHolder;
4546
import com.instabug.library.model.Report;
4647
import com.instabug.library.user.UserEventParam;
@@ -125,6 +126,11 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
125126
private final String ENABLED = "enabled";
126127
private final String DISABLED = "disabled";
127128

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+
128134
//Theme colors
129135
private final String COLOR_THEME_LIGHT = "light";
130136
private final String COLOR_THEME_DARK = "dark";
@@ -1537,6 +1543,59 @@ public void setReproStepsMode(String reproStepsMode) {
15371543
}
15381544
}
15391545

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+
15401599
/**
15411600
* Sets the threshold value of the shake gesture for android devices.
15421601
* Default for android is an integer value equals 350.
@@ -1948,6 +2007,10 @@ public Map<String, Object> getConstants() {
19482007
constants.put("reproStepsEnabled", ENABLED);
19492008
constants.put("reproStepsDisabled", DISABLED);
19502009

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+
19512014
constants.put("allActions", ACTION_TYPE_ALL_ACTIONS);
19522015
constants.put("reportBugAction", ACTION_TYPE_REPORT_BUG);
19532016
constants.put("requestNewFeature", ACTION_TYPE_REQUEST_NEW_FEATURE);

index.js

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,6 @@ module.exports = {
373373
},
374374

375375
/**
376-
* @deprecated since version 2.3.0. Use {@link setEnabledAttachmentTypes} instead.
377376
* Sets whether users are required to enter an email address or not when
378377
* sending reports.
379378
* Defaults to YES.
@@ -1108,6 +1107,26 @@ module.exports = {
11081107
Instabug.setShouldShowSurveysWelcomeScreen(shouldShowWelcomeScreen);
11091108
},
11101109

1110+
/**
1111+
* Shows the welcome message in a specific mode.
1112+
* @param welcomeMessageMode An enum to set the welcome message mode to
1113+
* live, or beta.
1114+
*
1115+
*/
1116+
showWelcomeMessage: function(welcomeMessageMode) {
1117+
Instabug.showWelcomeMessageWithMode(welcomeMessageMode);
1118+
},
1119+
1120+
/**
1121+
* Sets the welcome message mode to live, beta or disabled.
1122+
* @param welcomeMessageMode An enum to set the welcome message mode to
1123+
* live, beta or disabled.
1124+
*
1125+
*/
1126+
setWelcomeMessageMode: function(welcomeMessageMode) {
1127+
Instabug.setWelcomeMessageMode(welcomeMessageMode);
1128+
},
1129+
11111130
/**
11121131
* The event used to invoke the feedback form
11131132
* @readonly
@@ -1262,6 +1281,17 @@ module.exports = {
12621281
topLeft: Instabug.topLeft
12631282
},
12641283

1284+
/**
1285+
* The welcome message mode.
1286+
* @readonly
1287+
* @enum {number}
1288+
*/
1289+
welcomeMessageMode: {
1290+
live: Instabug.welcomeMessageModeLive,
1291+
beta: Instabug.welcomeMessageModeBeta,
1292+
disabled: Instabug.welcomeMessageModeDisabled
1293+
},
1294+
12651295
/**
12661296
* Instabug action types.
12671297
* @readonly

ios/RNInstabug/InstabugReactBridge.m

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,14 @@ - (dispatch_queue_t)methodQueue {
528528
[IBGFeatureRequests setEmailFieldRequired:isEmailFieldRequired forAction:actionTypes];
529529
}
530530

531+
RCT_EXPORT_METHOD(showWelcomeMessageWithMode:(IBGWelcomeMessageMode)welcomeMessageMode) {
532+
[Instabug showWelcomeMessageWithMode:welcomeMessageMode];
533+
}
534+
535+
RCT_EXPORT_METHOD(setWelcomeMessageMode:(IBGWelcomeMessageMode)welcomeMessageMode) {
536+
[Instabug setWelcomeMessageMode:welcomeMessageMode];
537+
}
538+
531539
RCT_EXPORT_METHOD(setEmailFieldRequiredForFeatureRequests:(BOOL)isEmailFieldRequired
532540
forAction:(NSArray *)actionTypesArray) {
533541
IBGAction actionTypes = 0;
@@ -629,6 +637,10 @@ - (NSDictionary *)constantsToExport
629637
@"enabledWithOptionalFields": @(IBGExtendedBugReportModeEnabledWithOptionalFields),
630638
@"disabled": @(IBGExtendedBugReportModeDisabled),
631639

640+
@"welcomeMessageModeLive": @(IBGWelcomeMessageModeLive),
641+
@"welcomeMessageModeBeta": @(IBGWelcomeMessageModeBeta),
642+
@"welcomeMessageModeDisabled": @(IBGWelcomeMessageModeDisabled),
643+
632644
@"shakeHint": @(IBGStringShakeHint),
633645
@"swipeHint": @(IBGStringSwipeHint),
634646
@"edgeSwipeStartHint": @(IBGStringEdgeSwipeStartHint),

ios/RNInstabug/RCTConvert+InstabugEnums.m

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,12 @@ @implementation RCTConvert (InstabugEnums)
105105
@"topLeft": @(IBGPositionTopLeft)
106106
}), IBGPositionBottomRight, integerValue);
107107

108+
RCT_ENUM_CONVERTER(IBGWelcomeMessageMode, (@{
109+
@"welcomeMessageModeLive": @(IBGWelcomeMessageModeLive),
110+
@"welcomeMessageModeBeta": @(IBGWelcomeMessageModeBeta),
111+
@"welcomeMessageModeDisabled": @(IBGWelcomeMessageModeDisabled)
112+
}), IBGWelcomeMessageModeLive, integerValue);
113+
108114

109115
RCT_ENUM_CONVERTER(IBGAction, (@{
110116
@"allActions": @(IBGActionAllActions),

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "instabug-reactnative",
3-
"version": "2.11.2",
3+
"version": "2.13.1",
44
"description": "React Native plugin for integrating the Instabug SDK",
55
"main": "index.js",
66
"repository": {
@@ -30,4 +30,4 @@
3030
"packageInstance": "\t\tnew RNInstabugReactnativePackage.Builder(\"YOUR_ANDROID_APPLICATION_TOKEN\",MainApplication.this)\n\t\t\t\t\t\t\t.setInvocationEvent(\"shake\")\n\t\t\t\t\t\t\t.setPrimaryColor(\"#1D82DC\")\n\t\t\t\t\t\t\t.setFloatingEdge(\"left\")\n\t\t\t\t\t\t\t.setFloatingButtonOffsetFromTop(250)\n\t\t\t\t\t\t\t.build()"
3131
}
3232
}
33-
}
33+
}

0 commit comments

Comments
 (0)