maui
                                
                                 maui copied to clipboard
                                
                                    maui copied to clipboard
                            
                            
                            
                        [iOS] Implemented PrefersHomeIndicatorAutoHidden, PrefersStatusBarHidden and PreferredStatusBarUpdateAnimation Platform Specifics
Description of Change
Implemented PrefersHomeIndicatorAutoHidden
Here's a repo with sample pages in the sandbox project that demonstrate the behavior: https://github.com/kubaflo/maui/tree/ios-homeIndicatorHidden-implemented-with-samples
Issues Fixed
Fixes https://github.com/dotnet/maui/issues/19970
Demo
https://github.com/dotnet/maui/assets/42434498/378178be-61c3-4183-9afc-2877df2a2ba3
Hey there @kubaflo! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.
@dotnet-policy-service agree
O this is wonderful! Thank you so much for your helping hand @kubaflo
/azp run
Azure Pipelines successfully started running 3 pipeline(s).
/rebase
Looks good , can we add a gallery page to test this, and maybe a simple UITests with screenshot to verify this works as expected and avoid regressions in the future?
Thanks
Looks good , can we add a gallery page to test this, and maybe a simple UITests with screenshot to verify this works as expected and avoid regressions in the future?
Thanks
Hi @rmarinho there's a demo for this functionality here: Maui.Controls.Sample.Pages -> iOSHideHomeIndicatorPage
A problem with the UITest for this is that the tests are a modal page, so setting prefer PrefersHomeIndicatorAutoHidden doesn't work for them
can we rebase please? :)
can we rebase please? :)
sure! done
And just to be clear I see this PR is marked to fix https://github.com/dotnet/maui/issues/19970 but I think the issue described two more properties that are not implement by this PR right @kubaflo ? So let's make sure to not close the issue if that's the case?
@jfversluis I will implement the 2 other properties as well
@jfversluis @PureWeen @mattleibow I've implemented the two more properties and applied the changes you asked me to
Could you include the sample from https://github.com/kubaflo/maui/tree/ios-homeIndicatorHidden-implemented-with-samples in https://github.com/dotnet/maui/tree/main/src/Controls/samples/Controls.Sample/Pages/PlatformSpecifics/iOS?
@jsuarezruiz I've added a sample as you requested :)
Hi @kubaflo, I pulled down your branch and tried out the Controls.Gallery app and it looks like some of the pages got mixed up. The HideStatusBar page looks to represent the HideHomeIndicator page (and is missing the previous options to hidestatusbar and affect its animation) And The HideHomeIndicator page's toggle button doesn't seem to work and is also missing the options for the different pages.
Also, the FlyoutPage doesn't seem to have a button to toggle HideHomeIndicator.
Hello @dustin-wojciechowski, you're absolutly right. I mixed up HideStatusBar and HideHomeIndicator😅 My bad. Thanks for letting me know! I did a force push that fixes my mistake. (I've also fixed the flyout page)
@kubaflo Great, looks good! The only other thing I noticed was that I can't get the PreferredStatusBarUpdateAnimation toggle button to actually change the animation of the status bar hiding... does it work for you? I wonder if it's because of the way the Gallery page was created or if the animation is being set or not. The toggle for hiding the status bar does work, so I can see that it's cycling correctly between default, on and off.
@kubaflo Great, looks good! The only other thing I noticed was that I can't get the PreferredStatusBarUpdateAnimation toggle button to actually change the animation of the status bar hiding... does it work for you? I wonder if it's because of the way the Gallery page was created or if the animation is being set or not. The toggle for hiding the status bar does work, so I can see that it's cycling correctly between default, on and off.
I believe it is related to the way users navigate to the page as described here: https://stackoverflow.com/questions/52993569/status-bar-not-animating-in-iphone-x
When I set breakpoints here:https://github.com/dotnet/maui/blob/ced005bbb10ce5f25a7350583db97276281ff5eb/src/Core/src/Platform/iOS/PageViewController.cs#L42 the overridden value is correctly updating.
Included a video of what this looks like for posterity's sake... I can see in the code that it's cycling between none, slide and fade like you said but looks like it's stuck on none.
https://github.com/dotnet/maui/assets/89540402/8e3dec80-82c1-4cfc-877c-619d0c868ca2
Here's an example of the desired behavior I found online (set to slide):

From the same Stackoverflow post a user suggested enabling controller-based status bar appearance to YES in gallery's .plist but looks like we already have that set to true.
Another guess is that in some of the other renderers, such as PageRenderer's version of UpdateStatusBarPreferHidden(), we're calling UIView.Animate() in addition to SetNeedsStatusBarAppearanceUpdate(), although it seems that NavigationRenderer in the Gallery page handles this somewhat differently.
@dustin-wojciechowski looks to me like Apple got rid of this functionality. Check this sample app I've created in Xcode
I also found this post: https://stackoverflow.com/questions/69291840/uistatusbaranimation-style-slide-not-working-in-ios-15
https://github.com/dotnet/maui/assets/42434498/289bc943-3ecf-4266-b348-e6479fbfc446
@kubaflo Very interesting, thanks for looking into that. It looks like the field isn't deprecated according to Apple's docs. I tried with a simulator with 15.5 and still get the problem. I'll have to see if I can find a way to test on an older platform to narrow it down.
/azp run
Azure Pipelines successfully started running 3 pipeline(s).
/azp run
/azp run
Azure Pipelines successfully started running 3 pipeline(s).
/azp run
Azure Pipelines successfully started running 3 pipeline(s).