fix(ios): exit event not fired on swipe down (#737)
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 <CDVScreenOrientationDelegate,WKNavigationDelegate,WKUIDelegate,WKScriptMessageHandler>{
+@interface CDVWKInAppBrowserViewController : UIViewController <CDVScreenOrientationDelegate,WKNavigationDelegate,WKUIDelegate,WKScriptMessageHandler,UIAdaptivePresentationControllerDelegate>{
@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 @@
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 @@
strongSelf->tmpWindow = [[UIWindow alloc] initWithFrame:frame];
}
UIViewController *tmpController = [[UIViewController alloc] init];
-
[strongSelf->tmpWindow setRootViewController:tmpController];
[strongSelf->tmpWindow setWindowLevel:UIWindowLevelNormal];
@@ -1257,5 +1257,10 @@
[super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
}
+#pragma mark UIAdaptivePresentationControllerDelegate
+
+- (void)presentationControllerWillDismiss:(UIPresentationController *)presentationController {
+ isExiting = TRUE;
+}
@end //CDVWKInAppBrowserViewController