|
|
|
|
142
|
|
142
|
|
143
|
-(void)dismissAllModalPresenters:(NSMutableArray*)allPresentedViewControllers resolver:(RCTPromiseResolveBlock)resolve
|
143
|
-(void)dismissAllModalPresenters:(NSMutableArray*)allPresentedViewControllers resolver:(RCTPromiseResolveBlock)resolve
|
144
|
{
|
144
|
{
|
|
|
145
|
+ UIViewController *rootViewController = [UIApplication sharedApplication].delegate.window.rootViewController;
|
|
|
146
|
+
|
145
|
if (allPresentedViewControllers.count > 0)
|
147
|
if (allPresentedViewControllers.count > 0)
|
146
|
{
|
148
|
{
|
147
|
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0),^
|
149
|
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0),^
|
|
|
|
|
151
|
{
|
153
|
{
|
152
|
counter++;
|
154
|
counter++;
|
153
|
|
155
|
|
154
|
- [[RCCManager sharedIntance] unregisterController:viewController];
|
|
|
|
|
156
|
+
|
155
|
if (viewController.presentedViewController != nil)
|
157
|
if (viewController.presentedViewController != nil)
|
156
|
{
|
158
|
{
|
157
|
dispatch_semaphore_t dismiss_sema = dispatch_semaphore_create(0);
|
159
|
dispatch_semaphore_t dismiss_sema = dispatch_semaphore_create(0);
|
|
|
|
|
160
|
{
|
162
|
{
|
161
|
[viewController dismissViewControllerAnimated:NO completion:^()
|
163
|
[viewController dismissViewControllerAnimated:NO completion:^()
|
162
|
{
|
164
|
{
|
|
|
165
|
+ if (rootViewController != viewController) {
|
|
|
166
|
+ [[RCCManager sharedIntance] unregisterController:viewController];
|
|
|
167
|
+ }
|
|
|
168
|
+
|
163
|
if (counter == allPresentedViewControllers.count && allPresentedViewControllers.count > 0)
|
169
|
if (counter == allPresentedViewControllers.count && allPresentedViewControllers.count > 0)
|
164
|
{
|
170
|
{
|
165
|
[allPresentedViewControllers removeAllObjects];
|
171
|
[allPresentedViewControllers removeAllObjects];
|