From bdbb1df44c57c9427149b40294f082abe1f466ce Mon Sep 17 00:00:00 2001 From: jcesarmobile Date: Mon, 22 Jun 2020 11:44:39 +0200 Subject: [PATCH] fix(ios): exit event not fired on swipe down (#737) --- src/ios/CDVWKInAppBrowser.h | 2 +- src/ios/CDVWKInAppBrowser.m | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/ios/CDVWKInAppBrowser.h b/src/ios/CDVWKInAppBrowser.h index e339be1..2f650b8 100644 --- a/src/ios/CDVWKInAppBrowser.h +++ b/src/ios/CDVWKInAppBrowser.h @@ -49,7 +49,7 @@ @end -@interface CDVWKInAppBrowserViewController : UIViewController { +@interface CDVWKInAppBrowserViewController : UIViewController { @private CDVInAppBrowserOptions *_browserOptions; NSDictionary *_settings; diff --git a/src/ios/CDVWKInAppBrowser.m b/src/ios/CDVWKInAppBrowser.m index 1ec2065..64fae78 100644 --- a/src/ios/CDVWKInAppBrowser.m +++ b/src/ios/CDVWKInAppBrowser.m @@ -290,6 +290,7 @@ static CDVWKInAppBrowser* instance = nil; nav.orientationDelegate = self.inAppBrowserViewController; nav.navigationBarHidden = YES; nav.modalPresentationStyle = self.inAppBrowserViewController.modalPresentationStyle; + nav.presentationController.delegate = self.inAppBrowserViewController; __weak CDVWKInAppBrowser* weakSelf = self; @@ -306,7 +307,6 @@ static CDVWKInAppBrowser* instance = nil; strongSelf->tmpWindow = [[UIWindow alloc] initWithFrame:frame]; } UIViewController *tmpController = [[UIViewController alloc] init]; - [strongSelf->tmpWindow setRootViewController:tmpController]; [strongSelf->tmpWindow setWindowLevel:UIWindowLevelNormal]; @@ -1257,5 +1257,10 @@ BOOL isExiting = FALSE; [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator]; } +#pragma mark UIAdaptivePresentationControllerDelegate + +- (void)presentationControllerWillDismiss:(UIPresentationController *)presentationController { + isExiting = TRUE; +} @end //CDVWKInAppBrowserViewController