diff --git a/Bloxstrap/App.xaml.cs b/Bloxstrap/App.xaml.cs index 7f64ba9..81cecce 100644 --- a/Bloxstrap/App.xaml.cs +++ b/Bloxstrap/App.xaml.cs @@ -144,9 +144,19 @@ namespace Bloxstrap { // dont let user switch web environment if debug mode is not on if (Settings.Prop.WebEnvironment == WebEnvironment.Production || !Settings.Prop.DeveloperMode) - return $"bloxstraplabs.com"; + return "bloxstraplabs.com"; - return $"web-{Settings.Prop.WebEnvironment.GetDescription()}.bloxstraplabs.com"; + string? sub = Settings.Prop.WebEnvironment.GetDescription(); + return $"web-{sub}.bloxstraplabs.com"; + } + + public static bool CanSendLogs() + { + // non developer mode always uses production + if (!Settings.Prop.DeveloperMode || Settings.Prop.WebEnvironment == WebEnvironment.Production) + return IsProductionBuild; + + return true; } public static async Task GetLatestRelease() @@ -190,7 +200,7 @@ namespace Bloxstrap public static async void SendLog() { - if (!Settings.Prop.EnableAnalytics || !IsProductionBuild) + if (!Settings.Prop.EnableAnalytics || !CanSendLogs()) return; try diff --git a/Bloxstrap/Extensions/TEnumEx.cs b/Bloxstrap/Extensions/TEnumEx.cs index a662c3c..ddefb8f 100644 --- a/Bloxstrap/Extensions/TEnumEx.cs +++ b/Bloxstrap/Extensions/TEnumEx.cs @@ -7,7 +7,15 @@ namespace Bloxstrap.Extensions { public static string? GetDescription(this TEnum e) { - DescriptionAttribute? attribute = e?.GetType().GetCustomAttribute(); + string? enumName = e.ToString(); + if (enumName == null) + return null; + + FieldInfo? field = e.GetType().GetField(enumName); + if (field == null) + return null; + + DescriptionAttribute? attribute = field.GetCustomAttribute(); return attribute?.Description; } }