Skip to content

Commit 7953ad8

Browse files
committed
Merge remote-tracking branch 'onesounds/240605-Fix-RightTop-Position' into fork/240605-Fix-RightTop-Position
2 parents ce100c4 + 05cea15 commit 7953ad8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+2261
-1548
lines changed

.cm/gitstream.cm

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# -*- mode: yaml -*-
2+
# This example configuration for provides basic automations to get started with gitStream.
3+
# View the gitStream quickstart for more examples: https://docs.gitstream.cm/examples/
4+
manifest:
5+
version: 1.0
6+
7+
8+
automations:
9+
# Add a label that indicates how many minutes it will take to review the PR.
10+
estimated_time_to_review:
11+
if:
12+
- true
13+
run:
14+
- action: add-label@v1
15+
args:
16+
label: "{{ calc.etr }} min review"
17+
color: {{ colors.red if (calc.etr >= 20) else ( colors.yellow if (calc.etr >= 5) else colors.green ) }}
18+
# Post a comment that lists the best experts for the files that were modified.
19+
explain_code_experts:
20+
if:
21+
- true
22+
run:
23+
- action: explain-code-experts@v1
24+
args:
25+
gt: 10
26+
# Post a comment that indicates what percentage of the PR is new code.
27+
percent_new_code:
28+
if:
29+
- true
30+
run:
31+
- action: add-comment@v1
32+
args:
33+
comment: |
34+
This PR is {{ changes.ratio }}% new code.
35+
# Post a comment that request changes for a PR that contains a TODO statement.
36+
review_todo_comments:
37+
if:
38+
- {{ source.diff.files | matchDiffLines(regex=r/^[+].*(TODO)|(todo)/) | some }}
39+
run:
40+
- action: request-changes@v1
41+
args:
42+
comment: |
43+
This PR contains a TODO statement. Please check to see if they should be removed.
44+
# Post a comment that request a before and after screenshot
45+
request_screenshot:
46+
# Triggered for PRs that lack an image file or link to an image in the PR description
47+
if:
48+
- {{ not (has.screenshot_link or has.image_uploaded) }}
49+
run:
50+
- action: add-comment@v1
51+
args:
52+
comment: |
53+
Be a legend :trophy: by adding a before and after screenshot of the changes you made, especially if they are around UI/UX.
54+
55+
56+
# +----------------------------------------------------------------------------+
57+
# | Custom Expressions |
58+
# | https://docs.gitstream.cm/how-it-works/#custom-expressions |
59+
# +----------------------------------------------------------------------------+
60+
61+
calc:
62+
etr: {{ branch | estimatedReviewTime }}
63+
64+
colors:
65+
red: 'b60205'
66+
yellow: 'fbca04'
67+
green: '0e8a16'
68+
69+
changes:
70+
# Sum all the lines added/edited in the PR
71+
additions: {{ branch.diff.files_metadata | map(attr='additions') | sum }}
72+
# Sum all the line removed in the PR
73+
deletions: {{ branch.diff.files_metadata | map(attr='deletions') | sum }}
74+
# Calculate the ratio of new code
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/gitstream.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Code generated by gitStream GitHub app - DO NOT EDIT
2+
3+
name: gitStream workflow automation
4+
run-name: |
5+
/:\ gitStream: PR #${{ fromJSON(fromJSON(github.event.inputs.client_payload)).pullRequestNumber }} from ${{ github.event.inputs.full_repository }}
6+
7+
on:
8+
workflow_dispatch:
9+
inputs:
10+
client_payload:
11+
description: The Client payload
12+
required: true
13+
full_repository:
14+
description: the repository name include the owner in `owner/repo_name` format
15+
required: true
16+
head_ref:
17+
description: the head sha
18+
required: true
19+
base_ref:
20+
description: the base ref
21+
required: true
22+
installation_id:
23+
description: the installation id
24+
required: false
25+
resolver_url:
26+
description: the resolver url to pass results to
27+
required: true
28+
resolver_token:
29+
description: Optional resolver token for resolver service
30+
required: false
31+
default: ''
32+
33+
jobs:
34+
gitStream:
35+
timeout-minutes: 5
36+
runs-on: ubuntu-latest
37+
name: gitStream workflow automation
38+
steps:
39+
- name: Evaluate Rules
40+
uses: linear-b/gitstream-github-action@v2
41+
id: rules-engine
42+
with:
43+
full_repository: ${{ github.event.inputs.full_repository }}
44+
head_ref: ${{ github.event.inputs.head_ref }}
45+
base_ref: ${{ github.event.inputs.base_ref }}
46+
client_payload: ${{ github.event.inputs.client_payload }}
47+
installation_id: ${{ github.event.inputs.installation_id }}
48+
resolver_url: ${{ github.event.inputs.resolver_url }}
49+
resolver_token: ${{ github.event.inputs.resolver_token }}

.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.Core/Plugin/ProcessStreamPluginV2.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,10 @@ public override async Task ReloadDataAsync()
8282

8383
public override async ValueTask DisposeAsync()
8484
{
85+
await base.DisposeAsync();
8586
ClientProcess.Kill(true);
8687
await ClientProcess.WaitForExitAsync();
8788
ClientProcess.Dispose();
88-
await base.DisposeAsync();
8989
}
9090
}
9191
}

0 commit comments

Comments
 (0)