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

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Oqtane.Client/UI/Head.razor
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
[Parameter]
public string RenderMode { get; set; }

[Parameter]
public string Platform { get; set; }

[Parameter]
public string Runtime { get; set; }

Expand All @@ -30,6 +33,11 @@
((INotifyPropertyChanged)SiteState.Properties).PropertyChanged += PropertyChanged;
}

protected override async Task OnParametersSetAsync()
{
SiteState.Platform = Platform;
}

private void PropertyChanged(object sender, PropertyChangedEventArgs e)
{
switch (e.PropertyName)
Expand Down
1 change: 1 addition & 0 deletions Oqtane.Maui/Head.razor
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
Parameters = new Dictionary<string, object>();
Parameters.Add(new KeyValuePair<string, object>("RenderMode", RenderModes.Interactive));
Parameters.Add(new KeyValuePair<string, object>("Runtime", Runtimes.Hybrid));
Parameters.Add(new KeyValuePair<string, object>("Platform", DeviceInfo.Current.Platform.ToString()));
}
}

1 change: 1 addition & 0 deletions Oqtane.Shared/Shared/SiteState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public class SiteState
public string AuthorizationToken { get; set; } // passed from server for use in service calls on client
public string RemoteIPAddress { get; set; } // passed from server as cannot be reliably retrieved on client
public bool IsPrerendering { get; set; }
public string Platform { get; set; } //updated by Maui to retrieve platform in client

private dynamic _properties;
public dynamic Properties => _properties ?? (_properties = new PropertyDictionary());
Expand Down