Skip to content

Commit a3c7b2b

Browse files
authored
Merge branch 'dev' into localize-missing-python-js-dialog
2 parents f00c58f + ca5ce61 commit a3c7b2b

File tree

24 files changed

+763
-124
lines changed

24 files changed

+763
-124
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/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;
@@ -91,6 +91,48 @@ public static async Task ReloadDataAsync()
9191
}).ToArray());
9292
}
9393

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

4.91 KB
Loading
3.3 KB
Loading

0 commit comments

Comments
 (0)