Skip to content

Commit

Permalink
Revert "Revert "No need to wait for RN to load""
Browse files Browse the repository at this point in the history
This reverts commit bbcd4b3.

Closes #615 😓
  • Loading branch information
LeoNatan authored and yershalom committed Apr 4, 2018
1 parent 33e8504 commit e32f352
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
20 changes: 15 additions & 5 deletions detox/ios/Detox/DetoxManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,24 @@ - (instancetype)init
self.testRunner = [[TestRunner alloc] init];
self.testRunner.delegate = self;

if([ReactNativeSupport isReactNativeApp])
{
[self _waitForRNLoadWithId:@0];
}
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_appDidLaunch:) name:UIApplicationDidFinishLaunchingNotification object:nil];

return self;
}

- (void)_appDidLaunch:(NSNotification*)note
{
[EarlGrey detox_safeExecuteSync:^{
self.isReady = YES;
[self _sendGeneralReadyMessage];
}];
}

- (void)_sendGeneralReadyMessage
{
[self.webSocket sendAction:@"ready" withParams:@{} withMessageId:@-1000];
}

- (void)connectToServer:(NSString*)url withSessionId:(NSString*)sessionId
{
[self.webSocket connectToServer:url withSessionId:sessionId];
Expand Down Expand Up @@ -222,7 +232,7 @@ - (void)_waitForRNLoadWithId:(id)messageId
__weak __typeof(self) weakSelf = self;
[ReactNativeSupport waitForReactNativeLoadWithCompletionHandler:^{
weakSelf.isReady = YES;
[weakSelf.webSocket sendAction:@"ready" withParams:@{} withMessageId:@-1000];
[weakSelf _sendGeneralReadyMessage];
}];
}

Expand Down
9 changes: 2 additions & 7 deletions detox/ios/Detox/ReactNativeSupport.m
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,8 @@ void setupForTests()
{
wx_original_dispatch_queue_create = dlsym(RTLD_DEFAULT, "dispatch_queue_create");

// Rebind symbols dispatch_* to point to our own implementation.
struct rebinding rebindings[] = {
{"dispatch_queue_create", wx_dispatch_queue_create, NULL}
};
GREY_UNUSED_VARIABLE int failure =
rebind_symbols(rebindings, sizeof(rebindings) / sizeof(rebindings[0]));
NSCAssert(!failure, @"rebinding symbols failed");
// Rebind symbols dispatch_queue_create to point to our own implementation.
rebind_symbols((struct rebinding[]){"dispatch_queue_create", wx_dispatch_queue_create, NULL}, 1);

__currentIdlingResourceSerialQueue = dispatch_queue_create("__currentIdlingResourceSerialQueue", NULL);

Expand Down

0 comments on commit e32f352

Please sign in to comment.