mirror of
https://github.com/status-im/instabug-reactnative.git
synced 2025-03-02 14:10:40 +00:00
Move Instabug instantiation to Android Application class
This commit is contained in:
parent
fe71e475d7
commit
9b871dff58
@ -129,8 +129,8 @@ android {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile project(':instabug-reactnative')
|
||||
compile project(':react-native-dialogs')
|
||||
compile project(':instabug-reactnative')
|
||||
compile fileTree(dir: "libs", include: ["*.jar"])
|
||||
compile "com.android.support:appcompat-v7:23.0.1"
|
||||
compile "com.facebook.react:react-native:+" // From node_modules
|
||||
|
@ -28,9 +28,7 @@ public class MainApplication extends Application implements ReactApplication {
|
||||
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)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
@ -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 */; };
|
||||
DCC755EDCD9B460F84658AAD /* libRNInstabug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FED4204D49074081B94F4448 /* 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; };
|
||||
A0FE88E32F084FD8A95E38DF /* 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; };
|
||||
FED4204D49074081B94F4448 /* 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 */,
|
||||
DCC755EDCD9B460F84658AAD /* 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 */,
|
||||
A0FE88E32F084FD8A95E38DF /* 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;
|
||||
|
@ -7,7 +7,7 @@
|
||||
"test": "jest"
|
||||
},
|
||||
"dependencies": {
|
||||
"instabug-reactnative": "file:../",
|
||||
"instabug-reactnative": "file:..",
|
||||
"react": "15.4.2",
|
||||
"react-native": "^0.41.2",
|
||||
"react-native-dialogs": "0.0.19"
|
||||
|
@ -118,9 +118,10 @@ 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;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -24,31 +24,29 @@ 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) {
|
||||
this.androidApplication = androidApplication;
|
||||
this.mAndroidApplicationToken = androidApplicationToken;
|
||||
mInstabug = new Instabug.Builder(this.androidApplication, this.mAndroidApplicationToken)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public RNInstabugReactnativePackage(String androidApplicationToken, Application application) {
|
||||
this(androidApplicationToken, application, "button");
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public RNInstabugReactnativePackage(String androidApplicationToken, Application application,
|
||||
public RNInstabugReactnativePackage(String androidApplicationToken, Application androidApplication,
|
||||
String invocationEventValue) {
|
||||
this(androidApplicationToken, application, invocationEventValue, "light");
|
||||
this(androidApplicationToken, androidApplication);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public RNInstabugReactnativePackage(String androidApplicationToken, Application application,
|
||||
public RNInstabugReactnativePackage(String androidApplicationToken, Application androidApplication,
|
||||
String invocationEventValue, String instabugColorThemeValue) {
|
||||
this.androidApplication = application;
|
||||
this(androidApplicationToken, androidApplication);
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
|
3
index.js
3
index.js
@ -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);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "instabug-reactnative",
|
||||
"version": "1.1.4",
|
||||
"version": "1.1.5",
|
||||
"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)"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user