Skip to content

Commit 3d47d24

Browse files
committed
Move all interface to Features.cs
1 parent 6f65e10 commit 3d47d24

File tree

5 files changed

+87
-94
lines changed

5 files changed

+87
-94
lines changed

Flow.Launcher.Plugin/Features.cs

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Collections.Specialized;
4+
using System.Threading;
5+
using System.Threading.Tasks;
6+
7+
namespace Flow.Launcher.Plugin
8+
{
9+
public interface IFeatures
10+
{
11+
}
12+
13+
public interface IContextMenu : IFeatures
14+
{
15+
List<Result> LoadContextMenus(Result selectedResult);
16+
}
17+
18+
/// <summary>
19+
/// Represent plugins that support internationalization
20+
/// </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
84+
{
85+
void Save();
86+
}
87+
}

Flow.Launcher.Plugin/Interfaces/Feature.cs

Lines changed: 0 additions & 40 deletions
This file was deleted.

Flow.Launcher.Plugin/Interfaces/IAsyncReloadable.cs

Lines changed: 0 additions & 20 deletions
This file was deleted.

Flow.Launcher.Plugin/Interfaces/IReloadable.cs

Lines changed: 0 additions & 22 deletions
This file was deleted.

Flow.Launcher.Plugin/Interfaces/ISavable.cs

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)