From 72a1b0aa69e2bc041581b6aca24fbdb4b6a13cda Mon Sep 17 00:00:00 2001 From: Bhaal22 Date: Wed, 3 Feb 2021 10:01:46 +0100 Subject: [PATCH 1/3] LP: livepepper apps do not close dialog when back is pressed. --- src/android/InAppBrowserDialog.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/android/InAppBrowserDialog.java b/src/android/InAppBrowserDialog.java index e7b212f28..aca7240f4 100644 --- a/src/android/InAppBrowserDialog.java +++ b/src/android/InAppBrowserDialog.java @@ -50,7 +50,8 @@ public void onBackPressed () { if (this.inAppBrowser.hardwareBack() && this.inAppBrowser.canGoBack()) { this.inAppBrowser.goBack(); } else { - this.inAppBrowser.closeDialog(); + //behavior livepepper does not want to have + //this.inAppBrowser.closeDialog(); } } } From c80dcd667d99e64d59632df61a9ef73099de5f0f Mon Sep 17 00:00:00 2001 From: Clement Chazarra Date: Mon, 11 Jul 2022 12:42:25 +0200 Subject: [PATCH 2/3] Revert change - No need with home screen --- src/android/InAppBrowserDialog.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/android/InAppBrowserDialog.java b/src/android/InAppBrowserDialog.java index aca7240f4..e7b212f28 100644 --- a/src/android/InAppBrowserDialog.java +++ b/src/android/InAppBrowserDialog.java @@ -50,8 +50,7 @@ public void onBackPressed () { if (this.inAppBrowser.hardwareBack() && this.inAppBrowser.canGoBack()) { this.inAppBrowser.goBack(); } else { - //behavior livepepper does not want to have - //this.inAppBrowser.closeDialog(); + this.inAppBrowser.closeDialog(); } } } From fd21ab6f82297fba782ed304f682833ac0d3013e Mon Sep 17 00:00:00 2001 From: Clement Chazarra Date: Mon, 11 Jul 2022 12:48:53 +0200 Subject: [PATCH 3/3] Fix overlapping --- src/ios/CDVWKInAppBrowser.m | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/src/ios/CDVWKInAppBrowser.m b/src/ios/CDVWKInAppBrowser.m index 2adcf0c1b..5ea6d3658 100644 --- a/src/ios/CDVWKInAppBrowser.m +++ b/src/ios/CDVWKInAppBrowser.m @@ -540,7 +540,7 @@ - (void)webView:(WKWebView *)theWebView decidePolicyForNavigationAction:(WKNavig } //if is an app store, tel, sms, mailto or geo link, let the system handle it, otherwise it fails to load it - NSArray * allowedSchemes = @[@"itms-appss", @"itms-apps", @"tel", @"sms", @"mailto", @"geo"]; + NSArray * allowedSchemes = @[@"itms-appss", @"itms-apps", @"tel", @"sms", @"mailto", @"geo", @"intent", @"twint-issuer12", @"twint-issuer16", @"twint-issuer10", @"twint-issuer17", @"twint-issuer18", @"twint-issuer5", @"twint-issuer13", @"twint-issuer4", @"twint-issuer15", @"twint-issuer21", @"twint-issuer11", @"twint-issuer8", @"twint-issuer7", @"twint-issuer6", @"twint-issuer14", @"twint-issuer19", @"twint-issuer1", @"twint-issuer2", @"twint-issuer20", @"twint-issuer3", @"twint-issuer9"]; if ([allowedSchemes containsObject:[url scheme]]) { [theWebView stopLoading]; [self openInSystem:url]; @@ -1125,8 +1125,40 @@ - (void)goForward:(id)sender [self.webView goForward]; } +- (BOOL)hasTopNotch { + if (@available(iOS 11.0, *)) { + return [[[UIApplication sharedApplication] delegate] window].safeAreaInsets.top > 20.0; + } + + return NO; +} + - (void)viewWillAppear:(BOOL)animated { + if (IsAtLeastiOSVersion(@"7.0") && !viewRenderedAtLeastOnce) { + viewRenderedAtLeastOnce = TRUE; + CGRect viewBounds = [self.webView bounds]; + + if ([self hasTopNotch]) { + BOOL toolbarVisible = !self.toolbar.hidden; + BOOL toolbarIsAtBottom = ![_browserOptions.toolbarposition isEqualToString:kInAppBrowserToolbarBarPositionTop]; + + float topSafeArea = [[[UIApplication sharedApplication] delegate] window].safeAreaInsets.top; + float bottomSafeArea = [[[UIApplication sharedApplication] delegate] window].safeAreaInsets.bottom; + + if (toolbarVisible && toolbarIsAtBottom) { + bottomSafeArea = 0.0; + } + + viewBounds.origin.y = topSafeArea; + viewBounds.size.height = viewBounds.size.height - (topSafeArea + bottomSafeArea); + } else { + viewBounds.origin.y = STATUSBAR_HEIGHT; + viewBounds.size.height = viewBounds.size.height - STATUSBAR_HEIGHT; + } + self.webView.frame = viewBounds; + [[UIApplication sharedApplication] setStatusBarStyle:[self preferredStatusBarStyle]]; + } [self rePositionViews]; [super viewWillAppear:animated];