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

Use mobile web content for iPad and desktop for mac #2918

Merged
merged 1 commit into from
Aug 15, 2024
Merged

Conversation

bgoncal
Copy link
Member

@bgoncal bgoncal commented Aug 14, 2024

Summary

Screenshots

Link to pull request in Documentation repository

Documentation: home-assistant/companion.home-assistant#

Any other notes

@bgoncal bgoncal requested a review from a team August 14, 2024 11:03
@bgoncal bgoncal self-assigned this Aug 14, 2024
@bgoncal
Copy link
Member Author

bgoncal commented Aug 14, 2024

On hold while discussing #2908

@bgoncal bgoncal marked this pull request as draft August 14, 2024 11:07
@@ -136,6 +136,7 @@ final class WebViewController: UIViewController, WKNavigationDelegate, WKUIDeleg

config.userContentController = userContentController
config.applicationNameForUserAgent = HomeAssistantAPI.applicationNameForUserAgent
config.defaultWebpagePreferences.preferredContentMode = Current.isCatalyst ? .desktop : .mobile
Copy link
Member

Choose a reason for hiding this comment

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

If desktop is still used for Mac, I think the resulting user agent string would still unfortunately result in always serving the legacy frontend build, correct?

Copy link
Member Author

Choose a reason for hiding this comment

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

If I set "mobile" to be used for Mac the result user agent is even worse:

Mozilla/5.0 (iPad; CPU OS 14_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Home Assistant/2024.8 (io.robbie.HomeAssistant.dev; build:2024; macOS 14.5.0) Mobile/HomeAssistant, like Safari

Says "iPad" and "OS 14_5" which is not the iPad version (it's macOS version)

Copy link
Member

Choose a reason for hiding this comment

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

Ugh, yeah that's terrible. Like I said, Apple's fault.

Copy link
Member Author

Choose a reason for hiding this comment

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

Indeed and looking at historic data, they are not working to improve this 😅

@bgoncal bgoncal marked this pull request as ready for review August 15, 2024 05:12
@bgoncal bgoncal merged commit d6b2dc7 into master Aug 15, 2024
5 checks passed
@bgoncal bgoncal deleted the ipad-user-agent branch August 15, 2024 05:12
@bgoncal
Copy link
Member Author

bgoncal commented Aug 15, 2024

Now we need a solution for macOS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants