apache / cordova-plugin-inappbrowser

Apache Cordova InAppBrowser Plugin
https://cordova.apache.org/
Apache License 2.0
1.11k stars 2.14k forks source link

app freeze/unresponsive if closed without pressing close button #566

Open timmliu opened 4 years ago

timmliu commented 4 years ago

Bug Report

App freezes/becomes unresponsive if the in app browser is closed by swiping down instead of hitting the Close button.

Problem

What is expected to happen?

I would expect swiping down to have the same result as pressing the Close button and the app to continue to work as normal.

What does actually happen?

App becomes unresponsive, nothing in the UI works, there are no errors thrown or logs shown. Force killing the app resolves the issue.

Information

I'm using _blank for the in app modal, and usewkwebview=yes. Pulling latest master 80feff6cf8e3def9bdd388e56d6cb2dbb44a2d2c fixes the in app browser not showing up (issue in 3.1.0) but there is still an issue with swiping the browser modal away, which will not work as expected. I have tried various forks and updating other packages but have not been able to resolve.

Command or Code

Open in app browser, when closing, instead of pressing Close button (which works), swipe the modal down to dismiss it. The UI becomes unresponsive afterward.

Environment, Platform, Device

iOS 13.

Version information

"cordova": "^8.1.2", "cordova-ios": "^5.0.0", "cordova-plugin-ionic-keyboard": "^2.1.3", "cordova-plugin-wkwebview-engine": "^1.1.4", "cordova-plugin-wkwebviewxhrfix": "git+https://github.com/TheMattRay/cordova-plugin-wkwebviewxhrfix.git", "cordova-plugin-inappbrowser": "git+https://github.com/apache/cordova-plugin-inappbrowser.git", ...

Checklist

rajild commented 4 years ago

I am also facing this issue.

Build prepared with Xcode 11 and running on iOS 13 simulator with usewkwebview=yes

Any progress on this issue?

timmliu commented 4 years ago

This is not a fix but a workaround by playing with the options. I have it working with:

{
  usewkwebview: "yes",
  clearcache: "yes",
  location: "no",
  fullscreen: "yes",
  enableViewportScale: "yes",
  toolbar: "yes",
  hidenavigationbuttons: "yes",
  closebuttoncolor: "#8EA9F6",
  closebuttoncaption: "Close",
  presentationstyle: "fullscreen",
  transitionstyle: "crossdissolve",
  toolbartranslucent: "no",
  toolbarposition: "bottom"
}

The difference maker here is presentationstyle: "fullscreen", which actually prevents the swipe-down closing action. You can only close it using the Close button, which circumvents the bug.

I coupled it with transitionstyle: "crossdissolve" so that it doesn't look like it's sliding up when it opens (which might subliminally indicate to the user they can swipe down to close it).

kobbe82 commented 4 years ago

Same issue here, swiping down to dismiss should atleast trigger an exit event. More information can be found here: https://medium.com/@hacknicity/view-controller-presentation-changes-in-ios-13-ac8c901ebc4e

rajashekaranugu commented 4 years ago

This is not a fix but a workaround by playing with the options. I have it working with:

{
  usewkwebview: "yes",
  clearcache: "yes",
  location: "no",
  fullscreen: "yes",
  enableViewportScale: "yes",
  toolbar: "yes",
  hidenavigationbuttons: "yes",
  closebuttoncolor: "#8EA9F6",
  closebuttoncaption: "Close",
  presentationstyle: "fullscreen",
  transitionstyle: "crossdissolve",
  toolbartranslucent: "no",
  toolbarposition: "bottom"
}

The difference maker here is presentationstyle: "fullscreen", which actually prevents the swipe-down closing action. You can only close it using the Close button, which circumvents the bug.

I coupled it with transitionstyle: "crossdissolve" so that it doesn't look like it's sliding up when it opens (which might subliminally indicate to the user they can swipe down to close it).

@timmliu thanks a lot. it worked for me. I have also opend an issue https://github.com/apache/cordova-plugin-inappbrowser/issues/612. closing it now.

tHANKS AGAIN

torgnywalin commented 4 years ago

This is not a fix. This is just changing it back to how it was before. What if we want to use Pagesheet. It most be possible to listen for swipe event and dismiss as if we clicked the close button?

chriswardo commented 4 years ago

Is there any update on this? It means that pagesheet should never be used. It should either be removed as an option or fixed.

am5815 commented 4 years ago

Is there any update on this? I actually want to keep the in app browser running after swiping down and hiding it but that as mentioned freezes the app. Is there any work around to minimize the browser, have it running in the background and go back to the app?

gnarco commented 3 years ago

Same issue here ...

timbru31 commented 3 years ago

Is this reproducible in a new, plain Cordova app? A minimal reproduction repository would really help to debug and later fix this issue. More information on how to create one: https://github.com/apache/cordova-contribute/blob/master/create-reproduction.md

gnarco commented 3 years ago

I will post a sample app ASAP

gnarco commented 3 years ago

@timbru31, here a repo to reproduce : https://github.com/gnarco/inappbrowser-bug

on iOS, on app launch, it opens "in app browser" with a set predefined options.

If I switch to : presentationstyle : fullscreen, it works. But in fact, it's just a workaround, because I can't slide to quit anymore :)

Thanks

koczka commented 3 years ago

I got a solution.

In my case, I was using the iab, to show a login portal, from an identity provider (SSO login), and when I got redirected with the user data, I'd navigate the user to the logged in home screen inside the ionic app.

The only modification I needed to do in my code, is to wrap the router.navitage method in a ngZone.run block. So in my case it wasn't the plugin, it was angular that caused the behaviour.

this.ngZone.run(() => {
    browser.close();
    this.router.navigate(['/home'], { replaceUrl: true });
});
FlawaCLV commented 3 years ago

Any update on this issue ?

antonello-alfatauristudio commented 3 years ago

any update on this?

hooliapps commented 8 months ago

Hello, i confirm that the code works on iOS 17 ?

Any plan to commit this in main depot ?