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

Unified safe area (insets) for Android and iOS #23811

Merged
merged 3 commits into from
Mar 13, 2025

Conversation

Gregman-js
Copy link
Contributor

@Gregman-js Gregman-js commented Jan 20, 2025

Proposed change

I noticed minor differences between embedding WebView in iOS and Android.
Now the webview is not drawn under the navigation bar on Android, but on iOS it is.
I want to resolve part of this issue: draw webview under navigation bar on android.
env do not work on android, so I prepared another change for android repo to set --android-safe-area-inset-[...] (variable from this PR) on page load (PR, not required for this PR)
In this way, we can unify safe area on ios and android and create even more immersive views.
With these changes, we can also draw webview under status bar on android and iOS (require future work).
Working POC (left iOS, right android):
Screenshot 2025-01-20 at 17 18 57

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (thank you!)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Example configuration

Additional information

When Google will fix env support on android webview, we can just change property to env
First commit: new properties
Second commit: I've replaced all occurence of env in code for new properties

Checklist

  • The code change is tested and works locally.
  • There is no commented out code in this PR.
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

Copy link

@home-assistant home-assistant bot left a comment

Choose a reason for hiding this comment

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

Hi @Gregman-js

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

@home-assistant
Copy link

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

@home-assistant home-assistant bot marked this pull request as draft January 20, 2025 16:37
@github-actions github-actions bot added Supervisor Related to the supervisor panel Demo Related to frontend demo content labels Jan 20, 2025
@Gregman-js Gregman-js marked this pull request as ready for review January 20, 2025 16:42
@Gregman-js
Copy link
Contributor Author

As @jpelgrom said in the linked issue. We need to think about how to handle situation where user have updated android app and old server which do not support new css variables yet...

Copy link
Contributor

@MindFreeze MindFreeze left a comment

Choose a reason for hiding this comment

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

I am a bit concerned by this as var has a different scope than env so we have to test it thoroughly

@marcinbauer85
Copy link
Contributor

Could this also fix the issue on most dialogs and their actions like save/cancel etc?
IMG_6B4E01F9B617-1

@Gregman-js
Copy link
Contributor Author

@marcinbauer85 This PR won't fix this. But I think we need to fix this issue before introducing android changes. It is possible to click this button (on screenshot above) with navigation bar, but it can be impossible to do it with 3 button navigation on android if this view does not respect safe area insets.

@marcinbauer85
Copy link
Contributor

Yes please, that would be great!

@MindFreeze MindFreeze self-assigned this Mar 12, 2025
@MindFreeze MindFreeze merged commit ee10f90 into home-assistant:dev Mar 13, 2025
15 checks passed
@wendevlin
Copy link
Contributor

Hey @Gregman-j,

We had issues in the dev build with your PR, because of that we reverted it.

Please reopen it and try to fix the issues:

  • open sidebar overlays content
  • missing fab buttions in areas view

We found out that you set --safe-area-inset-left (and the others) in styles.ts but this are styles that need to be explicitly imported by components.

You should add your settings to ha-style.ts to have it set everywhere. Please try and let us know.

wendevlin added a commit that referenced this pull request Mar 14, 2025
Revert "Unified safe area (insets) for Android and iOS (#23811)"

This reverts commit ee10f90.
@Gregman-js Gregman-js deleted the unified-safe-area branch March 19, 2025 11:51
@Gregman-js
Copy link
Contributor Author

New fixed PR: #24689

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed Demo Related to frontend demo content Supervisor Related to the supervisor panel
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants