-
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
(ios) Remove fake status bar with hardcoded height to fix issues in iOS devices with a notch #656
(ios) Remove fake status bar with hardcoded height to fix issues in iOS devices with a notch #656
Conversation
…OS devices with a notch
what's the point of keeping the bgToolbar if you just set it to clearColor? shouldn't you just remove all the references to it? |
I removed the bgToolbar and retested: everything worked fine. I am going to commit the change. Thanks for pointing it out. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did a quick test and the code looks good to me. Thank you for your contribution.
I found a small bug. If you open an InAppBrowser window and turn your iPhone (no notch) from portrait to horizontal the statusbar height is not changed and you can see your app below the IAB window. If you start IAB in horizontal and turn your phone the statusbar is white in my case and you cannot read the text.
Looks like the views need to reposition in this case.
Thanks for finding this issue. It should be fixed in my last commit. I also refactored/simplified the code. In my tests if worked fine with devices with and without notch, with top toolbar enabled and disabled. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests on non-notch iPhone and notch Simulator are good for me. Code looks good but someone else should have a look. :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good from my side 👍
@PDLMobileApps Could you please resolve the conflict? I don't want to break it :-) I would like to invite others to review before merging it first. Sorry it might take some time for people to find time. I will add some people that understand this better. |
Sure, that's fine. The conflict is resolved, by the way. |
Did you try to build iOS for this pull ? I try to build iOS using cordova build, but the build failed for this pull. |
I am using this PR in a prod environment. I build multiple times a day for iOS and got zero issues. You may want to delete your platform folder, plugins folder, package.json and package-lock.json then retry. |
My friend, i create a new empty app and add platform and build it Try many times also by removing the platforms and folders but the build failed. If anyone can test it from their sides to check the problem. I am using: The latest version of Corodva-ios master version Xcode latest version. What i remeber about the build error was about something of objective-c ..... |
Just created and tested an iOS build using the bug-hardcodedstatusbar branch where the changes for this PR were made. I confirm that everything works fine. |
Message from cordova build: ** BUILD FAILED ** The following build commands failed:
|
Works excellent. Thanx for fix guys. |
Hey guys, any idea when this PR will get merged? |
+1 this is a blocker for me as well... |
I tested it also and it works ok. Thanks for the fix. |
@jcesarmobile @dpa99c Do you have time for a quick review? What do you think? |
@NiklasMerz sorry started to review this yesterday and got side-tracked. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested and looks good to me
@dpa99c Thanks for the review |
Great! Thanks a lot!! |
Thanks for the review and test, nice job! |
Thank you! |
@PDLMobileApps @NiklasMerz @dpa99c I try to test it in my mac Here the message: The following build commands failed: I opened project in xcode to see what the errors, I see this error: /Users/mosab/Documents/myapp/platforms/ios/testapp/Plugins/cordova-plugin-inappbrowser/CDVWKInAppBrowser.m:1250:42: No known instance method for selector 'shouldAutorotateToInterfaceOrientation:' Could you please investigate about this issue ? Thanks ! |
@mosabab You should create a new issue with the bug form filled out. |
thanks for advice. |
Do you know why the following code was re-added? cordova-plugin-inappbrowser/src/ios/CDVWKInAppBrowser.m Lines 1247 to 1254 in 04ce789
Appears to be a regression, as pointed out by #714 (comment) |
Looks like a merge conflict.I don't really understand it. Preparing a PR to fix it. Code was removed in #666 |
@NiklasMerz Hello, sorry for the mention, but I have a question please regarding this PR. After this PR remove the fake statusbar, I face a problem with transparent statusbar after inappbrowser appear. How we can handle this to make status bar visible when inappbrowser opened? Does you have a solution for it? because I don't see any information regarding this. Regards |
You can add the cordova-plugin-status bar and set the status bar color like this: |
Thanks for information, I try it and work correctly. But what about if user change the device to dark theme or light theme? I think the statusbar color work in dark theme and in other ways in light themes. How we can handle this? Thanks |
@PDLMobileApps I face this issue as others. How we can deal with your pull and dark theme for iOS? |
Platforms affected
iOS
Motivation and Context
IAB adds what has been referred as a "fake status bar" that creates issues on devices with a notch, such as iPhone X/XS/XM, etc.
In order to fix such issues, the fake status bar has to be removed.
Fixes: #604, #638, #301
Related to: #546, #265
Description
The fake status bar is removed from the IAB window and both height and the position of the IAB window is modified to account for the (real) iOS status bar. That is needed to correctly display the content of the iOS status bar without overlapping the content in the IAB window in portrait mode.
The color of the iOS status bar is set to transparent to match the background color of the underlying Cordova app.
Testing
Testing was done manually as I am not sure on how to automate it.
Created a new Cordova test app using cordova-plugin-inappbrowser.
Executed:
cordova.InAppBrowser.open(url, "_blank", "");
and verified that the iOS status bar is shown around the notch and the web view is displayed just below the iOS status bar (default behavior for iOS apps). The status bar color matches the background color of the underlying Cordova app.
Executed:
cordova.InAppBrowser.open(url, "_blank", "toolbar=yes,toolbarposition=top");
and verified that the iOS status bar is shown around the notch, the toolbar is displayed just below the iOS status bar and the web view is displayed just below the toolbar (default behavior for iOS apps). The status bar color matches the background color of the underlying Cordova app.
Executed:
cordova.InAppBrowser.open(url, "_blank", "toolbar=yes,toolbarposition=top");
on a device without notch and verified that the iOS status bar is shown on the top of the screen, the toolbar is displayed just below the iOS status bar and the web view is displayed just below the toolbar (default behavior for iOS apps). The status bar color matches the background color of the underlying Cordova app.
The tests above were executed for both portrait and landscape orientation. Note that in landscape mode, no status bar is displayed, which is the default iOS behavior for that mode with any app.
Checklist
(platform)
if this change only applies to one platform (e.g.(android)
)