Skip to content

Commit

Permalink
fixed device informations not loading when no update is there
Browse files Browse the repository at this point in the history
  • Loading branch information
Aytackydln committed Oct 14, 2023
1 parent 8d22d7a commit dde66e2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,7 @@ public static async Task<Dictionary<string, DeviceTooltips>> GetDeviceTooltips()
await using var jsonTextReader = new JsonTextReader(stream);

var serializer = JsonSerializer.CreateDefault();
var result = serializer.Deserialize<Dictionary<string, DeviceTooltips>>(jsonTextReader) ?? new Dictionary<string, DeviceTooltips>();

//Save to local cache
await using var jsonTextWriter = new JsonTextWriter(new StreamWriter(File.Create(DeviceTooltipsLocalCache)));
serializer.Serialize(jsonTextWriter, result);

return result;
return serializer.Deserialize<Dictionary<string, DeviceTooltips>>(jsonTextReader) ?? new Dictionary<string, DeviceTooltips>();
}

private static StreamReader GetJsonStream(string cachePath)
Expand Down
8 changes: 7 additions & 1 deletion Project-Aurora/Project-Aurora/Modules/OnlineSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,13 @@ protected override async Task Initialize()
{
SystemEvents.SessionSwitch += SystemEvents_SessionSwitch;

await DownloadAndExtract();
await Refresh();

RunningProcessMonitor.Instance.RunningProcessesChanged += OnRunningProcessesChanged;
}

private async Task Refresh()
private async Task DownloadAndExtract()
{
try
{
Expand Down Expand Up @@ -74,7 +75,10 @@ private async Task Refresh()

_layoutUpdateTaskSource.TrySetResult();
Global.Configuration.OnlineSettingsTime = commitDate;
}

private async Task Refresh()
{
try
{
await UpdateConflicts();
Expand All @@ -83,6 +87,7 @@ private async Task Refresh()
{
Global.logger.Error(e, "Failed to update conflicts");
}

try
{
await UpdateDeviceInfos();
Expand Down Expand Up @@ -132,6 +137,7 @@ private async void SystemEvents_SessionSwitch(object sender, SessionSwitchEventA
{
return;
}
await DownloadAndExtract();
await Refresh();
}

Expand Down

0 comments on commit dde66e2

Please sign in to comment.