mirror of
https://github.com/status-im/instabug-reactnative.git
synced 2026-08-30 21:51:09 +00:00
Add implementation to react native methods
This commit is contained in:
@@ -28,6 +28,7 @@ export default class InstabugSample extends Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
Instabug.startWithToken('0f0dc916bd9175e3b5d2fdf0cfa49a69', Instabug.invocationEvent.shake);
|
||||
|
||||
const ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2});
|
||||
this.state = {
|
||||
dataSource: ds.cloneWithRows(this._genRows({})),
|
||||
@@ -61,7 +62,8 @@ export default class InstabugSample extends Component {
|
||||
"Unread messages count",
|
||||
"Set locale",
|
||||
"Set color theme",
|
||||
"Set primary color"
|
||||
"Set primary color",
|
||||
"Show surveys"
|
||||
];
|
||||
return dataBlob;
|
||||
}
|
||||
@@ -85,6 +87,8 @@ export default class InstabugSample extends Component {
|
||||
this._showColorThemeActionSheet();
|
||||
} else if (rowID == 7) {
|
||||
this._showPrimaryColorActionSheet();
|
||||
} else if (rowID == 8) {
|
||||
this._showSurveys();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -225,6 +229,11 @@ export default class InstabugSample extends Component {
|
||||
});
|
||||
}
|
||||
|
||||
_showSurveys() {
|
||||
console.log("show surveys")
|
||||
Instabug.showSurveysIfAvailable()
|
||||
}
|
||||
|
||||
_renderSeparator(sectionID: number, rowID: number, adjacentRowHighlighted: bool) {
|
||||
return (
|
||||
<View
|
||||
|
||||
@@ -34,9 +34,9 @@
|
||||
2D02E4C81E0B4AEC006451C7 /* libRCTWebSocket-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DAD3E991DF850E9000B6D8A /* libRCTWebSocket-tvOS.a */; };
|
||||
2D02E4C91E0B4AEC006451C7 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DAD3EA31DF850E9000B6D8A /* libReact.a */; };
|
||||
2DCD954D1E0B4F2C00145EB5 /* InstabugSampleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* InstabugSampleTests.m */; };
|
||||
3F14AAB3F8DF4F53A90F3677 /* libRNInstabug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E4D43295C2849C9ABADE838 /* libRNInstabug.a */; };
|
||||
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 */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
@@ -104,9 +104,9 @@
|
||||
remoteGlobalIDString = 83CBBA2E1A601D0E00E9B192;
|
||||
remoteInfo = React;
|
||||
};
|
||||
2460ED191E530B9B0043EDA4 /* PBXContainerItemProxy */ = {
|
||||
24C9AC781EFA773C00D07EFB /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 330102236E534C228083A4A1 /* RNInstabug.xcodeproj */;
|
||||
containerPortal = 68353C997C7F4ED0910B4CFA /* RNInstabug.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = 24DF11ED1DA3A2B90056F77C;
|
||||
remoteInfo = RNInstabug;
|
||||
@@ -262,9 +262,9 @@
|
||||
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; };
|
||||
330102236E534C228083A4A1 /* 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>"; };
|
||||
5E4D43295C2849C9ABADE838 /* libRNInstabug.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRNInstabug.a; sourceTree = "<group>"; };
|
||||
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>"; };
|
||||
@@ -295,8 +295,8 @@
|
||||
832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */,
|
||||
00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */,
|
||||
139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */,
|
||||
3F14AAB3F8DF4F53A90F3677 /* libRNInstabug.a in Frameworks */,
|
||||
FB6237B8BC81FC0C990E8BE6 /* libPods-InstabugSample.a in Frameworks */,
|
||||
E55D333604B942E09167708C /* libRNInstabug.a in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -431,14 +431,21 @@
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
2460ECFD1E530B9B0043EDA4 /* Products */ = {
|
||||
24C9AC5C1EFA773C00D07EFB /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
2460ED1A1E530B9B0043EDA4 /* libRNInstabug.a */,
|
||||
24C9AC791EFA773C00D07EFB /* libRNInstabug.a */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
24ED9F161EFA6BE300D771DA /* Recovered References */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
);
|
||||
name = "Recovered References";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
443E311BD736B6F07D8B5811 /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@@ -488,7 +495,7 @@
|
||||
832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */,
|
||||
00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */,
|
||||
139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */,
|
||||
330102236E534C228083A4A1 /* RNInstabug.xcodeproj */,
|
||||
68353C997C7F4ED0910B4CFA /* RNInstabug.xcodeproj */,
|
||||
);
|
||||
name = Libraries;
|
||||
sourceTree = "<group>";
|
||||
@@ -511,6 +518,7 @@
|
||||
83CBBA001A601CBA00E9B192 /* Products */,
|
||||
8098B839B3C5F5897B38D9B3 /* Pods */,
|
||||
443E311BD736B6F07D8B5811 /* Frameworks */,
|
||||
24ED9F161EFA6BE300D771DA /* Recovered References */,
|
||||
);
|
||||
indentWidth = 2;
|
||||
sourceTree = "<group>";
|
||||
@@ -618,6 +626,9 @@
|
||||
CreatedOnToolsVersion = 6.2;
|
||||
TestTargetID = 13B07F861A680F5B00A75B9A;
|
||||
};
|
||||
13B07F861A680F5B00A75B9A = {
|
||||
DevelopmentTeam = 56S6Q9SA8U;
|
||||
};
|
||||
2D02E47A1E0B4A5D006451C7 = {
|
||||
CreatedOnToolsVersion = 8.2.1;
|
||||
ProvisioningStyle = Automatic;
|
||||
@@ -686,8 +697,8 @@
|
||||
ProjectRef = 146833FF1AC3E56700842450 /* React.xcodeproj */;
|
||||
},
|
||||
{
|
||||
ProductGroup = 2460ECFD1E530B9B0043EDA4 /* Products */;
|
||||
ProjectRef = 330102236E534C228083A4A1 /* RNInstabug.xcodeproj */;
|
||||
ProductGroup = 24C9AC5C1EFA773C00D07EFB /* Products */;
|
||||
ProjectRef = 68353C997C7F4ED0910B4CFA /* RNInstabug.xcodeproj */;
|
||||
},
|
||||
);
|
||||
projectRoot = "";
|
||||
@@ -757,11 +768,11 @@
|
||||
remoteRef = 146834031AC3E56700842450 /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
2460ED1A1E530B9B0043EDA4 /* libRNInstabug.a */ = {
|
||||
24C9AC791EFA773C00D07EFB /* libRNInstabug.a */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = archive.ar;
|
||||
path = libRNInstabug.a;
|
||||
remoteRef = 2460ED191E530B9B0043EDA4 /* PBXContainerItemProxy */;
|
||||
remoteRef = 24C9AC781EFA773C00D07EFB /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
3DAD3E841DF850E9000B6D8A /* libRCTImage-tvOS.a */ = {
|
||||
@@ -1110,7 +1121,9 @@
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEAD_CODE_STRIPPING = NO;
|
||||
DEVELOPMENT_TEAM = 56S6Q9SA8U;
|
||||
INFOPLIST_FILE = InstabugSample/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
OTHER_LDFLAGS = (
|
||||
"$(inherited)",
|
||||
@@ -1128,7 +1141,9 @@
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEVELOPMENT_TEAM = 56S6Q9SA8U;
|
||||
INFOPLIST_FILE = InstabugSample/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
OTHER_LDFLAGS = (
|
||||
"$(inherited)",
|
||||
|
||||
@@ -14,7 +14,9 @@
|
||||
@"IBGpreSendingHandler",
|
||||
@"IBGpreInvocationHandler",
|
||||
@"IBGpostInvocationHandler",
|
||||
@"IBGonNewMessageHandler"
|
||||
@"IBGonNewMessageHandler",
|
||||
@"IBGWillShowSurvey",
|
||||
@"IBGDidDismissSurvey"
|
||||
];
|
||||
}
|
||||
|
||||
@@ -292,6 +294,38 @@ RCT_EXPORT_METHOD(logError:(NSString *)log) {
|
||||
[Instabug logError:log];
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(setSurveysEnabled:(BOOL)surveysEnabled) {
|
||||
[Instabug setSurveysEnabled:surveysEnabled];
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(showSurveysIfAvailable) {
|
||||
[Instabug showSurveyIfAvailable];
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(setWillShowSurveyHandler:(RCTResponseSenderBlock)callBack) {
|
||||
if (callBack != nil) {
|
||||
[Instabug setWillShowSurveyHandler:^{
|
||||
[self sendEventWithName:@"IBGWillShowSurvey" body:nil];
|
||||
}];
|
||||
} else {
|
||||
[Instabug setWillShowSurveyHandler:nil];
|
||||
}
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(setDidDismissSurveyHandler:(RCTResponseSenderBlock)callBack) {
|
||||
if (callBack != nil) {
|
||||
[Instabug setDidDismissSurveyHandler:^{
|
||||
[self sendEventWithName:@"IBGDidDismissSurvey" body:nil];
|
||||
}];
|
||||
} else {
|
||||
[Instabug setDidDismissSurveyHandler:nil];
|
||||
}
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(setViewHirearchyEnabled:(BOOL)viewHirearchyEnabled) {
|
||||
[Instabug setViewHierarchyEnabled:viewHirearchyEnabled];
|
||||
}
|
||||
|
||||
- (NSDictionary *)constantsToExport
|
||||
{
|
||||
return @{ @"invocationEventNone" : @(IBGInvocationEventNone),
|
||||
|
||||
Reference in New Issue
Block a user