Skip to content
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(ios): prevent statusbar rotation after closing InAppBrowser #672

Merged
merged 2 commits into from
Apr 27, 2020

Conversation

jcesarmobile
Copy link
Member

Platforms affected

ios

Motivation and Context

closes #623

Description

according to the stackoverflow link, setting the tmpWindow to hidden should release it and the regular window would take control, but it's not being released and that causes the statusbar to rotate (because the tmpController can rotate to any direction).
Setting the tmpWindow to nil releases it and the original window takes control and fixes the issue.

Testing

Checklist

  • I've run the tests to see all new and existing tests pass
  • I added automated test coverage as appropriate for this change
  • Commit is prefixed with (platform) if this change only applies to one platform (e.g. (android))
  • If this Pull Request resolves an issue, I linked to the issue in the text above (and used the correct keyword to close issues using keywords)
  • I've updated the documentation if necessary

Copy link
Member

@timbru31 timbru31 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to set the tmpWindow to nil in the hide method, too?
This change should be backwards compatible, shouldn't it?

@jcesarmobile
Copy link
Member Author

not really sure what's the difference between hide and close, but if hide is supposed to not destroy the IAB, then probably shouldn't be done there as it might destroy the IAB session too, but didn't try

@jeirasmus
Copy link

jeirasmus commented Apr 18, 2020

@jcesarmobile

Nice fix, but not fully working at least with our application. If you close the inappbrowser in landscape mode and application under it returns to be in fixed portrait mode, view (UI is has moved) is a little bit higher after that. If you keep device on portrait all the time, that does not happen.

It is easy to see if you have navigation bar on top of your UI and you can see it to be more narrow.

@jcesarmobile
Copy link
Member Author

That’s a different problem

@jcesarmobile
Copy link
Member Author

@timbru31, I tested and the rotation was happening when using hide, so I've set it to nil on hide too.
Setting the window to nil doesn't affect the IAB VC, if you call show later it keeps showing last page it was showing before calling hide (meaning, IAB VC doesn't get destroyed, only the tmpWindow, and the tmpWindow gets recreated on show method).

Copy link
Member

@NiklasMerz NiklasMerz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did some quick tests and it looks good to me.

@jcesarmobile jcesarmobile merged commit 2793e16 into apache:master Apr 27, 2020
@jcesarmobile jcesarmobile deleted the fix-rotation branch April 27, 2020 15:54
@isdh isdh mentioned this pull request Jun 11, 2020
5 tasks
tanumoypati pushed a commit to tanumoypati/cordova-plugin-inappbrowser that referenced this pull request Jul 15, 2020
… statusbar rotation after closing InAppBrowser (apache#672)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Build with Xcode11 causes status bar rotate
4 participants