Merge Binding

This commit is contained in:
Dobin Park 2021-10-11 07:34:42 +09:00
commit 4aae10173d
15 changed files with 137 additions and 96 deletions

View file

@ -0,0 +1,57 @@
using Flow.Launcher.Infrastructure.Http;
using Flow.Launcher.Infrastructure.Logger;
using System;
using System.Collections.Generic;
using System.Text.Json;
using System.Threading;
using System.Threading.Tasks;
namespace Flow.Launcher.Core.ExternalPlugins
{
public static class PluginsManifest
{
static PluginsManifest()
{
UpdateTask = UpdateManifestAsync();
}
public static List<UserPlugin> UserPlugins { get; private set; } = new List<UserPlugin>();
public static Task UpdateTask { get; private set; }
private static readonly SemaphoreSlim manifestUpdateLock = new(1);
public static Task UpdateManifestAsync()
{
if (manifestUpdateLock.CurrentCount == 0)
{
return UpdateTask;
}
return UpdateTask = DownloadManifestAsync();
}
private async static Task DownloadManifestAsync()
{
try
{
await manifestUpdateLock.WaitAsync().ConfigureAwait(false);
await using var jsonStream = await Http.GetStreamAsync("https://raw.githubusercontent.com/Flow-Launcher/Flow.Launcher.PluginsManifest/plugin_api_v2/plugins.json")
.ConfigureAwait(false);
UserPlugins = await JsonSerializer.DeserializeAsync<List<UserPlugin>>(jsonStream).ConfigureAwait(false);
}
catch (Exception e)
{
Log.Exception("|PluginManagement.GetManifest|Encountered error trying to download plugins manifest", e);
UserPlugins = new List<UserPlugin>();
}
finally
{
manifestUpdateLock.Release();
}
}
}
}

View file

@ -1,7 +1,6 @@
 namespace Flow.Launcher.Core.ExternalPlugins
namespace Flow.Launcher.Plugin.PluginsManager.Models
{ {
public class UserPlugin public record UserPlugin
{ {
public string ID { get; set; } public string ID { get; set; }
public string Name { get; set; } public string Name { get; set; }
@ -12,5 +11,6 @@ namespace Flow.Launcher.Plugin.PluginsManager.Models
public string Website { get; set; } public string Website { get; set; }
public string UrlDownload { get; set; } public string UrlDownload { get; set; }
public string UrlSourceCode { get; set; } public string UrlSourceCode { get; set; }
public string IcoPath { get; set; }
} }
} }

View file

@ -176,6 +176,7 @@ namespace Flow.Launcher.Core.Resource
dict["ItemSubTitleStyle"] is Style resultSubItemStyle && dict["ItemSubTitleStyle"] is Style resultSubItemStyle &&
dict["ItemSubTitleSelectedStyle"] is Style resultSubItemSelectedStyle && dict["ItemSubTitleSelectedStyle"] is Style resultSubItemSelectedStyle &&
dict["ItemTitleSelectedStyle"] is Style resultItemSelectedStyle && dict["ItemTitleSelectedStyle"] is Style resultItemSelectedStyle &&
dict["ItemHotkeyStyle"] is Style resultHotkeyItemStyle &&
dict["ItemHotkeySelectedStyle"] is Style resultHotkeyItemSelectedStyle) dict["ItemHotkeySelectedStyle"] is Style resultHotkeyItemSelectedStyle)
{ {
Setter fontFamily = new Setter(TextBlock.FontFamilyProperty, new FontFamily(Settings.ResultFont)); Setter fontFamily = new Setter(TextBlock.FontFamilyProperty, new FontFamily(Settings.ResultFont));
@ -184,7 +185,9 @@ namespace Flow.Launcher.Core.Resource
Setter fontStretch = new Setter(TextBlock.FontStretchProperty, FontHelper.GetFontStretchFromInvariantStringOrNormal(Settings.ResultFontStretch)); Setter fontStretch = new Setter(TextBlock.FontStretchProperty, FontHelper.GetFontStretchFromInvariantStringOrNormal(Settings.ResultFontStretch));
Setter[] setters = { fontFamily, fontStyle, fontWeight, fontStretch }; Setter[] setters = { fontFamily, fontStyle, fontWeight, fontStretch };
Array.ForEach(new[] { resultItemStyle, resultSubItemStyle, resultItemSelectedStyle, resultSubItemSelectedStyle, resultHotkeyItemSelectedStyle }, o => Array.ForEach(setters, p => o.Setters.Add(p))); Array.ForEach(
new[] { resultItemStyle, resultSubItemStyle, resultItemSelectedStyle, resultSubItemSelectedStyle, resultHotkeyItemStyle, resultHotkeyItemSelectedStyle }, o
=> Array.ForEach(setters, p => o.Setters.Add(p)));
} }
var windowStyle = dict["WindowStyle"] as Style; var windowStyle = dict["WindowStyle"] as Style;

View file

@ -110,7 +110,7 @@ namespace Flow.Launcher.Helper
return; return;
mainViewModel.MainWindowVisibility = Visibility.Visible; mainViewModel.MainWindowVisibility = Visibility.Visible;
mainViewModel.ChangeQueryText(hotkey.ActionKeyword); mainViewModel.ChangeQueryText(hotkey.ActionKeyword, true);
}); });
} }

View file

@ -48,12 +48,7 @@ namespace Flow.Launcher
public void ChangeQuery(string query, bool requery = false) public void ChangeQuery(string query, bool requery = false)
{ {
_mainVM.ChangeQueryText(query); _mainVM.ChangeQueryText(query, requery);
}
public void ChangeQueryText(string query, bool selectAll = false)
{
_mainVM.ChangeQueryText(query);
} }
public void RestartApp() public void RestartApp()

View file

@ -689,28 +689,28 @@
ToolTip="Change Plugin Results Priority" ToolTip="Change Plugin Results Priority"
Margin="5 0 0 0" Cursor="Hand" Margin="5 0 0 0" Cursor="Hand"
Click="OnPluginPriorityClick"> Click="OnPluginPriorityClick">
<!--#region Priority Button Style--> <!--#region Priority Button Style-->
<Button.Resources> <Button.Resources>
<Style TargetType="Border"> <Style TargetType="Border">
<Setter Property="CornerRadius" Value="2"/> <Setter Property="CornerRadius" Value="2"/>
</Style> </Style>
</Button.Resources> </Button.Resources>
<Button.Style> <Button.Style>
<Style TargetType="Button"> <Style TargetType="Button">
<Setter Property="Padding" Value="12 8 12 8" /> <Setter Property="Padding" Value="12 8 12 8" />
<Setter Property="BorderThickness" Value="0" /> <Setter Property="BorderThickness" Value="0" />
<Setter Property="FontWeight" Value="DemiBold" /> <Setter Property="FontWeight" Value="DemiBold" />
<Setter Property="Foreground" Value="Black" /> <Setter Property="Foreground" Value="Black" />
<Style.Triggers> <Style.Triggers>
<DataTrigger Binding="{Binding ElementName=PriorityButton, UpdateSourceTrigger=PropertyChanged, Path=Content}" Value="0"> <DataTrigger Binding="{Binding ElementName=PriorityButton, UpdateSourceTrigger=PropertyChanged, Path=Content}" Value="0">
<Setter Property="Foreground" Value="#878787" /> <Setter Property="Foreground" Value="#878787" />
<Setter Property="FontWeight" Value="Normal" /> <Setter Property="FontWeight" Value="Normal" />
</DataTrigger> </DataTrigger>
</Style.Triggers> </Style.Triggers>
</Style> </Style>
</Button.Style> </Button.Style>
<!--#endregion--> <!--#endregion-->
</Button> </Button>
</Border> </Border>
</StackPanel> </StackPanel>
<ui:ToggleSwitch Grid.Column="4" OffContent="{DynamicResource disable}" <ui:ToggleSwitch Grid.Column="4" OffContent="{DynamicResource disable}"
@ -735,15 +735,15 @@
Style="{DynamicResource SettingTitleLabel}" Style="{DynamicResource SettingTitleLabel}"
Margin="0 0 0 0" VerticalAlignment="Center" HorizontalAlignment="Left" DockPanel.Dock="Left"/> Margin="0 0 0 0" VerticalAlignment="Center" HorizontalAlignment="Left" DockPanel.Dock="Left"/>
<Button Grid.Column="2" Content="{Binding ActionKeywordsText}" <Button Grid.Column="2" Content="{Binding ActionKeywordsText}"
DockPanel.Dock="Right" DockPanel.Dock="Right"
Visibility="{Binding ActionKeywordsVisibility}" Visibility="{Binding ActionKeywordsVisibility}"
ToolTip="Change Action Keywords" ToolTip="Change Action Keywords"
Margin="5 0 0 0" Cursor="Hand" FontWeight="Bold" Margin="5 0 0 0" Cursor="Hand" FontWeight="Bold"
Click="OnPluginActionKeywordsClick" HorizontalAlignment="Right" Click="OnPluginActionKeywordsClick" HorizontalAlignment="Right"
Width="100" Height="40"> Width="100" Height="40">
<Button.Resources> <Button.Resources>
<Style TargetType="Border"> <Style TargetType="Border">
<Setter Property="CornerRadius" Value="2"/> <Setter Property="CornerRadius" Value="2"/>
@ -762,7 +762,7 @@
<StackPanel> <StackPanel>
<Border Background="White" Padding="0" <Border Background="White" Padding="0"
BorderThickness="0 1 0 0" BorderBrush="#e6e6e6" BorderThickness="0 1 0 0" BorderBrush="#e6e6e6"
VerticalAlignment="Center" HorizontalAlignment="Stretch"> VerticalAlignment="Center" HorizontalAlignment="Stretch">
@ -785,8 +785,8 @@
Content="{Binding SettingControl}" Content="{Binding SettingControl}"
Padding="1" Margin="0" VerticalAlignment="Stretch" Padding="1" Margin="0" VerticalAlignment="Stretch"
MaxWidth="750" MaxHeight="550"> MaxWidth="750" MaxHeight="550">
</ContentControl> </ContentControl>
</StackPanel> </StackPanel>
<StackPanel> <StackPanel>
@ -826,7 +826,7 @@
MouseUp="OnPluginDirecotyClick" Foreground="Blue" MouseUp="OnPluginDirecotyClick" Foreground="Blue"
HorizontalAlignment="Right" FontSize="12" VerticalAlignment="Center"/> HorizontalAlignment="Right" FontSize="12" VerticalAlignment="Center"/>
</StackPanel> </StackPanel>
</ItemsControl> </ItemsControl>
</Border> </Border>
@ -872,8 +872,8 @@
</Border> </Border>
<Border Grid.Column="0" Grid.Row="1" Background="#f3f3f3" Padding="0 0 0 0"> <Border Grid.Column="0" Grid.Row="1" Background="#f3f3f3" Padding="0 0 0 0">
<ListBox x:Name="StoreListBox" <ListBox x:Name="StoreListBox"
ItemsSource="{Binding PluginViewModels}" ItemsSource="{Binding ExternalPlugins}"
Margin="5, 1, 0, 0" ScrollViewer.HorizontalScrollBarVisibility="Disabled" Margin="6, 0, 0, 0" ScrollViewer.HorizontalScrollBarVisibility="Disabled"
ItemContainerStyle="{StaticResource StoreList}" ItemContainerStyle="{StaticResource StoreList}"
ScrollViewer.IsDeferredScrollingEnabled="True" ScrollViewer.CanContentScroll="False" ScrollViewer.IsDeferredScrollingEnabled="True" ScrollViewer.CanContentScroll="False"
Padding="0 0 0 0" Width="Auto" VerticalContentAlignment="Center" HorizontalAlignment="Stretch"> Padding="0 0 0 0" Width="Auto" VerticalContentAlignment="Center" HorizontalAlignment="Stretch">
@ -881,6 +881,9 @@
<ItemsPanelTemplate> <ItemsPanelTemplate>
<UniformGrid IsItemsHost="True" HorizontalAlignment="Left" Columns="2" Margin="0 0 6 18" VerticalAlignment="Top" SnapsToDevicePixels="True"/> <UniformGrid IsItemsHost="True" HorizontalAlignment="Left" Columns="2" Margin="0 0 6 18" VerticalAlignment="Top" SnapsToDevicePixels="True"/>
</ItemsPanelTemplate> </ItemsPanelTemplate>
</ListBox.ItemsPanel> </ListBox.ItemsPanel>
<ListBox.ItemTemplate> <ListBox.ItemTemplate>
<DataTemplate> <DataTemplate>
@ -903,10 +906,10 @@
</Style.Triggers> </Style.Triggers>
</Style> </Style>
</StackPanel.Style> </StackPanel.Style>
<Image Source="{Binding Image, IsAsync=True}" <Image Source="{Binding IcoPath, IsAsync=True}"
Width="32" Height="32" Margin="8 0 6 0" Width="32" Height="32" Margin="8 0 6 0"
VerticalAlignment="Center"/> VerticalAlignment="Center"/>
</StackPanel> </StackPanel>
<StackPanel Grid.Column="1" Margin="0 0 8 0" VerticalAlignment="Center" Panel.ZIndex="0"> <StackPanel Grid.Column="1" Margin="0 0 8 0" VerticalAlignment="Center" Panel.ZIndex="0">
<StackPanel.Style> <StackPanel.Style>
<Style> <Style>
@ -918,11 +921,11 @@
</Style.Triggers> </Style.Triggers>
</Style> </Style>
</StackPanel.Style> </StackPanel.Style>
<TextBlock Text="{Binding PluginPair.Metadata.Name}" <TextBlock Text="{Binding Name}"
TextWrapping="WrapWithOverflow" Padding="0 0 20 0" TextWrapping="WrapWithOverflow" Padding="0 0 20 0"
ToolTip="{Binding PluginPair.Metadata.Version}" /> ToolTip="{Binding Version}" />
<TextBlock Opacity="0.5" TextWrapping="WrapWithOverflow" Margin="0 2 0 0" Padding="0 0 20 0"> <TextBlock Opacity="0.5" TextWrapping="WrapWithOverflow" Margin="0 2 0 0" Padding="0 0 20 0">
<Run Text="{Binding PluginPair.Metadata.Description}" FontSize="12" /> <Run Text="{Binding Description}" FontSize="12" />
</TextBlock> </TextBlock>
</StackPanel > </StackPanel >
@ -946,18 +949,18 @@
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="{Binding ActualWidth,RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ListBoxItem}}}" /> <ColumnDefinition Width="{Binding ActualWidth,RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ListBoxItem}}}" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Stretch"> <StackPanel Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Stretch">
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding PluginPair.Metadata.Name}" FontWeight="Bold" <TextBlock Text="{Binding Name}" FontWeight="Bold"
TextWrapping="WrapWithOverflow" Padding="0 0 0 0" Margin="20 0 0 0" TextWrapping="WrapWithOverflow" Padding="0 0 0 0" Margin="20 0 0 0"
ToolTip="{Binding PluginPair.Metadata.Name}" /> ToolTip="{Binding Name}" />
<TextBlock Text="{Binding PluginPair.Metadata.Version}" <TextBlock Text="{Binding Version}"
TextWrapping="WrapWithOverflow" Padding="0 0 20 0" Margin="10 0 0 0" TextWrapping="WrapWithOverflow" Padding="0 0 20 0" Margin="10 0 0 0"
ToolTip="{Binding PluginPair.Metadata.Version}" /> ToolTip="{Binding Version}" />
</StackPanel> </StackPanel>
<TextBlock Opacity="0.5" TextWrapping="Wrap" Margin="20 2 0 0" Padding="0 0 20 0" > <TextBlock Opacity="0.5" TextWrapping="Wrap" Margin="20 2 0 0" Padding="0 0 20 0" >
<Run Text="{Binding PluginPair.Metadata.Author}" FontSize="12" /> <Run Text="{Binding Author}" FontSize="12" />
</TextBlock> </TextBlock>
</StackPanel> </StackPanel>

View file

@ -285,9 +285,17 @@ namespace Flow.Launcher.ViewModel
/// but we don't want to move cursor to end when query is updated from TextBox /// but we don't want to move cursor to end when query is updated from TextBox
/// </summary> /// </summary>
/// <param name="queryText"></param> /// <param name="queryText"></param>
public void ChangeQueryText(string queryText) public void ChangeQueryText(string queryText, bool reQuery = false)
{ {
QueryText = queryText; if (QueryText!=queryText)
{
// re-query is done in QueryText's setter method
QueryText = queryText;
}
else if (reQuery)
{
Query();
}
QueryTextCursorMovedToEnd = true; QueryTextCursorMovedToEnd = true;
} }

View file

@ -9,6 +9,7 @@ using System.Windows.Media;
using System.Windows.Media.Imaging; using System.Windows.Media.Imaging;
using Flow.Launcher.Core; using Flow.Launcher.Core;
using Flow.Launcher.Core.Configuration; using Flow.Launcher.Core.Configuration;
using Flow.Launcher.Core.ExternalPlugins;
using Flow.Launcher.Core.Plugin; using Flow.Launcher.Core.Plugin;
using Flow.Launcher.Core.Resource; using Flow.Launcher.Core.Resource;
using Flow.Launcher.Helper; using Flow.Launcher.Helper;
@ -237,6 +238,14 @@ namespace Flow.Launcher.ViewModel
} }
} }
public IList<UserPlugin> ExternalPlugins
{
get
{
return PluginsManifest.UserPlugins;
}
}
public Control SettingProvider public Control SettingProvider
{ {
get get

View file

@ -17,7 +17,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search.WindowsIndex
{ {
// Reserved keywords in oleDB // Reserved keywords in oleDB
private const string reservedStringPattern = @"^[`\@\#\^,\&\/\\\$\%_]+$"; private const string reservedStringPattern = @"^[`\@\#\^,\&\/\\\$\%_;\[\]]+$";
internal static async Task<List<Result>> ExecuteWindowsIndexSearchAsync(string indexQueryString, string connectionString, Query query, CancellationToken token) internal static async Task<List<Result>> ExecuteWindowsIndexSearchAsync(string indexQueryString, string connectionString, Query query, CancellationToken token)
{ {

View file

@ -10,7 +10,7 @@
"Name": "Explorer", "Name": "Explorer",
"Description": "Search and manage files and folders. Explorer utilises Windows Index Search", "Description": "Search and manage files and folders. Explorer utilises Windows Index Search",
"Author": "Jeremy Wu", "Author": "Jeremy Wu",
"Version": "1.9.0", "Version": "1.9.1",
"Language": "csharp", "Language": "csharp",
"Website": "https://github.com/Flow-Launcher/Flow.Launcher", "Website": "https://github.com/Flow-Launcher/Flow.Launcher",
"ExecuteFileName": "Flow.Launcher.Plugin.Explorer.dll", "ExecuteFileName": "Flow.Launcher.Plugin.Explorer.dll",

View file

@ -1,5 +1,5 @@
using Flow.Launcher.Infrastructure.UserSettings; using Flow.Launcher.Core.ExternalPlugins;
using Flow.Launcher.Plugin.PluginsManager.Models; using Flow.Launcher.Infrastructure.UserSettings;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;

View file

@ -38,7 +38,7 @@ namespace Flow.Launcher.Plugin.PluginsManager
viewModel = new SettingsViewModel(context, Settings); viewModel = new SettingsViewModel(context, Settings);
contextMenu = new ContextMenu(Context); contextMenu = new ContextMenu(Context);
pluginManager = new PluginsManager(Context, Settings); pluginManager = new PluginsManager(Context, Settings);
_manifestUpdateTask = pluginManager.UpdateManifest().ContinueWith(_ => _manifestUpdateTask = pluginManager.UpdateManifestAsync().ContinueWith(_ =>
{ {
lastUpdateTime = DateTime.Now; lastUpdateTime = DateTime.Now;
}, TaskContinuationOptions.OnlyOnRanToCompletion); }, TaskContinuationOptions.OnlyOnRanToCompletion);
@ -62,7 +62,7 @@ namespace Flow.Launcher.Plugin.PluginsManager
if ((DateTime.Now - lastUpdateTime).TotalHours > 12 && _manifestUpdateTask.IsCompleted) // 12 hours if ((DateTime.Now - lastUpdateTime).TotalHours > 12 && _manifestUpdateTask.IsCompleted) // 12 hours
{ {
_manifestUpdateTask = pluginManager.UpdateManifest().ContinueWith(t => _manifestUpdateTask = pluginManager.UpdateManifestAsync().ContinueWith(t =>
{ {
lastUpdateTime = DateTime.Now; lastUpdateTime = DateTime.Now;
}, TaskContinuationOptions.OnlyOnRanToCompletion); }, TaskContinuationOptions.OnlyOnRanToCompletion);
@ -93,7 +93,7 @@ namespace Flow.Launcher.Plugin.PluginsManager
public async Task ReloadDataAsync() public async Task ReloadDataAsync()
{ {
await pluginManager.UpdateManifest(); await pluginManager.UpdateManifestAsync();
lastUpdateTime = DateTime.Now; lastUpdateTime = DateTime.Now;
} }
} }

View file

@ -1,31 +0,0 @@
using Flow.Launcher.Infrastructure.Http;
using Flow.Launcher.Infrastructure.Logger;
using System;
using System.Collections.Generic;
using System.Text.Json;
using System.Threading.Tasks;
namespace Flow.Launcher.Plugin.PluginsManager.Models
{
internal class PluginsManifest
{
internal List<UserPlugin> UserPlugins { get; private set; } = new List<UserPlugin>();
internal async Task DownloadManifest()
{
try
{
await using var jsonStream = await Http.GetStreamAsync("https://raw.githubusercontent.com/Flow-Launcher/Flow.Launcher.PluginsManifest/plugin_api_v2/plugins.json")
.ConfigureAwait(false);
UserPlugins = await JsonSerializer.DeserializeAsync<List<UserPlugin>>(jsonStream).ConfigureAwait(false);
}
catch (Exception e)
{
Log.Exception("|PluginManagement.GetManifest|Encountered error trying to download plugins manifest", e);
UserPlugins = new List<UserPlugin>();
}
}
}
}

View file

@ -1,9 +1,9 @@
using Flow.Launcher.Core.ExternalPlugins;
using Flow.Launcher.Core.Plugin; using Flow.Launcher.Core.Plugin;
using Flow.Launcher.Infrastructure; using Flow.Launcher.Infrastructure;
using Flow.Launcher.Infrastructure.Http; using Flow.Launcher.Infrastructure.Http;
using Flow.Launcher.Infrastructure.Logger; using Flow.Launcher.Infrastructure.Logger;
using Flow.Launcher.Infrastructure.UserSettings; using Flow.Launcher.Infrastructure.UserSettings;
using Flow.Launcher.Plugin.PluginsManager.Models;
using Flow.Launcher.Plugin.SharedCommands; using Flow.Launcher.Plugin.SharedCommands;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -17,8 +17,6 @@ namespace Flow.Launcher.Plugin.PluginsManager
{ {
internal class PluginsManager internal class PluginsManager
{ {
private PluginsManifest pluginsManifest;
private PluginInitContext Context { get; set; } private PluginInitContext Context { get; set; }
private Settings Settings { get; set; } private Settings Settings { get; set; }
@ -43,7 +41,6 @@ namespace Flow.Launcher.Plugin.PluginsManager
internal PluginsManager(PluginInitContext context, Settings settings) internal PluginsManager(PluginInitContext context, Settings settings)
{ {
pluginsManifest = new PluginsManifest();
Context = context; Context = context;
Settings = settings; Settings = settings;
} }
@ -51,7 +48,7 @@ namespace Flow.Launcher.Plugin.PluginsManager
private Task _downloadManifestTask = Task.CompletedTask; private Task _downloadManifestTask = Task.CompletedTask;
internal Task UpdateManifest() internal Task UpdateManifestAsync()
{ {
if (_downloadManifestTask.Status == TaskStatus.Running) if (_downloadManifestTask.Status == TaskStatus.Running)
{ {
@ -59,7 +56,7 @@ namespace Flow.Launcher.Plugin.PluginsManager
} }
else else
{ {
_downloadManifestTask = pluginsManifest.DownloadManifest(); _downloadManifestTask = PluginsManifest.UpdateTask;
_downloadManifestTask.ContinueWith(_ => _downloadManifestTask.ContinueWith(_ =>
Context.API.ShowMsg(Context.API.GetTranslation("plugin_pluginsmanager_update_failed_title"), Context.API.ShowMsg(Context.API.GetTranslation("plugin_pluginsmanager_update_failed_title"),
Context.API.GetTranslation("plugin_pluginsmanager_update_failed_subtitle"), icoPath, false), Context.API.GetTranslation("plugin_pluginsmanager_update_failed_subtitle"), icoPath, false),
@ -171,9 +168,9 @@ namespace Flow.Launcher.Plugin.PluginsManager
internal async ValueTask<List<Result>> RequestUpdate(string search, CancellationToken token) internal async ValueTask<List<Result>> RequestUpdate(string search, CancellationToken token)
{ {
if (!pluginsManifest.UserPlugins.Any()) if (!PluginsManifest.UserPlugins.Any())
{ {
await UpdateManifest(); await UpdateManifestAsync();
} }
token.ThrowIfCancellationRequested(); token.ThrowIfCancellationRequested();
@ -190,7 +187,7 @@ namespace Flow.Launcher.Plugin.PluginsManager
var resultsForUpdate = var resultsForUpdate =
from existingPlugin in Context.API.GetAllPlugins() from existingPlugin in Context.API.GetAllPlugins()
join pluginFromManifest in pluginsManifest.UserPlugins join pluginFromManifest in PluginsManifest.UserPlugins
on existingPlugin.Metadata.ID equals pluginFromManifest.ID on existingPlugin.Metadata.ID equals pluginFromManifest.ID
where existingPlugin.Metadata.Version.CompareTo(pluginFromManifest.Version) < where existingPlugin.Metadata.Version.CompareTo(pluginFromManifest.Version) <
0 // if current version precedes manifest version 0 // if current version precedes manifest version
@ -307,9 +304,9 @@ namespace Flow.Launcher.Plugin.PluginsManager
internal async ValueTask<List<Result>> RequestInstallOrUpdate(string searchName, CancellationToken token) internal async ValueTask<List<Result>> RequestInstallOrUpdate(string searchName, CancellationToken token)
{ {
if (!pluginsManifest.UserPlugins.Any()) if (!PluginsManifest.UserPlugins.Any())
{ {
await UpdateManifest(); await UpdateManifestAsync();
} }
token.ThrowIfCancellationRequested(); token.ThrowIfCancellationRequested();
@ -317,7 +314,7 @@ namespace Flow.Launcher.Plugin.PluginsManager
var searchNameWithoutKeyword = searchName.Replace(Settings.HotKeyInstall, string.Empty).Trim(); var searchNameWithoutKeyword = searchName.Replace(Settings.HotKeyInstall, string.Empty).Trim();
var results = var results =
pluginsManifest PluginsManifest
.UserPlugins .UserPlugins
.Select(x => .Select(x =>
new Result new Result

View file

@ -6,7 +6,7 @@
"Name": "Plugins Manager", "Name": "Plugins Manager",
"Description": "Management of installing, uninstalling or updating Flow Launcher plugins", "Description": "Management of installing, uninstalling or updating Flow Launcher plugins",
"Author": "Jeremy Wu", "Author": "Jeremy Wu",
"Version": "1.8.5", "Version": "1.9.0",
"Language": "csharp", "Language": "csharp",
"Website": "https://github.com/Flow-Launcher/Flow.Launcher", "Website": "https://github.com/Flow-Launcher/Flow.Launcher",
"ExecuteFileName": "Flow.Launcher.Plugin.PluginsManager.dll", "ExecuteFileName": "Flow.Launcher.Plugin.PluginsManager.dll",