Skip to content

Commit

Permalink
Fixed ClientOsVersion
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Hindrikes authored and dhindrik committed Sep 3, 2024
1 parent 4d5b552 commit 9104078
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion TinyInsights.Web/Services/Models/ErrorItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,32 @@ public ErrorItem(Dictionary<string, string?> data)
public string? ClientType => GetData("client_Type");
public string? ClientModel => GetData("client_Model");
public string? ClientOs => GetData("client_OS");
public string? ClientOsVersion => GetData("OperatingSystemVersion") ?? GetData("client_Browser");
public string? ClientOsVersion
{
get
{
var os = GetData("OperatingSystemVersion");

if(os!= null)
{
return os;
}

// For android it can be forexample Android 14.
var browser = GetData("client_Browser");

if(browser != null)
{
var split = browser.Split(" ");
if(split.Length > 1 && double.TryParse(split[1], out var version))
{
return version.ToString();
}
}

return null;
}
}
public string? ClientCity => GetData("client_City");
public string? ClientState => GetData("client_StateOrProvince");
public string? ClientCountry => GetData("client_CountryOrRegion");
Expand Down

0 comments on commit 9104078

Please sign in to comment.