Skip to content

Commit 05cea15

Browse files
authored
Merge branch 'dev' into 240605-Fix-RightTop-Position
2 parents 586752f + 42939ea commit 05cea15

File tree

21 files changed

+1094
-125
lines changed

21 files changed

+1094
-125
lines changed

.cm/gitstream.cm

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,8 @@ changes:
7272
# Sum all the line removed in the PR
7373
deletions: {{ branch.diff.files_metadata | map(attr='deletions') | sum }}
7474
# Calculate the ratio of new code
75-
ratio: {{ (changes.additions / (changes.additions + changes.deletions)) * 100 | round(2) }}
75+
ratio: {{ (changes.additions / (changes.additions + changes.deletions)) * 100 | round(2) }}
76+
77+
has:
78+
screenshot_link: {{ pr.description | includes(regex=r/!\[.*\]\(.*(jpg|svg|png|gif|psd).*\)/) }}
79+
image_uploaded: {{ pr.description | includes(regex=r/<img.*src.*(jpg|svg|png|gif|psd).*>/) }}

.github/actions/spelling/expect.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ Português
9898
Português (Brasil)
9999
Italiano
100100
Slovenský
101+
quicklook
101102
Tiếng Việt
102103
Droplex
103104
Preinstalled

.github/pr-labeler.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# The bot always updates the labels, add/remove as necessary [default: false]
2+
alwaysReplace: false
3+
# Treats the text and labels as case sensitive [default: true]
4+
caseSensitive: false
5+
# Array of labels to be applied to the PR [default: []]
6+
customLabels:
7+
# Finds the `text` within the PR title and body and applies the `label`
8+
- text: 'bug'
9+
label: 'bug'
10+
- text: 'fix'
11+
label: 'bug'
12+
- text: 'dependabot'
13+
label: 'bug'
14+
- text: 'New Crowdin updates'
15+
label: 'bug'
16+
- text: 'New Crowdin updates'
17+
label: 'kind/i18n'
18+
- text: 'feature'
19+
label: 'enhancement'
20+
- text: 'add new'
21+
label: 'enhancement'
22+
- text: 'refactor'
23+
label: 'enhancement'
24+
- text: 'refactor'
25+
label: 'Code Refactor'
26+
# Search the body of the PR for the `text` [default: true]
27+
searchBody: true
28+
# Search the title of the PR for the `text` [default: true]
29+
searchTitle: true
30+
# Search for whole words only [default: false]
31+
wholeWords: false

.github/workflows/pr_assignee.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Assign PR to creator
2+
3+
# Due to GitHub token limitation, only able to assign org members not authors from forks.
4+
# https://github.com/thomaseizinger/assign-pr-creator-action/issues/3
5+
6+
on:
7+
pull_request:
8+
types: [opened]
9+
branches-ignore:
10+
- l10n_dev
11+
12+
jobs:
13+
automation:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Assign PR to creator
17+
uses: thomaseizinger/[email protected]
18+
with:
19+
repo-token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/pr_milestone.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Set Milestone
2+
3+
# Assigns the earliest created milestone that matches the below glob pattern.
4+
5+
on:
6+
pull_request:
7+
types: [opened]
8+
9+
jobs:
10+
automation:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: set-milestone
15+
uses: andrefcdias/[email protected]
16+
with:
17+
repo-token: "${{ secrets.GITHUB_TOKEN }}"
18+
milestone: "+([0-9]).+([0-9]).+([0-9])"
19+
use-expression: true

Flow.Launcher.Core/Plugin/PluginManager.cs

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using Flow.Launcher.Core.ExternalPlugins;
1+
using Flow.Launcher.Core.ExternalPlugins;
22
using System;
33
using System.Collections.Concurrent;
44
using System.Collections.Generic;
@@ -90,6 +90,48 @@ public static async Task ReloadDataAsync()
9090
}).ToArray());
9191
}
9292

93+
public static async Task OpenExternalPreviewAsync(string path, bool sendFailToast = true)
94+
{
95+
await Task.WhenAll(AllPlugins.Select(plugin => plugin.Plugin switch
96+
{
97+
IAsyncExternalPreview p => p.OpenPreviewAsync(path, sendFailToast),
98+
_ => Task.CompletedTask,
99+
}).ToArray());
100+
}
101+
102+
public static async Task CloseExternalPreviewAsync()
103+
{
104+
await Task.WhenAll(AllPlugins.Select(plugin => plugin.Plugin switch
105+
{
106+
IAsyncExternalPreview p => p.ClosePreviewAsync(),
107+
_ => Task.CompletedTask,
108+
}).ToArray());
109+
}
110+
111+
public static async Task SwitchExternalPreviewAsync(string path, bool sendFailToast = true)
112+
{
113+
await Task.WhenAll(AllPlugins.Select(plugin => plugin.Plugin switch
114+
{
115+
IAsyncExternalPreview p => p.SwitchPreviewAsync(path, sendFailToast),
116+
_ => Task.CompletedTask,
117+
}).ToArray());
118+
}
119+
120+
public static bool UseExternalPreview()
121+
{
122+
return GetPluginsForInterface<IAsyncExternalPreview>().Any(x => !x.Metadata.Disabled);
123+
}
124+
125+
public static bool AllowAlwaysPreview()
126+
{
127+
var plugin = GetPluginsForInterface<IAsyncExternalPreview>().FirstOrDefault(x => !x.Metadata.Disabled);
128+
129+
if (plugin is null)
130+
return false;
131+
132+
return ((IAsyncExternalPreview)plugin.Plugin).AllowAlwaysPreview();
133+
}
134+
93135
static PluginManager()
94136
{
95137
// validate user directory

Flow.Launcher.Infrastructure/UserSettings/Settings.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,9 @@ public CustomBrowserViewModel CustomBrowser
185185
/// when false Alphabet static service will always return empty results
186186
/// </summary>
187187
public bool ShouldUsePinyin { get; set; } = false;
188+
188189
public bool AlwaysPreview { get; set; } = false;
190+
189191
public bool AlwaysStartEn { get; set; } = false;
190192

191193
private SearchPrecisionScore _querySearchPrecision = SearchPrecisionScore.Regular;
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
using System.Threading.Tasks;
2+
3+
namespace Flow.Launcher.Plugin
4+
{
5+
/// <summary>
6+
/// This interface is for plugins that wish to provide file preview (external preview)
7+
/// via a third party app instead of the default preview.
8+
/// </summary>
9+
public interface IAsyncExternalPreview : IFeatures
10+
{
11+
/// <summary>
12+
/// Method for opening/showing the preview.
13+
/// </summary>
14+
/// <param name="path">The file path to open the preview for</param>
15+
/// <param name="sendFailToast">Whether to send a toast message notification on failure for the user</param>
16+
public Task OpenPreviewAsync(string path, bool sendFailToast = true);
17+
18+
/// <summary>
19+
/// Method for closing/hiding the preview.
20+
/// </summary>
21+
public Task ClosePreviewAsync();
22+
23+
/// <summary>
24+
/// Method for switching the preview to the next file result.
25+
/// This requires the external preview be already open/showing
26+
/// </summary>
27+
/// <param name="path">The file path to switch the preview for</param>
28+
/// <param name="sendFailToast">Whether to send a toast message notification on failure for the user</param>
29+
public Task SwitchPreviewAsync(string path, bool sendFailToast = true);
30+
31+
/// <summary>
32+
/// Allows the preview plugin to override the AlwaysPreview setting. Typically useful if plugin's preview does not
33+
/// fully work well with being shown together when the query window appears with results.
34+
/// When AlwaysPreview setting is on and this is set to false, the preview will not be shown when query
35+
/// window appears with results, instead the internal preview will be shown.
36+
/// </summary>
37+
/// <returns></returns>
38+
public bool AllowAlwaysPreview();
39+
}
40+
}

Flow.Launcher.Plugin/Result.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -270,25 +270,30 @@ public record PreviewInfo
270270
/// <summary>
271271
/// Full image used for preview panel
272272
/// </summary>
273-
public string PreviewImagePath { get; set; }
273+
public string PreviewImagePath { get; set; } = null;
274274

275275
/// <summary>
276276
/// Determines if the preview image should occupy the full width of the preview panel.
277277
/// </summary>
278-
public bool IsMedia { get; set; }
278+
public bool IsMedia { get; set; } = false;
279279

280280
/// <summary>
281281
/// Result description text that is shown at the bottom of the preview panel.
282282
/// </summary>
283283
/// <remarks>
284284
/// When a value is not set, the <see cref="SubTitle"/> will be used.
285285
/// </remarks>
286-
public string Description { get; set; }
286+
public string Description { get; set; } = null;
287287

288288
/// <summary>
289289
/// Delegate to get the preview panel's image
290290
/// </summary>
291-
public IconDelegate PreviewDelegate { get; set; }
291+
public IconDelegate PreviewDelegate { get; set; } = null;
292+
293+
/// <summary>
294+
/// File path of the result. For third-party programs providing external preview.
295+
/// </summary>
296+
public string FilePath { get; set; } = null;
292297

293298
/// <summary>
294299
/// Default instance of <see cref="PreviewInfo"/>
@@ -299,6 +304,7 @@ public record PreviewInfo
299304
Description = null,
300305
IsMedia = false,
301306
PreviewDelegate = null,
307+
FilePath = null,
302308
};
303309
}
304310
}

Flow.Launcher/Flow.Launcher.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@
9595
<PackageReference Include="ModernWpfUI" Version="0.9.4" />
9696
<PackageReference Include="NHotkey.Wpf" Version="2.1.1" />
9797
<PackageReference Include="PropertyChanged.Fody" Version="3.4.0" />
98-
<PackageReference Include="SharpVectors" Version="1.8.2" />
9998
<PackageReference Include="VirtualizingWrapPanel" Version="1.5.8" />
10099
</ItemGroup>
101100

0 commit comments

Comments
 (0)