Skip to content

Commit 9b871df

Browse files
Move Instabug instantiation to Android Application class
1 parent fe71e47 commit 9b871df

File tree

8 files changed

+23
-52
lines changed

8 files changed

+23
-52
lines changed

InstabugSample/android/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,8 @@ android {
129129
}
130130

131131
dependencies {
132-
compile project(':instabug-reactnative')
133132
compile project(':react-native-dialogs')
133+
compile project(':instabug-reactnative')
134134
compile fileTree(dir: "libs", include: ["*.jar"])
135135
compile "com.android.support:appcompat-v7:23.0.1"
136136
compile "com.facebook.react:react-native:+" // From node_modules

InstabugSample/android/app/src/main/java/com/instabugsample/MainApplication.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@ protected List<ReactPackage> getPackages() {
2828
return Arrays.<ReactPackage>asList(
2929
new MainReactPackage(),
3030
new ReactNativeDialogsPackage(),
31-
new RNInstabugReactnativePackage("YOUR_ANDROID_APPLICATION_TOKEN",
32-
MainApplication.this,"button")
33-
31+
new RNInstabugReactnativePackage("YOUR_ANDROID_APPLICATION_TOKEN",MainApplication.this)
3432
);
3533
}
3634
};

InstabugSample/ios/InstabugSample.xcodeproj/project.pbxproj

Lines changed: 5 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
};
66
objectVersion = 46;
77
objects = {
8-
98
/* Begin PBXBuildFile section */
109
00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */; };
1110
00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */; };
@@ -36,8 +35,8 @@
3635
2DCD954D1E0B4F2C00145EB5 /* InstabugSampleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* InstabugSampleTests.m */; };
3736
5E9157361DD0AC6A00FF2AA8 /* libRCTAnimation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E9157331DD0AC6500FF2AA8 /* libRCTAnimation.a */; };
3837
832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; };
39-
E55D333604B942E09167708C /* libRNInstabug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5632439F28464ECB86D23318 /* libRNInstabug.a */; };
4038
FB6237B8BC81FC0C990E8BE6 /* libPods-InstabugSample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E9562565B465A2839B076D83 /* libPods-InstabugSample.a */; };
39+
DCC755EDCD9B460F84658AAD /* libRNInstabug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FED4204D49074081B94F4448 /* libRNInstabug.a */; };
4140
/* End PBXBuildFile section */
4241

4342
/* Begin PBXContainerItemProxy section */
@@ -104,13 +103,6 @@
104103
remoteGlobalIDString = 83CBBA2E1A601D0E00E9B192;
105104
remoteInfo = React;
106105
};
107-
24C9AC781EFA773C00D07EFB /* PBXContainerItemProxy */ = {
108-
isa = PBXContainerItemProxy;
109-
containerPortal = 68353C997C7F4ED0910B4CFA /* RNInstabug.xcodeproj */;
110-
proxyType = 2;
111-
remoteGlobalIDString = 24DF11ED1DA3A2B90056F77C;
112-
remoteInfo = RNInstabug;
113-
};
114106
2D02E4911E0B4A5D006451C7 /* PBXContainerItemProxy */ = {
115107
isa = PBXContainerItemProxy;
116108
containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */;
@@ -262,13 +254,13 @@
262254
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>"; };
263255
2D02E47B1E0B4A5D006451C7 /* InstabugSample-tvOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "InstabugSample-tvOS.app"; sourceTree = BUILT_PRODUCTS_DIR; };
264256
2D02E4901E0B4A5D006451C7 /* InstabugSample-tvOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "InstabugSample-tvOSTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
265-
5632439F28464ECB86D23318 /* libRNInstabug.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRNInstabug.a; sourceTree = "<group>"; };
266257
5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTAnimation.xcodeproj; path = "../node_modules/react-native/Libraries/NativeAnimation/RCTAnimation.xcodeproj"; sourceTree = "<group>"; };
267-
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>"; };
268258
78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = "../node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj"; sourceTree = "<group>"; };
269259
832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = "../node_modules/react-native/Libraries/Text/RCTText.xcodeproj"; sourceTree = "<group>"; };
270260
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>"; };
271261
E9562565B465A2839B076D83 /* libPods-InstabugSample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-InstabugSample.a"; sourceTree = BUILT_PRODUCTS_DIR; };
262+
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; };
263+
FED4204D49074081B94F4448 /* libRNInstabug.a */ = {isa = PBXFileReference; name = "libRNInstabug.a"; path = "libRNInstabug.a"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; };
272264
/* End PBXFileReference section */
273265

274266
/* Begin PBXFrameworksBuildPhase section */
@@ -296,7 +288,7 @@
296288
00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */,
297289
139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */,
298290
FB6237B8BC81FC0C990E8BE6 /* libPods-InstabugSample.a in Frameworks */,
299-
E55D333604B942E09167708C /* libRNInstabug.a in Frameworks */,
291+
DCC755EDCD9B460F84658AAD /* libRNInstabug.a in Frameworks */,
300292
);
301293
runOnlyForDeploymentPostprocessing = 0;
302294
};
@@ -431,14 +423,6 @@
431423
name = Products;
432424
sourceTree = "<group>";
433425
};
434-
24C9AC5C1EFA773C00D07EFB /* Products */ = {
435-
isa = PBXGroup;
436-
children = (
437-
24C9AC791EFA773C00D07EFB /* libRNInstabug.a */,
438-
);
439-
name = Products;
440-
sourceTree = "<group>";
441-
};
442426
24ED9F161EFA6BE300D771DA /* Recovered References */ = {
443427
isa = PBXGroup;
444428
children = (
@@ -496,7 +480,7 @@
496480
832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */,
497481
00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */,
498482
139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */,
499-
68353C997C7F4ED0910B4CFA /* RNInstabug.xcodeproj */,
483+
A0FE88E32F084FD8A95E38DF /* RNInstabug.xcodeproj */,
500484
);
501485
name = Libraries;
502486
sourceTree = "<group>";
@@ -697,10 +681,6 @@
697681
ProductGroup = 146834001AC3E56700842450 /* Products */;
698682
ProjectRef = 146833FF1AC3E56700842450 /* React.xcodeproj */;
699683
},
700-
{
701-
ProductGroup = 24C9AC5C1EFA773C00D07EFB /* Products */;
702-
ProjectRef = 68353C997C7F4ED0910B4CFA /* RNInstabug.xcodeproj */;
703-
},
704684
);
705685
projectRoot = "";
706686
targets = (
@@ -769,13 +749,6 @@
769749
remoteRef = 146834031AC3E56700842450 /* PBXContainerItemProxy */;
770750
sourceTree = BUILT_PRODUCTS_DIR;
771751
};
772-
24C9AC791EFA773C00D07EFB /* libRNInstabug.a */ = {
773-
isa = PBXReferenceProxy;
774-
fileType = archive.ar;
775-
path = libRNInstabug.a;
776-
remoteRef = 24C9AC781EFA773C00D07EFB /* PBXContainerItemProxy */;
777-
sourceTree = BUILT_PRODUCTS_DIR;
778-
};
779752
3DAD3E841DF850E9000B6D8A /* libRCTImage-tvOS.a */ = {
780753
isa = PBXReferenceProxy;
781754
fileType = archive.ar;

InstabugSample/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"test": "jest"
88
},
99
"dependencies": {
10-
"instabug-reactnative": "file:../",
10+
"instabug-reactnative": "file:..",
1111
"react": "15.4.2",
1212
"react-native": "^0.41.2",
1313
"react-native-dialogs": "0.0.19"

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,10 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
118118
* @param mInstabug the m instabug
119119
*/
120120
public RNInstabugReactnativeModule(ReactApplicationContext reactContext, Application
121-
androidApplication) {
121+
androidApplication, Instabug mInstabug) {
122122
super(reactContext);
123123
this.androidApplication = androidApplication;
124+
this.mInstabug = mInstabug;
124125
}
125126

126127
@Override

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

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,31 +24,29 @@ public class RNInstabugReactnativePackage implements ReactPackage {
2424
private InstabugInvocationEvent invocationEvent = InstabugInvocationEvent.FLOATING_BUTTON;
2525
private InstabugColorTheme instabugColorTheme = InstabugColorTheme.InstabugColorThemeLight;
2626

27-
public RNInstabugReactnativePackage(Application androidApplication) {
27+
public RNInstabugReactnativePackage(String androidApplicationToken, Application androidApplication) {
2828
this.androidApplication = androidApplication;
29+
this.mAndroidApplicationToken = androidApplicationToken;
30+
mInstabug = new Instabug.Builder(this.androidApplication, this.mAndroidApplicationToken)
31+
.build();
2932
}
3033

3134
@Deprecated
32-
public RNInstabugReactnativePackage(String androidApplicationToken, Application application) {
33-
this(androidApplicationToken, application, "button");
34-
}
35-
36-
@Deprecated
37-
public RNInstabugReactnativePackage(String androidApplicationToken, Application application,
35+
public RNInstabugReactnativePackage(String androidApplicationToken, Application androidApplication,
3836
String invocationEventValue) {
39-
this(androidApplicationToken, application, invocationEventValue, "light");
37+
this(androidApplicationToken, androidApplication);
4038
}
4139

4240
@Deprecated
43-
public RNInstabugReactnativePackage(String androidApplicationToken, Application application,
41+
public RNInstabugReactnativePackage(String androidApplicationToken, Application androidApplication,
4442
String invocationEventValue, String instabugColorThemeValue) {
45-
this.androidApplication = application;
43+
this(androidApplicationToken, androidApplication);
4644
}
4745

4846
@Override
4947
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
5048
List<NativeModule> modules = new ArrayList<>();
51-
modules.add(new RNInstabugReactnativeModule(reactContext, this.androidApplication));
49+
modules.add(new RNInstabugReactnativeModule(reactContext, this.androidApplication, this.mInstabug));
5250
return modules;
5351
}
5452

index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ module.exports = {
1818
* the SDK's UI.
1919
*/
2020
startWithToken: function (token, invocationEvent) {
21-
Instabug.startWithToken(token, invocationEvent);
21+
if (Platform.OS === 'ios')
22+
Instabug.startWithToken(token, invocationEvent);
2223
},
2324

2425
/**

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": "1.1.4",
3+
"version": "1.1.5",
44
"description": "React Native plugin for integrating the Instabug SDK",
55
"main": "index.js",
66
"repository": {
@@ -23,7 +23,7 @@
2323
"homepage": "https://github.com/Instabug/instabug-reactnative#readme",
2424
"rnpm": {
2525
"android": {
26-
"packageInstance": "new RNInstabugReactnativePackage(MainApplication.this)"
26+
"packageInstance": "new RNInstabugReactnativePackage(\"YOUR_ANDROID_APPLICATION_TOKEN\",MainApplication.this)"
2727
}
2828
}
2929
}

0 commit comments

Comments
 (0)