Skip to content

Commit c1778a5

Browse files
committed
Rearrange Interfaces
1 parent dea1689 commit c1778a5

File tree

7 files changed

+97
-75
lines changed

7 files changed

+97
-75
lines changed

Flow.Launcher.Plugin/Features.cs

Lines changed: 2 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -2,86 +2,13 @@
22
using System.Collections.Generic;
33
using System.Collections.Specialized;
44
using System.Threading;
5-
using System.Threading.Tasks;
65

76
namespace Flow.Launcher.Plugin
87
{
9-
public interface IFeatures
10-
{
11-
}
12-
13-
public interface IContextMenu : IFeatures
14-
{
15-
List<Result> LoadContextMenus(Result selectedResult);
16-
}
17-
188
/// <summary>
19-
/// Represent plugins that support internationalization
9+
/// Base Interface for Flow's special plugin feature interface
2010
/// </summary>
21-
public interface IPluginI18n : IFeatures
22-
{
23-
string GetTranslatedPluginTitle();
24-
25-
string GetTranslatedPluginDescription();
26-
}
27-
28-
public interface IResultUpdated : IFeatures
29-
{
30-
event ResultUpdatedEventHandler ResultsUpdated;
31-
}
32-
33-
public delegate void ResultUpdatedEventHandler(IResultUpdated sender, ResultUpdatedEventArgs e);
34-
35-
public class ResultUpdatedEventArgs : EventArgs
36-
{
37-
public List<Result> Results;
38-
public Query Query;
39-
public CancellationToken Token { get; init; } = default;
40-
}
41-
42-
/// <summary>
43-
/// This interface is to indicate and allow plugins to asyncronously reload their
44-
/// in memory data cache or other mediums when user makes a new change
45-
/// that is not immediately captured. For example, for BrowserBookmark and Program
46-
/// plugin does not automatically detect when a user added a new bookmark or program,
47-
/// so this interface's function is exposed to allow user manually do the reloading after
48-
/// those new additions.
49-
///
50-
/// The command that allows user to manual reload is exposed via Plugin.Sys, and
51-
/// it will call the plugins that have implemented this interface.
52-
/// </summary>
53-
public interface IAsyncReloadable : IFeatures
54-
{
55-
Task ReloadDataAsync();
56-
}
57-
58-
/// <summary>
59-
/// This interface is to indicate and allow plugins to synchronously reload their
60-
/// in memory data cache or other mediums when user makes a new change
61-
/// that is not immediately captured. For example, for BrowserBookmark and Program
62-
/// plugin does not automatically detect when a user added a new bookmark or program,
63-
/// so this interface's function is exposed to allow user manually do the reloading after
64-
/// those new additions.
65-
///
66-
/// The command that allows user to manual reload is exposed via Plugin.Sys, and
67-
/// it will call the plugins that have implemented this interface.
68-
///
69-
/// <para>
70-
/// If requiring reloading data asynchronously, please use the IAsyncReloadable interface
71-
/// </para>
72-
/// </summary>
73-
public interface IReloadable : IFeatures
74-
{
75-
void ReloadData();
76-
}
77-
78-
/// <summary>
79-
/// Save addtional plugin data. Inherit this interface if additional data e.g. cache needs to be saved,
80-
/// Otherwise if LoadSettingJsonStorage or SaveSettingJsonStorage has been callded,
81-
/// plugin settings will be automatically saved (see Flow.Launcher/PublicAPIInstance.SavePluginSettings) by Flow
82-
/// </summary>
83-
public interface ISavable : IFeatures
11+
public interface IFeatures
8412
{
85-
void Save();
8613
}
8714
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using System.Threading.Tasks;
2+
3+
namespace Flow.Launcher.Plugin
4+
{
5+
/// <summary>
6+
/// This interface is to indicate and allow plugins to asyncronously reload their
7+
/// in memory data cache or other mediums when user makes a new change
8+
/// that is not immediately captured. For example, for BrowserBookmark and Program
9+
/// plugin does not automatically detect when a user added a new bookmark or program,
10+
/// so this interface's function is exposed to allow user manually do the reloading after
11+
/// those new additions.
12+
///
13+
/// The command that allows user to manual reload is exposed via Plugin.Sys, and
14+
/// it will call the plugins that have implemented this interface.
15+
/// </summary>
16+
public interface IAsyncReloadable : IFeatures
17+
{
18+
Task ReloadDataAsync();
19+
}
20+
}

Flow.Launcher.Plugin/IContextMenu.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
using System.Collections.Generic;
2+
3+
namespace Flow.Launcher.Plugin
4+
{
5+
public interface IContextMenu : IFeatures
6+
{
7+
List<Result> LoadContextMenus(Result selectedResult);
8+
}
9+
}

Flow.Launcher.Plugin/IPluginI18n.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
namespace Flow.Launcher.Plugin
2+
{
3+
/// <summary>
4+
/// Represent plugins that support internationalization
5+
/// </summary>
6+
public interface IPluginI18n : IFeatures
7+
{
8+
string GetTranslatedPluginTitle();
9+
10+
string GetTranslatedPluginDescription();
11+
}
12+
}

Flow.Launcher.Plugin/IReloadable.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
namespace Flow.Launcher.Plugin
2+
{
3+
/// <summary>
4+
/// This interface is to indicate and allow plugins to synchronously reload their
5+
/// in memory data cache or other mediums when user makes a new change
6+
/// that is not immediately captured. For example, for BrowserBookmark and Program
7+
/// plugin does not automatically detect when a user added a new bookmark or program,
8+
/// so this interface's function is exposed to allow user manually do the reloading after
9+
/// those new additions.
10+
///
11+
/// The command that allows user to manual reload is exposed via Plugin.Sys, and
12+
/// it will call the plugins that have implemented this interface.
13+
///
14+
/// <para>
15+
/// If requiring reloading data asynchronously, please use the IAsyncReloadable interface
16+
/// </para>
17+
/// </summary>
18+
public interface IReloadable : IFeatures
19+
{
20+
void ReloadData();
21+
}
22+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Threading;
4+
5+
namespace Flow.Launcher.Plugin
6+
{
7+
public interface IResultUpdated : IFeatures
8+
{
9+
event ResultUpdatedEventHandler ResultsUpdated;
10+
}
11+
12+
public delegate void ResultUpdatedEventHandler(IResultUpdated sender, ResultUpdatedEventArgs e);
13+
14+
public class ResultUpdatedEventArgs : EventArgs
15+
{
16+
public List<Result> Results;
17+
public Query Query;
18+
public CancellationToken Token { get; init; }
19+
}
20+
}

Flow.Launcher.Plugin/ISavable.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
namespace Flow.Launcher.Plugin
2+
{
3+
/// <summary>
4+
/// Save addtional plugin data. Inherit this interface if additional data e.g. cache needs to be saved,
5+
/// Otherwise if LoadSettingJsonStorage or SaveSettingJsonStorage has been callded,
6+
/// plugin settings will be automatically saved (see Flow.Launcher/PublicAPIInstance.SavePluginSettings) by Flow
7+
/// </summary>
8+
public interface ISavable : IFeatures
9+
{
10+
void Save();
11+
}
12+
}

0 commit comments

Comments
 (0)