Skip to content

Commit

Permalink
fix: infinite loop in signal search page
Browse files Browse the repository at this point in the history
  • Loading branch information
AuroraZiling committed Jul 24, 2024
1 parent 8355c92 commit c3f8172
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
4 changes: 2 additions & 2 deletions Hollow/Services/GachaService/GachaService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ public partial class GachaService(IConfigurationService configurationService, Ht
gachaRecords = JsonSerializer.Deserialize<GachaRecords>(await File.ReadAllTextAsync(AppInfo.GachaRecordPath))!;
}

var gachaRecordProfileDictionary = gachaRecords.Profiles.ToDictionary(item => item.Uid, item => item);
var gachaRecordProfileDictionary = gachaRecords.Profiles.ToDictionary(item => item.Uid, item => item);
foreach (var profile in gachaRecordProfileDictionary.Keys)
{
gachaRecordProfileDictionary[profile].List = gachaRecordProfileDictionary[profile].List.OrderByDescending(item => item.Id).ToList();
}

GachaRecordProfileDictionary = gachaRecordProfileDictionary;
return gachaRecordProfileDictionary;
return GachaRecordProfileDictionary;
}

private string GetLatestTime(string uid, string gachaType)
Expand Down
11 changes: 7 additions & 4 deletions Hollow/ViewModels/Pages/SignalSearchViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,12 @@ public partial class SignalSearchViewModel : ViewModelBase, IViewModelBase
public void Navigated()
{
if (_navigationService.CurrentViewName != nameof(SignalSearch)) return;

GetGachaLogTitle = Lang.SignalSearch_ProhibitedCoverage_Loading;
_ = LoadGachaRecords();

if(GetGachaLogShortMessage == "")
{
_ = LoadGachaRecords();
}
}

[ObservableProperty] private string _getGachaLogTitle = Lang.SignalSearch_ProhibitedCoverage_Loading;
Expand Down Expand Up @@ -79,7 +82,6 @@ private async Task LoadGachaRecords(string? updatedUid = null)
// Gacha Records
GetGachaLogShortMessage = Lang.SignalSearch_LoadGachaRecords_GachaRecords;
_gachaProfiles = await _gachaService.LoadGachaRecordProfileDictionary();

if (_gachaProfiles is null || _gachaProfiles!.Count == 0)
{
GetGachaLogShortMessage = Lang.SignalSearch_LoadGachaRecords_GachaRecordsNotFound;
Expand All @@ -94,7 +96,8 @@ private async Task LoadGachaRecords(string? updatedUid = null)
UidList = new ObservableCollection<string>(_analyzedGachaProfiles!.Keys);
SelectedUid = UidList.FirstOrDefault(uid => uid == updatedUid) ?? UidList.First();
SelectedAnalyzedGachaRecords = _analyzedGachaProfiles[SelectedUid];
await Task.Delay(100);

await Task.Delay(1000);

RemoveCoverage();
}
Expand Down
7 changes: 4 additions & 3 deletions Hollow/Views/MainWindow.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@
x:Class="Hollow.Views.MainWindow"
x:DataType="vm:MainWindowViewModel"
xmlns="https://github.com/avaloniaui"
xmlns:acrylic="clr-namespace:Hollow.Views.Controls.Acrylic"
xmlns:asyncImageLoader="clr-namespace:AsyncImageLoader;assembly=AsyncImageLoader.Avalonia"
xmlns:avalonia="clr-namespace:FluentIcons.Avalonia;assembly=FluentIcons.Avalonia"
xmlns:controls="clr-namespace:Hollow.Views.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:markupExtensions="clr-namespace:FluentIcons.Avalonia.MarkupExtensions;assembly=FluentIcons.Avalonia"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:pages="clr-namespace:Hollow.Views.Pages"
xmlns:vm="using:Hollow.ViewModels"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:Hollow.Views.Controls"
xmlns:acrylic="clr-namespace:Hollow.Views.Controls.Acrylic">
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

<VisualLayerManager>
<VisualLayerManager.ChromeOverlayLayer>
Expand All @@ -32,6 +32,7 @@
IsHitTestVisible="False"
Stretch="UniformToFill"
asyncImageLoader:ImageLoader.Source="{Binding BackgroundUrl}" />
<Panel Background="{StaticResource CoverageBackground}" Opacity="{Binding CoverageOpacity}" />
<acrylic:Acrylic
Blur="20"
HorizontalAlignment="Left"
Expand Down

0 comments on commit c3f8172

Please sign in to comment.