mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
change getting last history item to get the same result if exists
This commit is contained in:
parent
10d3ba268d
commit
26ad473592
1 changed files with 11 additions and 5 deletions
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.Json.Serialization;
|
||||
|
|
@ -44,11 +44,11 @@ namespace Flow.Launcher.Storage
|
|||
LastOpenedHistoryItems.RemoveAt(0);
|
||||
}
|
||||
|
||||
// If the last item is the same as the current result, just update the timestamp
|
||||
if (LastOpenedHistoryItems.Count > 0 &&
|
||||
LastOpenedHistoryItems.Last().Equals(result))
|
||||
if (LastOpenedHistoryItems.Count > 0 &&
|
||||
TryGetLastOpenedHistoryResult(result, out var existingHistoryItem))
|
||||
{
|
||||
LastOpenedHistoryItems.Last().ExecutedDateTime = DateTime.Now;
|
||||
existingHistoryItem.IcoPath = result.IcoPath;
|
||||
existingHistoryItem.ExecutedDateTime = DateTime.Now;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -65,5 +65,11 @@ namespace Flow.Launcher.Storage
|
|||
});
|
||||
}
|
||||
}
|
||||
|
||||
private bool TryGetLastOpenedHistoryResult(Result result, out LastOpenedHistoryItem historyItem)
|
||||
{
|
||||
historyItem = LastOpenedHistoryItems.FirstOrDefault(x => x.Equals(result));
|
||||
return historyItem is not null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue