Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Flow.Launcher/Storage/LastOpenedHistoryItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ public class LastOpenedHistoryItem
public string PluginID { get; set; } = string.Empty;
public string Query { get; set; } = string.Empty;
public string RecordKey { get; set; } = string.Empty;
public string IcoPath { get; set; } = string.Empty;
public GlyphInfo Glyph { get; init; } = null;
public DateTime ExecutedDateTime { get; set; }

public bool Equals(Result r)
Expand Down
4 changes: 3 additions & 1 deletion Flow.Launcher/Storage/QueryHistory.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.Json.Serialization;
Expand Down Expand Up @@ -59,6 +59,8 @@ public void Add(Result result)
PluginID = result.PluginID,
Query = result.OriginQuery.RawQuery,
RecordKey = result.RecordKey,
IcoPath = result.IcoPath,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

result.IcoPath should be absolute path which depends on Flow installed place, plugin version, Flow portable mode, etc. I think here we should use the relative path:

If this icon is inside the directory of the preinstalled plugins, let us store a relative path based on preinstalled plugin directory.

Else if the icon is inside the directory of the Flow data directory, let us store a relative path based on Flow data directory.

Else let us just use the absolute path.

Glyph = result.Glyph,
ExecutedDateTime = DateTime.Now
});
}
Expand Down
10 changes: 7 additions & 3 deletions Flow.Launcher/ViewModel/MainViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Globalization;
Expand All @@ -24,7 +24,7 @@
using Flow.Launcher.Plugin;
using Flow.Launcher.Plugin.SharedCommands;
using Flow.Launcher.Storage;
using iNKORE.UI.WPF.Modern;

Check warning on line 27 in Flow.Launcher/ViewModel/MainViewModel.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`NKORE` is not a recognized word. (unrecognized-spelling)
using Microsoft.VisualStudio.Threading;

namespace Flow.Launcher.ViewModel
Expand Down Expand Up @@ -270,7 +270,7 @@
#if DEBUG
throw t.Exception;
#else
App.API.LogError(ClassName, $"Error happen in task dealing with viewupdate for results. {t.Exception}");

Check warning on line 273 in Flow.Launcher/ViewModel/MainViewModel.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`viewupdate` is not a recognized word. (unrecognized-spelling)
_resultsViewUpdateTask =
Task.Run(UpdateActionAsync).ContinueWith(continueAction, CancellationToken.None, TaskContinuationOptions.OnlyOnFaulted, TaskScheduler.Default);
#endif
Expand Down Expand Up @@ -467,7 +467,7 @@
else if (!string.IsNullOrEmpty(SelectedResults.SelectedItem?.QuerySuggestionText))
{
//var defaultSuggestion = SelectedResults.SelectedItem.QuerySuggestionText;
//// check if result.actionkeywordassigned is empty

Check warning on line 470 in Flow.Launcher/ViewModel/MainViewModel.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`actionkeywordassigned` is not a recognized word. (unrecognized-spelling)
//if (!string.IsNullOrEmpty(result.ActionKeywordAssigned))
//{
// autoCompleteText = $"{result.ActionKeywordAssigned} {defaultSuggestion}";
Expand Down Expand Up @@ -1349,7 +1349,9 @@
Localize.executeQuery(h.Query) :
h.Title,
SubTitle = Localize.lastExecuteTime(h.ExecutedDateTime),
IcoPath = Constant.HistoryIcon,
IcoPath = Settings.ShowBadges ? h.IcoPath : Constant.HistoryIcon,
BadgeIcoPath = Settings.ShowBadges ? Constant.HistoryIcon : h.IcoPath,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check if h.IcoPath exists to prevent possible blank icon

ShowBadge = Settings.ShowBadges,
OriginQuery = new Query { RawQuery = h.Query },
AsyncAction = async c =>
{
Expand All @@ -1369,7 +1371,9 @@
App.API.ChangeQuery(h.Query);
return false;
},
Glyph = new GlyphInfo(FontFamily: "/Resources/#Segoe Fluent Icons", Glyph: "\uE81C")
Glyph = Settings.ShowBadges ?
h.Glyph is not null ? h.Glyph : null
: new GlyphInfo(FontFamily: "/Resources/#Segoe Fluent Icons", Glyph: "\uE81C")
};
results.Add(result);
}
Expand Down
Loading