Skip to content

Commit f47de6b

Browse files
authored
Merge pull request #740 from onesounds/PluginStore
Plugin store
2 parents 76f8121 + 63ffb3a commit f47de6b

File tree

31 files changed

+1496
-537
lines changed

31 files changed

+1496
-537
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
using Flow.Launcher.Infrastructure.Http;
2+
using Flow.Launcher.Infrastructure.Logger;
3+
using System;
4+
using System.Collections.Generic;
5+
using System.Text.Json;
6+
using System.Threading;
7+
using System.Threading.Tasks;
8+
9+
namespace Flow.Launcher.Core.ExternalPlugins
10+
{
11+
public static class PluginsManifest
12+
{
13+
static PluginsManifest()
14+
{
15+
UpdateTask = UpdateManifestAsync();
16+
}
17+
18+
public static List<UserPlugin> UserPlugins { get; private set; } = new List<UserPlugin>();
19+
20+
public static Task UpdateTask { get; private set; }
21+
22+
private static readonly SemaphoreSlim manifestUpdateLock = new(1);
23+
24+
public static Task UpdateManifestAsync()
25+
{
26+
if (manifestUpdateLock.CurrentCount == 0)
27+
{
28+
return UpdateTask;
29+
}
30+
31+
return UpdateTask = DownloadManifestAsync();
32+
}
33+
34+
private async static Task DownloadManifestAsync()
35+
{
36+
try
37+
{
38+
await manifestUpdateLock.WaitAsync().ConfigureAwait(false);
39+
40+
await using var jsonStream = await Http.GetStreamAsync("https://raw.githubusercontent.com/Flow-Launcher/Flow.Launcher.PluginsManifest/plugin_api_v2/plugins.json")
41+
.ConfigureAwait(false);
42+
43+
UserPlugins = await JsonSerializer.DeserializeAsync<List<UserPlugin>>(jsonStream).ConfigureAwait(false);
44+
}
45+
catch (Exception e)
46+
{
47+
Log.Exception("|PluginManagement.GetManifest|Encountered error trying to download plugins manifest", e);
48+
49+
UserPlugins = new List<UserPlugin>();
50+
}
51+
finally
52+
{
53+
manifestUpdateLock.Release();
54+
}
55+
}
56+
}
57+
}
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-

2-
namespace Flow.Launcher.Plugin.PluginsManager.Models
1+
namespace Flow.Launcher.Core.ExternalPlugins
32
{
4-
public class UserPlugin
3+
public record UserPlugin
54
{
65
public string ID { get; set; }
76
public string Name { get; set; }
@@ -12,5 +11,6 @@ public class UserPlugin
1211
public string Website { get; set; }
1312
public string UrlDownload { get; set; }
1413
public string UrlSourceCode { get; set; }
14+
public string IcoPath { get; set; }
1515
}
1616
}

Flow.Launcher.Infrastructure/UserSettings/Settings.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,6 @@ public bool HideNotifyIcon
9999
public bool RememberLastLaunchLocation { get; set; }
100100
public bool IgnoreHotkeysOnFullscreen { get; set; }
101101

102-
public bool AutoHideScrollBar { get; set; }
103-
104102
public HttpProxy Proxy { get; set; } = new HttpProxy();
105103

106104
[JsonConverter(typeof(JsonStringEnumConverter))]

Flow.Launcher.Plugin/Flow.Launcher.Plugin.csproj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,13 @@
6060
</ItemGroup>
6161

6262
<ItemGroup>
63+
<PackageReference Include="Fody" Version="6.5.4">
64+
<PrivateAssets>all</PrivateAssets>
65+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
66+
</PackageReference>
6367
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
6468
<PackageReference Include="JetBrains.Annotations" Version="2021.2.0" />
69+
<PackageReference Include="PropertyChanged.Fody" Version="3.4.0" />
6570
</ItemGroup>
6671

6772
</Project>

Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ public interface IPublicAPI
5959
/// <param name="subTitle">Optional message subtitle</param>
6060
void ShowMsgError(string title, string subTitle = "");
6161

62+
/// <summary>
63+
/// Show the MainWindow when hiding
64+
/// </summary>
65+
void ShowMainWindow();
66+
6267
/// <summary>
6368
/// Show message box
6469
/// </summary>

Flow.Launcher/ActionKeywords.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ private void btnDone_OnClick(object sender, RoutedEventArgs _)
4444
var oldActionKeyword = plugin.Metadata.ActionKeywords[0];
4545
var newActionKeyword = tbAction.Text.Trim();
4646
newActionKeyword = newActionKeyword.Length > 0 ? newActionKeyword : "*";
47-
if (!pluginViewModel.IsActionKeywordRegistered(newActionKeyword))
47+
if (!PluginViewModel.IsActionKeywordRegistered(newActionKeyword))
4848
{
4949
pluginViewModel.ChangeActionKeyword(newActionKeyword, oldActionKeyword);
5050
Close();

Flow.Launcher/App.xaml

Lines changed: 221 additions & 0 deletions
Large diffs are not rendered by default.

Flow.Launcher/Flow.Launcher.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@
8383
</ItemGroup>
8484

8585
<ItemGroup>
86+
<PackageReference Include="Fody" Version="6.5.4">
87+
<PrivateAssets>all</PrivateAssets>
88+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
89+
</PackageReference>
8690
<PackageReference Include="InputSimulator" Version="1.0.4" />
8791
<PackageReference Include="ModernWpfUI" Version="0.9.4" />
8892
<PackageReference Include="NHotkey.Wpf" Version="2.1.0" />

Flow.Launcher/Languages/en.xaml

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,50 +13,59 @@
1313
<system:String x:Key="iconTraySettings">Settings</system:String>
1414
<system:String x:Key="iconTrayAbout">About</system:String>
1515
<system:String x:Key="iconTrayExit">Exit</system:String>
16+
<system:String x:Key="closeWindow">Close</system:String>
1617

1718
<!--Setting General-->
1819
<system:String x:Key="flowlauncher_settings">Flow Launcher Settings</system:String>
1920
<system:String x:Key="general">General</system:String>
2021
<system:String x:Key="portableMode">Portable Mode</system:String>
22+
<system:String x:Key="portableModeToolTIp">Store all settings and user data in one folder (Useful when used with removable drives or cloud services).</system:String>
2123
<system:String x:Key="startFlowLauncherOnSystemStartup">Start Flow Launcher on system startup</system:String>
2224
<system:String x:Key="hideFlowLauncherWhenLoseFocus">Hide Flow Launcher when focus is lost</system:String>
2325
<system:String x:Key="dontPromptUpdateMsg">Do not show new version notifications</system:String>
2426
<system:String x:Key="rememberLastLocation">Remember last launch location</system:String>
2527
<system:String x:Key="language">Language</system:String>
2628
<system:String x:Key="lastQueryMode">Last Query Style</system:String>
29+
<system:String x:Key="lastQueryModeToolTip">Show/Hide previous results when Flow Launcher is reactivated.</system:String>
2730
<system:String x:Key="LastQueryPreserved">Preserve Last Query</system:String>
2831
<system:String x:Key="LastQuerySelected">Select last Query</system:String>
2932
<system:String x:Key="LastQueryEmpty">Empty last Query</system:String>
3033
<system:String x:Key="maxShowResults">Maximum results shown</system:String>
3134
<system:String x:Key="ignoreHotkeysOnFullscreen">Ignore hotkeys in fullscreen mode</system:String>
35+
<system:String x:Key="ignoreHotkeysOnFullscreenToolTip">Disable Flow Launcher activation when a full screen application is active (Recommended for games).</system:String>
3236
<system:String x:Key="pythonDirectory">Python Directory</system:String>
3337
<system:String x:Key="autoUpdates">Auto Update</system:String>
34-
<system:String x:Key="autoHideScrollBar">Auto Hide Scroll Bar</system:String>
35-
<system:String x:Key="autoHideScrollBarToolTip">Automatically hides the Settings window scroll bar and show when hover the mouse over it</system:String>
3638
<system:String x:Key="selectPythonDirectory">Select</system:String>
3739
<system:String x:Key="hideOnStartup">Hide Flow Launcher on startup</system:String>
3840
<system:String x:Key="hideNotifyIcon">Hide tray icon</system:String>
3941
<system:String x:Key="querySearchPrecision">Query Search Precision</system:String>
42+
<system:String x:Key="querySearchPrecisionToolTip">Changes minimum match score required for results.</system:String>
4043
<system:String x:Key="ShouldUsePinyin">Should Use Pinyin</system:String>
4144
<system:String x:Key="ShouldUsePinyinToolTip">Allows using Pinyin to search. Pinyin is the standard system of romanized spelling for translating Chinese</system:String>
4245
<system:String x:Key="shadowEffectNotAllowed">Shadow effect is not allowed while current theme has blur effect enabled</system:String>
4346

4447
<!--Setting Plugin-->
45-
<system:String x:Key="plugin">Plugin</system:String>
48+
<system:String x:Key="plugin">Plugins</system:String>
4649
<system:String x:Key="browserMorePlugins">Find more plugins</system:String>
47-
<system:String x:Key="enable">Enable</system:String>
48-
<system:String x:Key="disable">Disable</system:String>
49-
<system:String x:Key="actionKeywords">Action keyword:</system:String>
50+
<system:String x:Key="enable">On</system:String>
51+
<system:String x:Key="disable">Off</system:String>
52+
<system:String x:Key="actionKeywords">Action keyword</system:String>
5053
<system:String x:Key="currentActionKeywords">Current action keyword:</system:String>
5154
<system:String x:Key="newActionKeyword">New action keyword:</system:String>
5255
<system:String x:Key="currentPriority">Current Priority:</system:String>
5356
<system:String x:Key="newPriority">New Priority:</system:String>
54-
<system:String x:Key="priority">Priority:</system:String>
57+
<system:String x:Key="priority">Priority</system:String>
5558
<system:String x:Key="pluginDirectory">Plugin Directory</system:String>
56-
<system:String x:Key="author">Author</system:String>
59+
<system:String x:Key="author">Author:</system:String>
5760
<system:String x:Key="plugin_init_time">Init time:</system:String>
5861
<system:String x:Key="plugin_query_time">Query time:</system:String>
5962

63+
64+
<!--Setting Plugin Store-->
65+
<system:String x:Key="pluginStore">Plugin Store</system:String>
66+
<system:String x:Key="refresh">Refresh</system:String>
67+
<system:String x:Key="install">Install</system:String>
68+
6069
<!--Setting Theme-->
6170
<system:String x:Key="theme">Theme</system:String>
6271
<system:String x:Key="browserMoreThemes">Browse for more themes</system:String>
@@ -67,12 +76,17 @@
6776
<system:String x:Key="opacity">Opacity</system:String>
6877
<system:String x:Key="theme_load_failure_path_not_exists">Theme {0} not exists, fallback to default theme</system:String>
6978
<system:String x:Key="theme_load_failure_parse_error">Fail to load theme {0}, fallback to default theme</system:String>
79+
<system:String x:Key="ThemeFolder">Theme Folder</system:String>
80+
<system:String x:Key="OpenThemeFolder">Open Theme Folder</system:String>
7081

7182
<!--Setting Hotkey-->
7283
<system:String x:Key="hotkey">Hotkey</system:String>
7384
<system:String x:Key="flowlauncherHotkey">Flow Launcher Hotkey</system:String>
74-
<system:String x:Key="openResultModifiers">Open Result Modifiers</system:String>
85+
<system:String x:Key="flowlauncherHotkeyToolTip">Enter shortcut to show/hide Flow Launcher.</system:String>
86+
<system:String x:Key="openResultModifiers">Open Result Modifier Key</system:String>
87+
<system:String x:Key="openResultModifiersToolTip">Select a modifier key to open selected result via keyboard.</system:String>
7588
<system:String x:Key="showOpenResultHotkey">Show Hotkey</system:String>
89+
<system:String x:Key="showOpenResultHotkeyToolTip">Show result selection hotkey with results.</system:String>
7690
<system:String x:Key="customQueryHotkey">Custom Query Hotkey</system:String>
7791
<system:String x:Key="customQuery">Query</system:String>
7892
<system:String x:Key="delete">Delete</system:String>
@@ -117,6 +131,7 @@
117131
<system:String x:Key="documentation">Usage Tips:</system:String>
118132

119133
<!--Priority Setting Dialog-->
134+
<system:String x:Key="changePriorityWindow">Change Priority</system:String>
120135
<system:String x:Key="priority_tips">Greater the number, the higher the result will be ranked. Try setting it as 5. If you want the results to be lower than any other plugin's, provide a negative number</system:String>
121136
<system:String x:Key="invalidPriority">Please provide an valid integer for Priority!</system:String>
122137

@@ -180,4 +195,4 @@
180195
<system:String x:Key="update_flowlauncher_update_files">Update files</system:String>
181196
<system:String x:Key="update_flowlauncher_update_upadte_description">Update description</system:String>
182197

183-
</ResourceDictionary>
198+
</ResourceDictionary>

0 commit comments

Comments
 (0)