Skip to content

Commit

Permalink
Add maximum score to the results for developers.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jack251970 committed Dec 24, 2024
1 parent 1c01fa4 commit 269e583
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions Flow.Launcher.Plugin/Result.cs
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,11 @@ public ValueTask<bool> ExecuteAsync(ActionContext context)
/// </summary>
public bool AddSelectedCount { get; set; } = true;

/// <summary>
/// Maximum score. This can be useful when set one result to the top by default. This is the score for the results set to the topmost by users.
/// </summary>
public const int MaxScore = int.MaxValue;

/// <summary>
/// Info of the preview section of a <see cref="Result"/>
/// </summary>
Expand Down
4 changes: 2 additions & 2 deletions Flow.Launcher/ViewModel/MainViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1471,9 +1471,9 @@ public void UpdateResultView(ICollection<ResultsForUpdate> resultsForUpdates)
{
if (_topMostRecord.IsTopMost(result))
{
result.Score = int.MaxValue;
result.Score = Result.MaxScore;
}
else if (result.Score != int.MaxValue)
else if (result.Score != Result.MaxScore)
{
var priorityScore = metaResults.Metadata.Priority * 150;
result.Score += result.AddSelectedCount ?
Expand Down

0 comments on commit 269e583

Please sign in to comment.