Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 13 additions & 30 deletions ios/RCCManagerModule.m
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,8 @@ -(void)dismissAllModalPresenters:(NSMutableArray*)allPresentedViewControllers re
{
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0),^
{
__block NSUInteger counter = 0;
for (UIViewController *viewController in allPresentedViewControllers)
{
counter++;

[[RCCManager sharedIntance] unregisterController:viewController];
if (viewController.presentedViewController != nil)
{
dispatch_semaphore_t dismiss_sema = dispatch_semaphore_create(0);
Expand All @@ -160,40 +156,26 @@ -(void)dismissAllModalPresenters:(NSMutableArray*)allPresentedViewControllers re
{
[viewController dismissViewControllerAnimated:NO completion:^()
{
if (counter == allPresentedViewControllers.count && allPresentedViewControllers.count > 0)
{
[allPresentedViewControllers removeAllObjects];

if (resolve != nil)
{
resolve(nil);
}
}
dispatch_semaphore_signal(dismiss_sema);
}];
});

dispatch_semaphore_wait(dismiss_sema, DISPATCH_TIME_FOREVER);
}
else if (counter == allPresentedViewControllers.count && allPresentedViewControllers.count > 0)
{
[allPresentedViewControllers removeAllObjects];

if (resolve != nil)
{
dispatch_async(dispatch_get_main_queue(), ^
{
resolve(nil);
});
}
} else {
[[RCCManager sharedIntance] unregisterController:viewController];
}
}

dispatch_async(dispatch_get_main_queue(), ^{
resolve(nil);
});
});
return;
}
else if (resolve != nil)
{

dispatch_async(dispatch_get_main_queue(), ^{
resolve(nil);
}
});
}

#pragma mark - RCT exported methods
Expand Down Expand Up @@ -329,7 +311,7 @@ -(void)performSetRootController:(NSDictionary*)layout animationType:(NSString*)a
RCT_EXPORT_METHOD(
showController:(NSDictionary*)layout animationType:(NSString*)animationType globalProps:(NSDictionary*)globalProps resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
{

NSMutableDictionary *modifiedGlobalProps = [globalProps mutableCopy];
modifiedGlobalProps[GLOBAL_SCREEN_ACTION_COMMAND_TYPE] = COMMAND_TYPE_SHOW_MODAL;

Expand Down Expand Up @@ -407,7 +389,7 @@ -(BOOL)viewControllerIsModal:(UIViewController*)viewController
}
else
{
resolve(nil);
resolve(nil);
}
}

Expand Down Expand Up @@ -460,3 +442,4 @@ -(BOOL)viewControllerIsModal:(UIViewController*)viewController
}

@end