-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix inappbrowser not opening on iOS 13 by using reusable window #534
Conversation
@dpa99c You are probably the right person to review this. I cannot add you as a reviewer. A very short test with the test harness looked good. |
OK will give it a test when I get a mo |
@NiklasMerz I've given your branch a test but it seems to suffer a from a bug I've previously encountered: Here's the steps to reproduce:
It's been a long time since I encountered this bug but it must be related to some of the code you've removed/changed in this PR. I'm pretty sure the bug will occur in other versions of iOS too - IIRC I encountered it in iOS 11/12. |
Unfortunately I can reproduce this. Do you know why the WKIAB is opened differently than UIWebView? The thing with the reusable window seems to fix the closing issue but causes this issue. I guess I need to debug more. |
I think the problem is the UIWebView open code has been changed a lot of times reintroducing the mentioned bug, so by making them equal you've propagated the bug to the WKWebView implementation. They key part of the fix was to have a reference to the tmpWindow, so you can do that in the PR without changing the whole code to match the UIWebView code. |
480e8da
to
6e9aa99
Compare
6e9aa99
to
8810c6a
Compare
I reverted some changes from the first version. But it is still not working. That's strange, something else must be different UIIAB. |
Removed tmpWindow and controller. This was introduced to fix IAB with WKWebView before WKIAB existed.
Now I took a completely different approach, that seems to fix this. I dug through the git history and found this commit: f32917d It looks like the tmpWindow and tmpController stuff was needed to get IAB working before WKInAppBrowser existed 3 years ago. I tested the code that was used before this changed and looks like it is working. Further testing needed! |
Aaaand I found a bug with this attempt. Running Unfortunately I will not be able to work on this for some time. Feel free to push to this branch or create PRs. I will follow the conversation and try my best to contribute this when I have time. |
That was added because the presented view controller was causing the Cordova WKWebView to get frozen while it was presented, so the IAB events (loadstart, loadend, etc.) weren't received in the Cordova window until the modal was dismissed, making them useless. Did you check if those events work with your approach? ideally should be tested at least with iOS 10 as Cordova and newer. |
I understand, makes sense. That's why |
I am still on it but this worked in a short test. I won't promise anything. Just another attempt. Maybe someone with more Objective C experince could review this. I have no idea if this |
Fixes close, hide and toolbar 'done' and makes cordova window responsive
Now it looks good in my app and the iab test app. I used iOS 12.4 and 13.1 to test this. I guess that is somehow the solution but I am not sure about the Objective-C syntax. Looking forward to reviews and tests! |
@NiklasMerz I'm going to take a look at this now (sorry, been real busy with the day job so OSS has had to come a poor second recently) |
@NiklasMerz I've tested your branch with the latest commits and it's looking good. I have found one edge case issue: if you open the IAB then hide it (instead of closing it) by calling
IMHO this is a fairly rare edge case that can be addressed at a later date - we can raise a separate issue to cover the edge case of hiding (instead of closing) the IAB and address it separately. @janpio what's your thoughts on this? |
Thank you @dpa99c for your great review. Regarding the hide issue that's something I forgot to test. In my last commit I moved the code with |
Yes that should work now. I am glad you spotted this bug. |
Will give it another test |
Yep that fixes the |
I downloaded the master branch and it did resolved the inappbrowser shows and disappears right away issue. When will it be pushed so we can get it through npm install? |
Is there an ETA on the release and NPM package deployment? |
@dpa99c much love if you could npm deploy this bad boy :) |
Sorry I don't have the authority/ability to perform an npm release of this plugin |
This is an official Apache plugin. There is a process to follow. I guess there has to happen a vote and someone has to step up to make a release. I started a discussion on the mailing list. Let's see how that turn out. |
Thanks @NiklasMerz it got my attention. I am personally very reluctant to publish any plugins that I do not actively maintain. I just sent a private email to get someone else to publish this one. Please feel free to ping us again if needed. |
Is there any news about an npm install release? |
It's is still in discussion https://lists.apache.org/thread.html/9cf042a3a62fcad899a18759ed40a72087bfafd6cfe6dd48e77f61d1@%3Cdev.cordova.apache.org%3E You can always add the plugin from github to use this fix. |
Hello, |
…he window not opening on iOS 13.
Please add the latest plugin in your config.xml |
… on iOS 13 by using reusable window apache#534
…he window not opening on iOS 13.
this.iab.create(url,"_self") , not working in iOS , how to solve this |
Is the URL in the whitelist? See https://github.com/apache/cordova-plugin-inappbrowser#cordovainappbrowseropen Please open a new issue with a detailed description. We don't really monitor closed issues and PRs. |
Closes #492
Platforms affected
iOS
Motivation and Context
Solution for Issue #492 . InAppBrowser closed instantly after opening when using WKWebView and iOS 13 beta.
Description
Like @jcesarmobile suggested the show method for WKWebView now is similar to UIWebView. The
hidden
option is checked like UIWebView, too.Please review if this change is makes sense or the other show method was done like that for some reason.
Testing
Run sample app with hidden yes and no.
Checklist
(platform)
if this change only applies to one platform (e.g.(android)
)