maui icon indicating copy to clipboard operation
maui copied to clipboard

[iOS] Implemented PrefersHomeIndicatorAutoHidden, PrefersStatusBarHidden and PreferredStatusBarUpdateAnimation Platform Specifics

Open kubaflo opened this issue 1 year ago • 23 comments

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

kubaflo avatar Jan 22 '24 14:01 kubaflo

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.

ghost avatar Jan 22 '24 14:01 ghost

@dotnet-policy-service agree

kubaflo avatar Jan 22 '24 14:01 kubaflo

O this is wonderful! Thank you so much for your helping hand @kubaflo

jfversluis avatar Jan 22 '24 15:01 jfversluis

/azp run

jfversluis avatar Jan 22 '24 15:01 jfversluis

Azure Pipelines successfully started running 3 pipeline(s).

azure-pipelines[bot] avatar Jan 22 '24 15:01 azure-pipelines[bot]

/rebase

rmarinho avatar Feb 12 '24 01:02 rmarinho

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

rmarinho avatar Feb 19 '24 11:02 rmarinho

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

kubaflo avatar Feb 20 '24 01:02 kubaflo

can we rebase please? :)

rmarinho avatar Mar 07 '24 12:03 rmarinho

can we rebase please? :)

sure! done

kubaflo avatar Mar 07 '24 13:03 kubaflo

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 avatar Mar 07 '24 20:03 jfversluis

@jfversluis I will implement the 2 other properties as well

kubaflo avatar Mar 07 '24 20:03 kubaflo

@jfversluis @PureWeen @mattleibow I've implemented the two more properties and applied the changes you asked me to

kubaflo avatar Mar 11 '24 00:03 kubaflo

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 :)

kubaflo avatar Mar 31 '24 01:03 kubaflo

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.

dustin-wojciechowski avatar Apr 05 '24 23:04 dustin-wojciechowski

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 avatar Apr 05 '24 23:04 kubaflo

@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.

dustin-wojciechowski avatar Apr 11 '24 20:04 dustin-wojciechowski

@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.

kubaflo avatar Apr 11 '24 23:04 kubaflo

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):

image

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 avatar Apr 13 '24 02:04 dustin-wojciechowski

@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 avatar Apr 14 '24 14:04 kubaflo

@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.

dustin-wojciechowski avatar Apr 15 '24 15:04 dustin-wojciechowski

/azp run

dustin-wojciechowski avatar Apr 16 '24 20:04 dustin-wojciechowski

Azure Pipelines successfully started running 3 pipeline(s).

azure-pipelines[bot] avatar Apr 16 '24 20:04 azure-pipelines[bot]

/azp run

PureWeen avatar Apr 25 '24 00:04 PureWeen

/azp run

PureWeen avatar Apr 25 '24 14:04 PureWeen

Azure Pipelines successfully started running 3 pipeline(s).

azure-pipelines[bot] avatar Apr 25 '24 14:04 azure-pipelines[bot]

/azp run

PureWeen avatar Apr 25 '24 21:04 PureWeen

Azure Pipelines successfully started running 3 pipeline(s).

azure-pipelines[bot] avatar Apr 25 '24 21:04 azure-pipelines[bot]