Merge pull request #47 from Instabug/master

Merge Master into dev
This commit is contained in:
Hossam Hassan 2017-07-11 15:15:35 +02:00 committed by GitHub
commit 0d70d7f851
11 changed files with 115 additions and 349 deletions

View File

@ -130,7 +130,6 @@ android {
dependencies {
compile project(':instabug-reactnative')
compile project(':react-native-dialogs')
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:23.0.1"
compile "com.facebook.react:react-native:+" // From node_modules

View File

@ -4,7 +4,6 @@ import android.app.Application;
import android.util.Log;
import com.facebook.react.ReactApplication;
import com.aakashns.reactnativedialogs.ReactNativeDialogsPackage;
import com.instabug.reactlibrary.RNInstabugReactnativePackage;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.ReactNativeHost;
@ -27,10 +26,7 @@ public class MainApplication extends Application implements ReactApplication {
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new ReactNativeDialogsPackage(),
new RNInstabugReactnativePackage("YOUR_ANDROID_APPLICATION_TOKEN",
MainApplication.this,"button")
new RNInstabugReactnativePackage("YOUR_ANDROID_APPLICATION_TOKEN",MainApplication.this,"shake","#1D82DC")
);
}
};

View File

@ -1,6 +1,4 @@
rootProject.name = 'InstabugSample'
include ':react-native-dialogs'
project(':react-native-dialogs').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-dialogs/android')
include ':instabug-reactnative'
project(':instabug-reactnative').projectDir = new File(rootProject.projectDir, '../node_modules/instabug-reactnative/android')

View File

@ -14,310 +14,66 @@ import {
processColor,
Aerlt,
Image,
ListView,
TouchableHighlight,
RecyclerViewBackedScrollView
} from "react-native";
import Instabug from "instabug-reactnative";
let DialogAndroid = require('react-native-dialogs');
export default class InstabugSample extends Component {
constructor(props) {
super(props);
Instabug.startWithToken('0f0dc916bd9175e3b5d2fdf0cfa49a69',
Instabug.invocationEvent.floatingButton);
Instabug.setPreInvocationHandler(() => {
Alert.alert("PreInvocationEvent", "Done :) ");
});
const ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2});
this.state = {
dataSource: ds.cloneWithRows(this._genRows({})),
};
Instabug.setColorTheme(Instabug.colorTheme.light);
Instabug.setPrimaryColor(processColor('#aaff00'));
Instabug.setEmailFieldRequired(false);
}
_renderRow(rowData, sectionID, rowID, highlightRow) {
const that = this;
return (
<TouchableHighlight onPress={() => {
that._pressRow(rowID);
highlightRow(sectionID, rowID);
}}>
<View>
<View style={styles.row}>
<Text style={styles.text}>
{rowData}
</Text>
</View>
</View>
</TouchableHighlight>
);
}
_genRows() {
var dataBlob = [
"Invoke",
"Invoke with invocation mode",
"Select invocation event",
"Show intro message",
"Unread messages count",
"Set locale",
"Set color theme",
"Set primary color"
];
return dataBlob;
}
_pressRow(rowID) {
if (rowID == 0) {
Instabug.invoke();
} else if (rowID == 1) {
this._showInvocationModeActionSheet();
} else if (rowID == 2) {
this._showInvocationEventActionSheet();
} else if (rowID == 3) {
Instabug.showIntroMessage();
} else if (rowID == 4) {
Instabug.getUnreadMessagesCount((count) => {
Alert.alert("UnReadMessages", "Messages: " + count);
});
} else if (rowID == 5) {
this._showLocaleActionSheet();
} else if (rowID == 6) {
this._showColorThemeActionSheet();
} else if (rowID == 7) {
this._showPrimaryColorActionSheet();
}
}
_showInvocationModeActionSheet() {
let options = {
"items": [
"New bug",
"New Feedback",
"New Chat",
"None"
],
"title": "Instabug modes",
itemsCallback: (id, text) => {
if (id == 0) {
Instabug.invokeWithInvocationMode(Instabug.invocationMode.newBug);
} else if (id == 1) {
Instabug.invokeWithInvocationMode(Instabug.invocationMode.newFeedback);
} else if (id == 2) {
Instabug.invokeWithInvocationMode(Instabug.invocationMode.newChat);
} else if (id == 3) {
Instabug.invokeWithInvocationMode(Instabug.invocationMode.NA);
}
}
};
showDialog = function () {
let dialog = new DialogAndroid();
dialog.set(options);
dialog.show();
};
showDialog();
}
_showColorThemeActionSheet() {
let options = {
"items": [
"Light",
"Dark"
],
"title": "Instabug Themes",
itemsCallback: (id, text) => {
if (id == 0) {
Instabug.setColorTheme(Instabug.colorTheme.light);
} else if (id == 1) {
Instabug.setColorTheme(Instabug.colorTheme.dark);
}
}
};
showDialog = function () {
let dialog = new DialogAndroid();
dialog.set(options);
dialog.show();
};
showDialog();
}
_showPrimaryColorActionSheet() {
let options = {
"items": [
"Red",
"Green",
"Blue"
],
"title": "Instabug Primary Color",
itemsCallback: (id, text) => {
if (id == 0) {
Instabug.setPrimaryColor(processColor('#ff0000'));
} else if (id == 1) {
Instabug.setPrimaryColor(processColor('#00ff00'));
} else if (id == 2) {
Instabug.setPrimaryColor(processColor('#0000ff'));
}
}
};
showDialog = function () {
let dialog = new DialogAndroid();
dialog.set(options);
dialog.show();
};
showDialog();
}
_showLocaleActionSheet() {
let options = {
"items": [
"Arabic",
"Chinese Simplified",
"Chinese Traditional",
"Czech",
"Danish",
"English",
"French",
"German",
"Italian",
"Japanese",
"Polish",
"Portuguese Brazil",
"Russian",
"Spanish",
"Swedish",
"Turkish"
],
"title": "Instabug Primary Color",
itemsCallback: (id, text) => {
if (id == 0) {
Instabug.setLocale(Instabug.locale.arabic);
} else if (id == 1) {
Instabug.setLocale(Instabug.locale.chineseSimplified);
} else if (id == 2) {
Instabug.setLocale(Instabug.locale.chineseTraditional);
} else if (id == 3) {
Instabug.setLocale(Instabug.locale.czech);
} else if (id == 4) {
Instabug.setLocale(Instabug.locale.danish);
} else if (id == 5) {
Instabug.setLocale(Instabug.locale.english);
} else if (id == 6) {
Instabug.setLocale(Instabug.locale.french);
} else if (id == 7) {
Instabug.setLocale(Instabug.locale.german);
} else if (id == 8) {
Instabug.setLocale(Instabug.locale.italian);
} else if (id == 9) {
Instabug.setLocale(Instabug.locale.japanese);
} else if (id == 10) {
Instabug.setLocale(Instabug.locale.polish);
} else if (id == 11) {
Instabug.setLocale(Instabug.locale.portugueseBrazil);
} else if (id == 12) {
Instabug.setLocale(Instabug.locale.russian);
} else if (id == 13) {
Instabug.setLocale(Instabug.locale.spanish);
} else if (id == 14) {
Instabug.setLocale(Instabug.locale.swedish);
} else if (id == 15) {
Instabug.setLocale(Instabug.locale.turkish);
}
}
};
showDialog = function () {
let dialog = new DialogAndroid();
dialog.set(options);
dialog.show();
};
showDialog();
}
_showInvocationEventActionSheet() {
let options = {
"items": [
"Shake",
"Screenshot",
"Two fingers swipe",
"Floating button"
],
"title": "Instabug Themes",
itemsCallback: (id, text) => {
if (id == 0) {
Instabug.setInvocationEvent(Instabug.invocationEvent.shake);
} else if (id == 1) {
Instabug.setInvocationEvent(Instabug.invocationEvent.screenshot);
} else if (id == 2) {
Instabug.setInvocationEvent(Instabug.invocationEvent.twoFingersSwipe);
} else if (id) {
Instabug.setInvocationEvent(Instabug.invocationEvent.floatingButton);
}
}
};
showDialog = function () {
let dialog = new DialogAndroid();
dialog.set(options);
dialog.show();
};
showDialog();
}
_renderSeparator(sectionID, rowID, adjacentRowHighlighted) {
return (
<View
key={`${sectionID}-${rowID}`}
style={{
height: adjacentRowHighlighted ? 4 : 1,
backgroundColor: adjacentRowHighlighted ? '#3B5998' : '#CCCCCC',
}}
/>
);
}
render() {
console.log(JSON.stringify(this.state));
return (
<ListView
dataSource={this.state.dataSource}
renderRow={this._renderRow.bind(this)}
renderScrollComponent={props => <RecyclerViewBackedScrollView {...props} />}
style={styles.listView}
/>
<View style={styles.container}>
<Text style={styles.welcome}>
Welcome to React Native!
</Text>
<Text style={styles.instructions}>
To get started, edit index.android.js
</Text>
<Text style={styles.instructions}>
Double tap R on your keyboard to reload,{'\n'}
Shake or press menu button for dev menu
</Text>
<Button
onPress={() => {
console.log("invoke Button has been clicked");
Instabug.invoke()}}
title="Invoke Instabug"
color="#841584"
disabled={false}
accessibilityLabel="Learn more about this purple button"
/>
</View>
);
}
}
const styles = StyleSheet.create({
row: {
flexDirection: 'row',
justifyContent: 'center',
padding: 10,
backgroundColor: '#F6F6F6',
},
thumb: {
width: 64,
height: 64,
},
text: {
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
listView: {
paddingTop: 20
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
});

View File

@ -5,7 +5,6 @@
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */; };
00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */; };
@ -36,8 +35,8 @@
2DCD954D1E0B4F2C00145EB5 /* InstabugSampleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* InstabugSampleTests.m */; };
5E9157361DD0AC6A00FF2AA8 /* libRCTAnimation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E9157331DD0AC6500FF2AA8 /* libRCTAnimation.a */; };
832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; };
E55D333604B942E09167708C /* libRNInstabug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5632439F28464ECB86D23318 /* libRNInstabug.a */; };
FB6237B8BC81FC0C990E8BE6 /* libPods-InstabugSample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E9562565B465A2839B076D83 /* libPods-InstabugSample.a */; };
62F9158A7B074929B2D8A561 /* libRNInstabug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6C533A1EEE6342FA8421CF36 /* libRNInstabug.a */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@ -104,13 +103,6 @@
remoteGlobalIDString = 83CBBA2E1A601D0E00E9B192;
remoteInfo = React;
};
24C9AC781EFA773C00D07EFB /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 68353C997C7F4ED0910B4CFA /* RNInstabug.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 24DF11ED1DA3A2B90056F77C;
remoteInfo = RNInstabug;
};
2D02E4911E0B4A5D006451C7 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */;
@ -262,13 +254,13 @@
21DED4D3594E0D93E837631F /* Pods-InstabugSample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InstabugSample.release.xcconfig"; path = "Pods/Target Support Files/Pods-InstabugSample/Pods-InstabugSample.release.xcconfig"; sourceTree = "<group>"; };
2D02E47B1E0B4A5D006451C7 /* InstabugSample-tvOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "InstabugSample-tvOS.app"; sourceTree = BUILT_PRODUCTS_DIR; };
2D02E4901E0B4A5D006451C7 /* InstabugSample-tvOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "InstabugSample-tvOSTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
5632439F28464ECB86D23318 /* libRNInstabug.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRNInstabug.a; sourceTree = "<group>"; };
5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTAnimation.xcodeproj; path = "../node_modules/react-native/Libraries/NativeAnimation/RCTAnimation.xcodeproj"; sourceTree = "<group>"; };
68353C997C7F4ED0910B4CFA /* RNInstabug.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RNInstabug.xcodeproj; path = "../node_modules/instabug-reactnative/ios/RNInstabug.xcodeproj"; sourceTree = "<group>"; };
78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = "../node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj"; sourceTree = "<group>"; };
832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = "../node_modules/react-native/Libraries/Text/RCTText.xcodeproj"; sourceTree = "<group>"; };
8601D784DB38337F6E545397 /* Pods-InstabugSample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InstabugSample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-InstabugSample/Pods-InstabugSample.debug.xcconfig"; sourceTree = "<group>"; };
E9562565B465A2839B076D83 /* libPods-InstabugSample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-InstabugSample.a"; sourceTree = BUILT_PRODUCTS_DIR; };
1B17852ABF654B8D8B056F8E /* RNInstabug.xcodeproj */ = {isa = PBXFileReference; name = "RNInstabug.xcodeproj"; path = "../node_modules/instabug-reactnative/ios/RNInstabug.xcodeproj"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = wrapper.pb-project; explicitFileType = undefined; includeInIndex = 0; };
6C533A1EEE6342FA8421CF36 /* libRNInstabug.a */ = {isa = PBXFileReference; name = "libRNInstabug.a"; path = "libRNInstabug.a"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@ -296,7 +288,7 @@
00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */,
139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */,
FB6237B8BC81FC0C990E8BE6 /* libPods-InstabugSample.a in Frameworks */,
E55D333604B942E09167708C /* libRNInstabug.a in Frameworks */,
62F9158A7B074929B2D8A561 /* libRNInstabug.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -431,14 +423,6 @@
name = Products;
sourceTree = "<group>";
};
24C9AC5C1EFA773C00D07EFB /* Products */ = {
isa = PBXGroup;
children = (
24C9AC791EFA773C00D07EFB /* libRNInstabug.a */,
);
name = Products;
sourceTree = "<group>";
};
24ED9F161EFA6BE300D771DA /* Recovered References */ = {
isa = PBXGroup;
children = (
@ -496,7 +480,7 @@
832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */,
00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */,
139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */,
68353C997C7F4ED0910B4CFA /* RNInstabug.xcodeproj */,
1B17852ABF654B8D8B056F8E /* RNInstabug.xcodeproj */,
);
name = Libraries;
sourceTree = "<group>";
@ -697,10 +681,6 @@
ProductGroup = 146834001AC3E56700842450 /* Products */;
ProjectRef = 146833FF1AC3E56700842450 /* React.xcodeproj */;
},
{
ProductGroup = 24C9AC5C1EFA773C00D07EFB /* Products */;
ProjectRef = 68353C997C7F4ED0910B4CFA /* RNInstabug.xcodeproj */;
},
);
projectRoot = "";
targets = (
@ -769,13 +749,6 @@
remoteRef = 146834031AC3E56700842450 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
24C9AC791EFA773C00D07EFB /* libRNInstabug.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libRNInstabug.a;
remoteRef = 24C9AC781EFA773C00D07EFB /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
3DAD3E841DF850E9000B6D8A /* libRCTImage-tvOS.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
@ -1091,6 +1064,10 @@
);
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/InstabugSample.app/InstabugSample";
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)/../node_modules/instabug-reactnative/ios/RNInstabug/**",
);
};
name = Debug;
};
@ -1112,6 +1089,10 @@
);
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/InstabugSample.app/InstabugSample";
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)/../node_modules/instabug-reactnative/ios/RNInstabug/**",
);
};
name = Release;
};
@ -1133,6 +1114,10 @@
);
PRODUCT_NAME = InstabugSample;
VERSIONING_SYSTEM = "apple-generic";
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)/../node_modules/instabug-reactnative/ios/RNInstabug/**",
);
};
name = Debug;
};
@ -1153,6 +1138,10 @@
);
PRODUCT_NAME = InstabugSample;
VERSIONING_SYSTEM = "apple-generic";
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)/../node_modules/instabug-reactnative/ios/RNInstabug/**",
);
};
name = Release;
};
@ -1183,6 +1172,10 @@
SDKROOT = appletvos;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 9.2;
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)/../node_modules/instabug-reactnative/ios/RNInstabug/**",
);
};
name = Debug;
};
@ -1213,6 +1206,10 @@
SDKROOT = appletvos;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 9.2;
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)/../node_modules/instabug-reactnative/ios/RNInstabug/**",
);
};
name = Release;
};

View File

@ -7,10 +7,9 @@
"test": "jest"
},
"dependencies": {
"instabug-reactnative": "file:../",
"instabug-reactnative": "file:..",
"react": "15.4.2",
"react-native": "^0.41.2",
"react-native-dialogs": "0.0.19"
"react-native": "^0.41.2"
},
"devDependencies": {
"babel-jest": "18.0.0",

View File

@ -3,7 +3,7 @@ apply plugin: 'com.android.library'
android {
compileSdkVersion 24
buildToolsVersion "24.0.2"
buildToolsVersion "25.0.3"
defaultConfig {
minSdkVersion 16
@ -24,4 +24,4 @@ dependencies {
compile 'com.instabug.library:instabug:4+'
}

View File

@ -118,9 +118,16 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
* @param mInstabug the m instabug
*/
public RNInstabugReactnativeModule(ReactApplicationContext reactContext, Application
androidApplication) {
androidApplication, Instabug mInstabug) {
super(reactContext);
this.androidApplication = androidApplication;
this.mInstabug = mInstabug;
try {
Instabug.invoke();
Instabug.dismiss();
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
@ -1067,7 +1074,7 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
* @param {number} androidThreshold Threshold for android devices.
*/
@ReactMethod
public void setShakingThresholdForAndroid(androidThreshold) {
public void setShakingThresholdForAndroid(int androidThreshold) {
try {
mInstabug.setShakingThreshold(androidThreshold);
} catch (Exception e) {

View File

@ -10,6 +10,7 @@ import com.facebook.react.uimanager.ViewManager;
import com.instabug.library.Instabug;
import com.instabug.library.InstabugColorTheme;
import com.instabug.library.invocation.InstabugInvocationEvent;
import android.graphics.Color;
import java.util.ArrayList;
import java.util.Collections;
@ -24,31 +25,43 @@ public class RNInstabugReactnativePackage implements ReactPackage {
private InstabugInvocationEvent invocationEvent = InstabugInvocationEvent.FLOATING_BUTTON;
private InstabugColorTheme instabugColorTheme = InstabugColorTheme.InstabugColorThemeLight;
public RNInstabugReactnativePackage(Application androidApplication) {
public RNInstabugReactnativePackage(String androidApplicationToken, Application androidApplication,
String invocationEventValue, String primaryColor) {
this.androidApplication = androidApplication;
}
this.mAndroidApplicationToken = androidApplicationToken;
@Deprecated
public RNInstabugReactnativePackage(String androidApplicationToken, Application application) {
this(androidApplicationToken, application, "button");
}
//setting invocation event
if (invocationEventValue.equals("button")) {
this.invocationEvent = InstabugInvocationEvent.FLOATING_BUTTON;
} else if (invocationEventValue.equals("swipe")) {
this.invocationEvent = InstabugInvocationEvent.TWO_FINGER_SWIPE_LEFT;
@Deprecated
public RNInstabugReactnativePackage(String androidApplicationToken, Application application,
String invocationEventValue) {
this(androidApplicationToken, application, invocationEventValue, "light");
}
} else if (invocationEventValue.equals("shake")) {
this.invocationEvent = InstabugInvocationEvent.SHAKE;
} else if (invocationEventValue.equals("screenshot")) {
this.invocationEvent = InstabugInvocationEvent.SCREENSHOT_GESTURE;
} else if (invocationEventValue.equals("none")) {
this.invocationEvent = InstabugInvocationEvent.NONE;
} else {
this.invocationEvent = InstabugInvocationEvent.SHAKE;
}
mInstabug = new Instabug.Builder(this.androidApplication, this.mAndroidApplicationToken)
.setInvocationEvent(this.invocationEvent)
.build();
Instabug.setPrimaryColor(Color.parseColor(primaryColor));
@Deprecated
public RNInstabugReactnativePackage(String androidApplicationToken, Application application,
String invocationEventValue, String instabugColorThemeValue) {
this.androidApplication = application;
}
@Override
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
List<NativeModule> modules = new ArrayList<>();
modules.add(new RNInstabugReactnativeModule(reactContext, this.androidApplication));
modules.add(new RNInstabugReactnativeModule(reactContext, this.androidApplication, this.mInstabug));
return modules;
}

View File

@ -18,7 +18,8 @@ module.exports = {
* the SDK's UI.
*/
startWithToken: function (token, invocationEvent) {
Instabug.startWithToken(token, invocationEvent);
if (Platform.OS === 'ios')
Instabug.startWithToken(token, invocationEvent);
},
/**

View File

@ -1,6 +1,6 @@
{
"name": "instabug-reactnative",
"version": "1.1.3",
"version": "1.1.6",
"description": "React Native plugin for integrating the Instabug SDK",
"main": "index.js",
"repository": {
@ -23,7 +23,7 @@
"homepage": "https://github.com/Instabug/instabug-reactnative#readme",
"rnpm": {
"android": {
"packageInstance": "new RNInstabugReactnativePackage(MainApplication.this)"
"packageInstance": "new RNInstabugReactnativePackage(\"YOUR_ANDROID_APPLICATION_TOKEN\",MainApplication.this,\"shake\",\"#1D82DC\")"
}
}
}