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

added property Platform to sitestate to detect maui platform #3890

Conversation

pyramidsbuilder
Copy link
Contributor

To detect the platform (ex: Android) in Maui rendering, and be able to do adjustments in Theme/Module:

added property platform to sitestate
pass the platform name from Maui
Use the platform name for adjustments in Theme/Module

@sbwalker
Copy link
Member

@pyramidsbuilder I do not understand the benefit of this enhancement. Adding this property to SiteState basically means that a module would need to inject the SiteState service into their component in order to reference the property value - which is more work than simply calling DeviceInfo.Current.Platform.ToString() from the component directly?

@pyramidsbuilder
Copy link
Contributor Author

@sbwalker "DeviceInfo.Current" .. is a Maui class, I could not access it from Module/theme, I wanted to know the platform on Module/theme level to hide/show , so I came to this solution, it is probably a special case or not very usable, but I thought about sharing it

@sbwalker
Copy link
Member

Ok... that makes sense. The SiteState service would be the correct place to store this information - it is intended for information which is provided by the hosting environment for the Blazor application. However, the Routes component (rather than the Head component) is the location where SiteState is initialized. Note that when running on Web there is the opportunity to use this same property to include information about the server environment. PR #3896 adds this functionality.

@sbwalker sbwalker closed this Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants