Skip to content

Commit

Permalink
Fixed settings anaytics event
Browse files Browse the repository at this point in the history
  • Loading branch information
Yelo420 committed Dec 18, 2024
1 parent 883636c commit f305c99
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions gamevault/Helper/AnalyticsHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,7 @@ private async Task SendHeartBeat(string url)
try
{
var jsonContent = new StringContent(JsonSerializer.Serialize(new AnalyticsData()), Encoding.UTF8, "application/json");
await client.PostAsync(url, jsonContent);
//string responseBody = await response.Content.ReadAsStringAsync();
await client.PostAsync(url, jsonContent);
}
catch (Exception e) { }

Expand Down Expand Up @@ -219,8 +218,7 @@ public void SendCustomEvent(string eventName, object meta)
{
var jsonContent = new StringContent(JsonSerializer.Serialize(new AnalyticsData() { Event = eventName, Metadata = meta, Timezone = timeZone, Language = language }), Encoding.UTF8, "application/json");
HttpResponseMessage res =
await client.PostAsync(AnalyticsTargets.CU, jsonContent);
string responseMessage = await res.Content.ReadAsStringAsync();
await client.PostAsync(AnalyticsTargets.CU, jsonContent);
}
catch { }
});
Expand Down Expand Up @@ -283,7 +281,7 @@ public object GetSysInfo()
return new { app_version = SettingsViewModel.Instance.Version, hardware_os = $"The system information could not be loaded due to an {ex.GetType().Name}" };
}
}
public string PrepareSettingsForAnalytics()
public Dictionary<string, string> PrepareSettingsForAnalytics()
{
try
{
Expand All @@ -294,10 +292,10 @@ public string PrepareSettingsForAnalytics()
.ToDictionary(prop => prop.Name, prop => prop.GetValue(SettingsViewModel.Instance).ToString());

trimmedObject.Add("HasLicence", (SettingsViewModel.Instance.License?.IsActive() == true).ToString());
return JsonSerializer.Serialize(trimmedObject);
return trimmedObject;
}
catch { }
return "Something went wrong";
return null;
}
private bool IsWineRunning()
{
Expand Down

0 comments on commit f305c99

Please sign in to comment.