-
-
Notifications
You must be signed in to change notification settings - Fork 447
Add "Last opened" history mode & Fix non-result history item save issue #4042
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
54 commits
Select commit
Hold shift + click to select a range
3cc4f13
feat: New option to show executed results in settings
01Dri c0369e6
feat: radio button with history query option or history executed option
01Dri bc1f9d3
refactor: renaming executed history to last opened history
01Dri 5fcd012
feat: text
01Dri 7ba4f8d
feat: last opened history
01Dri e573656
feat: created a base History model
01Dri 9e182a2
feat: base history model in MainView and refactoring code to replace …
01Dri 3681340
feat: toggle history
01Dri 4f2db28
faet: query action save
01Dri 06711d3
feat: Saving actions for history
01Dri c051c5c
feat: new history logic in MainViewModel
01Dri b290055
feat: up
01Dri 6aa35d5
merge dev
01Dri 156cb30
merge
01Dri d122276
feat: clean imports
01Dri 50f5e85
feat: code quality
01Dri 545c420
code quality
01Dri 8e8e9d3
code quality
01Dri 9e1b8c1
feat: Populate new history system with legacy query history
01Dri bf2acfe
feat: code quality
01Dri 95122e9
feat: code quality
01Dri e6cae1a
feat: helper
01Dri e468c48
feat: fix erros
01Dri d7579cc
fix erros
01Dri 690d33e
up
01Dri a1f82e1
refactor: using count for better performance
01Dri a3b7c68
up
01Dri 2b7c204
up
01Dri cc397d4
Merge branch 'dev' into feature/history_mode
01Dri e3527f4
Add RecordKey for precise history matching and refactor
Jack251970 7fa78f0
Code cleanup
Jack251970 b84ca9b
Improve code quality
Jack251970 f6d5a27
Refactor and enhance history management system
Jack251970 693bae7
Optimize query result selection handling
Jack251970 787ccad
Refactor history handling with async ResultHelper
Jack251970 66fe0b8
Adjust design-time height in SettingsPaneGeneral.xaml
Jack251970 0131b92
The HistoryStyle property is used to distinguish history items
01Dri ced824d
is equals
01Dri d5a2695
Update the history item if it equals the last added item or already e…
01Dri 9f652c3
History items filtered based on HistoryStyle.
01Dri 8e96d1a
HistoryStyle enum values
01Dri f31abe8
PopulateHistoryFromLegacyHistory with HistoryStyle
01Dri 764c674
code quality
01Dri a8d3cdf
SubTitle equals
01Dri 9ca7c84
Revert modifications and returning actions
01Dri 10d353d
Returning actions
01Dri 4b6ee4e
Improve code quality
Jack251970 1298b76
Track user-selected results for ranking purposes
Jack251970 c73689f
Fix spelling
Jack251970 629c2eb
Record user-selected results for ranking
Jack251970 b784a14
Update tooltip text for `historyStyleTooltip`
Jack251970 83cab76
Fix typos
Jack251970 df4f08b
Add exception logging to ResultHelper catch block
Jack251970 b13c29a
Record user selection after successful execution
Jack251970 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
<Project> | ||
<PropertyGroup> | ||
<AccelerateBuildsInVisualStudio>true</AccelerateBuildsInVisualStudio> | ||
<!-- Work around https://github.com/dotnet/runtime/issues/109682 --> | ||
<!-- Workaround https://github.com/dotnet/runtime/issues/109682 --> | ||
<CETCompat>false</CETCompat> | ||
</PropertyGroup> | ||
</Project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using System.Linq; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using Flow.Launcher.Core.Plugin; | ||
using Flow.Launcher.Plugin; | ||
using Flow.Launcher.Storage; | ||
|
||
namespace Flow.Launcher.Helper; | ||
|
||
#nullable enable | ||
|
||
public static class ResultHelper | ||
{ | ||
public static async Task<Result?> PopulateResultsAsync(LastOpenedHistoryItem item) | ||
{ | ||
return await PopulateResultsAsync(item.PluginID, item.Query, item.Title, item.SubTitle, item.RecordKey); | ||
} | ||
|
||
public static async Task<Result?> PopulateResultsAsync(string pluginId, string rawQuery, string title, string subTitle, string recordKey) | ||
{ | ||
var plugin = PluginManager.GetPluginForId(pluginId); | ||
if (plugin == null) return null; | ||
var query = QueryBuilder.Build(rawQuery, PluginManager.NonGlobalPlugins); | ||
if (query == null) return null; | ||
try | ||
{ | ||
var freshResults = await plugin.Plugin.QueryAsync(query, CancellationToken.None); | ||
// Try to match by record key first if it is valid, otherwise fall back to title + subtitle match | ||
if (string.IsNullOrEmpty(recordKey)) | ||
{ | ||
return freshResults?.FirstOrDefault(r => r.Title == title && r.SubTitle == subTitle); | ||
} | ||
else | ||
{ | ||
return freshResults?.FirstOrDefault(r => r.RecordKey == recordKey) ?? | ||
freshResults?.FirstOrDefault(r => r.Title == title && r.SubTitle == subTitle); | ||
Jack251970 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
} | ||
catch (System.Exception e) | ||
{ | ||
App.API.LogException(nameof(ResultHelper), $"Failed to query results for {plugin.Metadata.Name}", e); | ||
return null; | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using System; | ||
using Flow.Launcher.Plugin; | ||
|
||
namespace Flow.Launcher.Storage; | ||
|
||
public class LastOpenedHistoryItem | ||
{ | ||
public string Title { get; set; } = string.Empty; | ||
public string SubTitle { get; set; } = string.Empty; | ||
public string PluginID { get; set; } = string.Empty; | ||
public string Query { get; set; } = string.Empty; | ||
public string RecordKey { get; set; } = string.Empty; | ||
public DateTime ExecutedDateTime { get; set; } | ||
|
||
public bool Equals(Result r) | ||
{ | ||
if (string.IsNullOrEmpty(RecordKey) || string.IsNullOrEmpty(r.RecordKey)) | ||
{ | ||
return Title == r.Title | ||
&& SubTitle == r.SubTitle | ||
Jack251970 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
&& PluginID == r.PluginID | ||
&& Query == r.OriginQuery.RawQuery; | ||
} | ||
else | ||
{ | ||
return RecordKey == r.RecordKey | ||
&& PluginID == r.PluginID | ||
&& Query == r.OriginQuery.RawQuery; | ||
Jack251970 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.