This commit is contained in:
gmegidish 2016-03-08 17:17:15 +02:00
commit 1400b52895
2 changed files with 38 additions and 14 deletions

View File

@ -11,51 +11,73 @@
RCT_EXPORT_MODULE(); RCT_EXPORT_MODULE();
RCT_EXPORT_METHOD(begin:(NSString *)appKey withOptions:(NSDictionary *)options) { RCT_EXPORT_METHOD(begin:(NSString *)appKey withOptions:(NSDictionary *)options) {
[TestFairy begin:appKey withOptions:options]; dispatch_async(dispatch_get_main_queue(), ^{
[TestFairy begin:appKey withOptions:options];
});
} }
RCT_EXPORT_METHOD(setCorrelationId:(NSString *)correlationId) { RCT_EXPORT_METHOD(setCorrelationId:(NSString *)correlationId) {
[TestFairy setCorrelationId:correlationId]; dispatch_async(dispatch_get_main_queue(), ^{
[TestFairy setCorrelationId:correlationId];
});
} }
RCT_EXPORT_METHOD(identify:(NSString *)correlationId traits:(NSDictionary *)traits) { RCT_EXPORT_METHOD(identify:(NSString *)correlationId traits:(NSDictionary *)traits) {
[TestFairy identify:correlationId traits:traits]; dispatch_async(dispatch_get_main_queue(), ^{
[TestFairy identify:correlationId traits:traits];
});
} }
RCT_EXPORT_METHOD(takeScreenshot) { RCT_EXPORT_METHOD(takeScreenshot) {
[TestFairy takeScreenshot]; dispatch_async(dispatch_get_main_queue(), ^{
[TestFairy takeScreenshot];
});
} }
RCT_EXPORT_METHOD(pause) { RCT_EXPORT_METHOD(pause) {
[TestFairy pause]; dispatch_async(dispatch_get_main_queue(), ^{
[TestFairy pause];
});
} }
RCT_EXPORT_METHOD(resume) { RCT_EXPORT_METHOD(resume) {
[TestFairy resume]; dispatch_async(dispatch_get_main_queue(), ^{
[TestFairy resume];
});
} }
RCT_EXPORT_METHOD(checkpoint:(NSString *)name) { RCT_EXPORT_METHOD(checkpoint:(NSString *)name) {
[TestFairy checkpoint:name]; dispatch_async(dispatch_get_main_queue(), ^{
[TestFairy checkpoint:name];
});
} }
RCT_EXPORT_METHOD(sendUserFeedback:(NSString *)feedback) { RCT_EXPORT_METHOD(sendUserFeedback:(NSString *)feedback) {
[TestFairy sendUserFeedback:feedback]; dispatch_async(dispatch_get_main_queue(), ^{
[TestFairy sendUserFeedback:feedback];
});
} }
RCT_EXPORT_METHOD(sessionUrl:(RCTResponseSenderBlock)callback) { RCT_EXPORT_METHOD(sessionUrl:(RCTResponseSenderBlock)callback) {
callback(@[[NSNull null], [TestFairy sessionUrl]]); dispatch_async(dispatch_get_main_queue(), ^{
callback(@[[NSNull null], [TestFairy sessionUrl]]);
});
} }
RCT_EXPORT_METHOD(version:(RCTResponseSenderBlock)callback) { RCT_EXPORT_METHOD(version:(RCTResponseSenderBlock)callback) {
callback(@[[NSNull null], [TestFairy version]]); dispatch_async(dispatch_get_main_queue(), ^{
callback(@[[NSNull null], [TestFairy version]]);
});
} }
RCT_EXPORT_METHOD(hideView:(nonnull NSNumber *)reactTag) { RCT_EXPORT_METHOD(hideView:(nonnull NSNumber *)reactTag) {
dispatch_async(_bridge.uiManager.methodQueue, ^{ dispatch_async(_bridge.uiManager.methodQueue, ^{
[_bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) { [_bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
UIView *view = viewRegistry[reactTag]; __block UIView *view = viewRegistry[reactTag];
if (view != nil) { if (view != nil) {
[TestFairy hideView:view]; dispatch_async(dispatch_get_main_queue(), ^{
[TestFairy hideView:view];
});
} }
}]; }];
}); });

View File

@ -1,6 +1,6 @@
{ {
"name": "react-native-testfairy", "name": "react-native-testfairy",
"version": "1.6.0", "version": "1.6.1",
"description": "TestFairy for React Native", "description": "TestFairy for React Native",
"author": "Gil Megidish", "author": "Gil Megidish",
"main": "./index.js", "main": "./index.js",
@ -12,8 +12,10 @@
"url": "git+https://github.com/testfairy/react-native-testfairy" "url": "git+https://github.com/testfairy/react-native-testfairy"
}, },
"keywords": [ "keywords": [
"react-component",
"testfairy", "testfairy",
"react-native" "react-native",
"ios"
], ],
"author": "testfairy", "author": "testfairy",
"license": "Apache-2.0", "license": "Apache-2.0",