Only refresh metadata, not whole applications list

This commit is contained in:
Théo Arrouye 2023-06-04 21:32:20 -07:00
parent ac716fb3b8
commit 8051e3710b
2 changed files with 18 additions and 2 deletions

View file

@ -1363,7 +1363,7 @@ namespace Ryujinx.Ava.UI.ViewModels
if (prevUserId != AccountManager.LastOpenedUser.UserId)
{
// current user changed, so refresh application metadata
LoadApplications();
RefreshApplicationsMetadata();
}
}
@ -1372,6 +1372,22 @@ namespace Ryujinx.Ava.UI.ViewModels
AppHost.Device.System.SimulateWakeUpMessage();
}
private async void RefreshApplicationsMetadata()
{
await Task.Run(() => {
foreach (var app in _applications)
{
var metadata = ApplicationLibrary.LoadAndSaveMetaData(AccountManager.LastOpenedUser.UserId.ToLibHacFsUid(), app.TitleId);
app.Favorite = metadata.Favorite;
app.LastPlayed = metadata.LastPlayed;
app.TimePlayedNum = metadata.TimePlayed;
app.TimePlayed = ApplicationLibrary.ConvertSecondsToFormattedString(metadata.TimePlayed);
}
});
RefreshView();
}
public async void LoadApplications()
{
await Dispatcher.UIThread.InvokeAsync(() =>

View file

@ -733,7 +733,7 @@ namespace Ryujinx.Ui.App.Common
return applicationIcon ?? _ncaIcon;
}
private static string ConvertSecondsToFormattedString(double seconds)
public static string ConvertSecondsToFormattedString(double seconds)
{
System.TimeSpan time = System.TimeSpan.FromSeconds(seconds);