mirror of
https://github.com/status-im/react-native-testfairy.git
synced 2025-02-23 23:58:18 +00:00
Invoke all testfairy methods on the main thread
This commit is contained in:
parent
c72b2c57a1
commit
b0f762ac67
@ -11,51 +11,73 @@
|
||||
RCT_EXPORT_MODULE();
|
||||
|
||||
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) {
|
||||
[TestFairy setCorrelationId:correlationId];
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[TestFairy setCorrelationId:correlationId];
|
||||
});
|
||||
}
|
||||
|
||||
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) {
|
||||
[TestFairy takeScreenshot];
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[TestFairy takeScreenshot];
|
||||
});
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(pause) {
|
||||
[TestFairy pause];
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[TestFairy pause];
|
||||
});
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(resume) {
|
||||
[TestFairy resume];
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[TestFairy resume];
|
||||
});
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(checkpoint:(NSString *)name) {
|
||||
[TestFairy checkpoint:name];
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[TestFairy checkpoint:name];
|
||||
});
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(sendUserFeedback:(NSString *)feedback) {
|
||||
[TestFairy sendUserFeedback:feedback];
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[TestFairy sendUserFeedback:feedback];
|
||||
});
|
||||
}
|
||||
|
||||
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) {
|
||||
callback(@[[NSNull null], [TestFairy version]]);
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
callback(@[[NSNull null], [TestFairy version]]);
|
||||
});
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(hideView:(nonnull NSNumber *)reactTag) {
|
||||
dispatch_async(_bridge.uiManager.methodQueue, ^{
|
||||
[_bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
||||
UIView *view = viewRegistry[reactTag];
|
||||
__block UIView *view = viewRegistry[reactTag];
|
||||
if (view != nil) {
|
||||
[TestFairy hideView:view];
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[TestFairy hideView:view];
|
||||
});
|
||||
}
|
||||
}];
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user