mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Update the result when executing history item
This commit is contained in:
parent
c610100c13
commit
e404d02965
2 changed files with 25 additions and 0 deletions
|
|
@ -86,6 +86,28 @@ namespace Flow.Launcher.Storage
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update a result into the last-opened history list (<see cref="LastOpenedHistoryItems"/>).
|
||||
/// </summary>
|
||||
public void Update(Result result)
|
||||
{
|
||||
if (string.IsNullOrEmpty(result.OriginQuery.TrimmedQuery)) return;
|
||||
// History results triggered from homepage do not contain PluginID,
|
||||
// these are intentionally not saved otherwise cause duplicates due to subtitle
|
||||
// containing datetime string.
|
||||
if (string.IsNullOrEmpty(result.PluginID)) return;
|
||||
|
||||
// If the last item is the same as the current result, just update the icon path
|
||||
if (LastOpenedHistoryItems.Count > 0 &&
|
||||
TryGetLastOpenedHistoryResult(result, out var existingHistoryItem))
|
||||
{
|
||||
if (existingHistoryItem.IcoPath != result.IcoPath)
|
||||
{
|
||||
existingHistoryItem.IcoPath = result.IcoPath;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Attempts to find an existing <see cref="LastOpenedHistoryResult"/> in <see cref="LastOpenedHistoryItems"/>
|
||||
/// that is considered equal to the supplied <paramref name="result"/>.
|
||||
|
|
|
|||
|
|
@ -1383,6 +1383,9 @@ namespace Flow.Launcher.ViewModel
|
|||
// Record the user selected record for result ranking
|
||||
_userSelectedRecord.Add(reflectResult);
|
||||
|
||||
// Update the history with the reflected result
|
||||
_history.Update(reflectResult);
|
||||
|
||||
// Since some actions may need to hide the Flow window to execute
|
||||
// So let us populate the results of them
|
||||
return await reflectResult.ExecuteAsync(c);
|
||||
|
|
|
|||
Loading…
Reference in a new issue