diff --git a/Flow.Launcher.Core/ExternalPlugins/UserPlugin.cs b/Flow.Launcher.Core/ExternalPlugins/UserPlugin.cs
index f98815c1a..0bea2e0e1 100644
--- a/Flow.Launcher.Core/ExternalPlugins/UserPlugin.cs
+++ b/Flow.Launcher.Core/ExternalPlugins/UserPlugin.cs
@@ -1,4 +1,6 @@
-namespace Flow.Launcher.Core.ExternalPlugins
+using System;
+
+namespace Flow.Launcher.Core.ExternalPlugins
{
public record UserPlugin
{
@@ -12,5 +14,12 @@
public string UrlDownload { get; set; }
public string UrlSourceCode { get; set; }
public string IcoPath { get; set; }
+ public DateTime LatestReleaseDate { get; set; }
+ public DateTime DateAdded { get; set; }
+
+ /* Label Data for Plugin Store */
+ public bool LabelNew { get; set; }
+ public bool LabelInstalled { get; set; }
+ public bool LabelUpdated { get; set; }
}
}
diff --git a/Flow.Launcher/Converters/BoolToVisibilityConverter.cs b/Flow.Launcher/Converters/BoolToVisibilityConverter.cs
new file mode 100644
index 000000000..ad474d693
--- /dev/null
+++ b/Flow.Launcher/Converters/BoolToVisibilityConverter.cs
@@ -0,0 +1,43 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+
+namespace Flow.Launcher.Converters
+{
+ public class BoolToVisibilityConverter : IValueConverter
+ {
+ public object Convert(object value, System.Type targetType, object parameter, CultureInfo culture)
+ {
+ if (parameter != null)
+ {
+ if (value is true)
+ {
+ return Visibility.Collapsed;
+ }
+
+ else
+ {
+ return Visibility.Visible;
+ }
+ }
+ else {
+ if (value is true)
+ {
+ return Visibility.Visible;
+ }
+
+ else {
+ return Visibility.Collapsed;
+ }
+ }
+ }
+
+ public object ConvertBack(object value, System.Type targetType, object parameter, CultureInfo culture) => throw new System.InvalidOperationException();
+ }
+}
diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml
index b2018254c..e047fd685 100644
--- a/Flow.Launcher/Languages/en.xaml
+++ b/Flow.Launcher/Languages/en.xaml
@@ -88,6 +88,14 @@
Plugin Store
Refresh
Install
+ Installed
+ Plug-in already installed
+ New
+ This is a newly registered plug-in in 7 days
+ Updated
+ This plug-in has been updated within the last 5 days
+
+
Theme
diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml
index 7fc583777..d9ec94f98 100644
--- a/Flow.Launcher/SettingWindow.xaml
+++ b/Flow.Launcher/SettingWindow.xaml
@@ -38,6 +38,7 @@
+
@@ -1513,11 +1514,27 @@
VerticalAlignment="Top"
Background="#f14551"
CornerRadius="4"
- Visibility="Collapsed">
+ ToolTip="{DynamicResource LabelNewToolTip}"
+ Visibility="{Binding LabelNew, Converter={StaticResource BoolToVisibilityConverter}}">
+ Foreground="{DynamicResource Color01B}"
+ Text="{DynamicResource LabelNew}" />
+
+
+
+ ToolTip="{DynamicResource LabelInstalledToolTip}"
+ Visibility="{Binding LabelInstalled, Converter={StaticResource BoolToVisibilityConverter}}">
+ Foreground="{DynamicResource Color01B}"
+ Text="{DynamicResource LabelInstalled}" />
@@ -1670,7 +1688,9 @@
HorizontalAlignment="Right"
VerticalAlignment="Center"
Click="OnExternalPluginInstallClick"
- Content="{DynamicResource install}" />
+ Content="{DynamicResource install}"
+ Visibility="{Binding LabelInstalled, Converter={StaticResource BoolToVisibilityConverter}, ConverterParameter='!'}" />
+
diff --git a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs
index a63e54f3b..3a21a38cb 100644
--- a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs
+++ b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs
@@ -1,11 +1,14 @@
using System;
+using System.Collections;
using System.Collections.Generic;
+using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
+using System.Windows.Documents;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using Flow.Launcher.Core;
@@ -19,6 +22,8 @@ using Flow.Launcher.Infrastructure.Storage;
using Flow.Launcher.Infrastructure.UserSettings;
using Flow.Launcher.Plugin;
using Flow.Launcher.Plugin.SharedModels;
+using Microsoft.FSharp.Data.UnitSystems.SI.UnitNames;
+using Windows.Management.Deployment.Preview;
namespace Flow.Launcher.ViewModel
{
@@ -241,7 +246,8 @@ namespace Flow.Launcher.ViewModel
#region plugin
- public static string Plugin => @"https://github.com/Flow-Launcher/Flow.Launcher.PluginsManifest";
+ //public static string Plugin => @"https://github.com/Flow-Launcher/Flow.Launcher.PluginsManifest";
+ public static string Plugin => @"https://raw.githubusercontent.com/Flow-Launcher/Flow.Launcher.PluginsManifest/plugin_api_v2/plugins.json";
public PluginViewModel SelectedPlugin { get; set; }
public IList PluginViewModels
@@ -261,10 +267,51 @@ namespace Flow.Launcher.ViewModel
{
get
{
- return PluginsManifest.UserPlugins;
+ return LabelMaker(PluginsManifest.UserPlugins);
}
}
+ private IList LabelMaker(IList list)
+ {
+ foreach (UserPlugin item in list)
+ {
+ item.LabelNew = false;
+ item.LabelInstalled = false;
+ item.LabelUpdated = false;
+
+ foreach (var vm in PluginViewModels)
+ {
+
+ var id = vm.PluginPair.Metadata.ID;
+ if (item.ID == vm.PluginPair.Metadata.ID) // Add Installed Label
+ {
+ item.LabelInstalled = true;
+ }
+
+ TimeSpan UpdatedDay = DateTime.Now.Subtract(item.LatestReleaseDate);
+ int LastUpdated = UpdatedDay.Days;
+
+ if (LastUpdated <= 5) // Add Updated Label
+ {
+ item.LabelUpdated = true;
+ }
+ }
+ TimeSpan AddedDay = DateTime.Now.Subtract(item.DateAdded);
+ int DateAdded = AddedDay.Days;
+ if (DateAdded <= 7)
+ {
+
+ //item.LabelNew = true; // Add New Label
+ //item.LabelUpdated = false; // Hide Updated Label when Added New Label. New and Update doesn't show both same time.
+ }
+ }
+
+ // New first, Updated second. Installed to bottom of list.
+ list = list.OrderByDescending(x => x.LabelNew).OrderByDescending(x => x.LabelUpdated).ThenBy(y => y.LabelInstalled).ToList();
+
+ return list;
+ }
+
public Control SettingProvider
{
get