Skip to content

Commit a63c8b0

Browse files
committed
updates to method summary and correct spell check errors
1 parent edb1450 commit a63c8b0

File tree

6 files changed

+55
-16
lines changed

6 files changed

+55
-16
lines changed

.github/actions/spelling/expect.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,5 @@ pluginsmanager
9999
alreadyexists
100100
Softpedia
101101
img
102+
Reloadable
103+
metadatas

.github/actions/spelling/patterns.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,3 +133,4 @@
133133
\bPortuguês (Brasil)\b
134134
\bčeština\b
135135
\bPortuguês\b
136+
\bIoc\b

Flow.Launcher.Core/Plugin/PluginInstaller.cs

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
namespace Flow.Launcher.Core.Plugin;
1414

1515
/// <summary>
16-
/// Helper class for installing, updating, and uninstalling plugins.
16+
/// Class for installing, updating, and uninstalling plugins.
1717
/// </summary>
1818
public static class PluginInstaller
1919
{
@@ -25,6 +25,11 @@ public static class PluginInstaller
2525
private static IPublicAPI api = null;
2626
private static IPublicAPI API => api ??= Ioc.Default.GetRequiredService<IPublicAPI>();
2727

28+
/// <summary>
29+
/// Installs a plugin and restarts the application if required by settings. Prompts user for confirmation and handles download if needed.
30+
/// </summary>
31+
/// <param name="newPlugin">The plugin to install.</param>
32+
/// <returns>A Task representing the asynchronous install operation.</returns>
2833
public static async Task InstallPluginAndCheckRestartAsync(UserPlugin newPlugin)
2934
{
3035
if (API.PluginModified(newPlugin.ID))
@@ -106,6 +111,11 @@ await DownloadFileAsync(
106111
}
107112
}
108113

114+
/// <summary>
115+
/// Installs a plugin from a local zip file and restarts the application if required by settings. Validates the zip and prompts user for confirmation.
116+
/// </summary>
117+
/// <param name="filePath">The path to the plugin zip file.</param>
118+
/// <returns>A Task representing the asynchronous install operation.</returns>
109119
public static async Task InstallPluginAndCheckRestartAsync(string filePath)
110120
{
111121
UserPlugin plugin;
@@ -147,6 +157,11 @@ public static async Task InstallPluginAndCheckRestartAsync(string filePath)
147157
await InstallPluginAndCheckRestartAsync(plugin);
148158
}
149159

160+
/// <summary>
161+
/// Uninstalls a plugin and restarts the application if required by settings. Prompts user for confirmation and whether to keep plugin settings.
162+
/// </summary>
163+
/// <param name="oldPlugin">The plugin metadata to uninstall.</param>
164+
/// <returns>A Task representing the asynchronous uninstall operation.</returns>
150165
public static async Task UninstallPluginAndCheckRestartAsync(PluginMetadata oldPlugin)
151166
{
152167
if (API.PluginModified(oldPlugin.ID))
@@ -197,6 +212,12 @@ public static async Task UninstallPluginAndCheckRestartAsync(PluginMetadata oldP
197212
}
198213
}
199214

215+
/// <summary>
216+
/// Updates a plugin to a new version and restarts the application if required by settings. Prompts user for confirmation and handles download if needed.
217+
/// </summary>
218+
/// <param name="newPlugin">The new plugin version to install.</param>
219+
/// <param name="oldPlugin">The existing plugin metadata to update.</param>
220+
/// <returns>A Task representing the asynchronous update operation.</returns>
200221
public static async Task UpdatePluginAndCheckRestartAsync(UserPlugin newPlugin, PluginMetadata oldPlugin)
201222
{
202223
if (API.ShowMsgBox(
@@ -256,15 +277,25 @@ await DownloadFileAsync(
256277
}
257278
}
258279

259-
private static async Task DownloadFileAsync(string prgBoxTitle, string downloadUrl, string filePath, CancellationTokenSource cts, bool deleteFile = true, bool showProgress = true)
280+
/// <summary>
281+
/// Downloads a file from a URL to a local path, optionally showing a progress box and handling cancellation.
282+
/// </summary>
283+
/// <param name="progressBoxTitle">The title for the progress box.</param>
284+
/// <param name="downloadUrl">The URL to download from.</param>
285+
/// <param name="filePath">The local file path to save to.</param>
286+
/// <param name="cts">Cancellation token source for cancelling the download.</param>
287+
/// <param name="deleteFile">Whether to delete the file if it already exists.</param>
288+
/// <param name="showProgress">Whether to show a progress box during download.</param>
289+
/// <returns>A Task representing the asynchronous download operation.</returns>
290+
private static async Task DownloadFileAsync(string progressBoxTitle, string downloadUrl, string filePath, CancellationTokenSource cts, bool deleteFile = true, bool showProgress = true)
260291
{
261292
if (deleteFile && File.Exists(filePath))
262293
File.Delete(filePath);
263294

264295
if (showProgress)
265296
{
266297
var exceptionHappened = false;
267-
await API.ShowProgressBoxAsync(prgBoxTitle,
298+
await API.ShowProgressBoxAsync(progressBoxTitle,
268299
async (reportProgress) =>
269300
{
270301
if (reportProgress == null)
@@ -291,6 +322,11 @@ await API.ShowProgressBoxAsync(prgBoxTitle,
291322
}
292323
}
293324

325+
/// <summary>
326+
/// Determines if the plugin install source is a known/approved source (e.g., GitHub and matches an existing plugin author).
327+
/// </summary>
328+
/// <param name="url">The URL to check.</param>
329+
/// <returns>True if the source is known, otherwise false.</returns>
294330
private static bool InstallSourceKnown(string url)
295331
{
296332
if (string.IsNullOrEmpty(url))

Flow.Launcher.Core/Plugin/PluginManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
namespace Flow.Launcher.Core.Plugin
1919
{
2020
/// <summary>
21-
/// The entry for managing Flow Launcher plugins
21+
/// Class for co-ordinating and managing all plugin lifecycle.
2222
/// </summary>
2323
public static class PluginManager
2424
{

Flow.Launcher/ProgressBoxEx.xaml.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,32 +19,32 @@ private ProgressBoxEx(Action cancelProgress)
1919

2020
public static async Task ShowAsync(string caption, Func<Action<double>, Task> reportProgressAsync, Action cancelProgress = null)
2121
{
22-
ProgressBoxEx prgBox = null;
22+
ProgressBoxEx progressBox = null;
2323
try
2424
{
2525
if (!Application.Current.Dispatcher.CheckAccess())
2626
{
2727
await Application.Current.Dispatcher.InvokeAsync(() =>
2828
{
29-
prgBox = new ProgressBoxEx(cancelProgress)
29+
progressBox = new ProgressBoxEx(cancelProgress)
3030
{
3131
Title = caption
3232
};
33-
prgBox.TitleTextBlock.Text = caption;
34-
prgBox.Show();
33+
progressBox.TitleTextBlock.Text = caption;
34+
progressBox.Show();
3535
});
3636
}
3737
else
3838
{
39-
prgBox = new ProgressBoxEx(cancelProgress)
39+
progressBox = new ProgressBoxEx(cancelProgress)
4040
{
4141
Title = caption
4242
};
43-
prgBox.TitleTextBlock.Text = caption;
44-
prgBox.Show();
43+
progressBox.TitleTextBlock.Text = caption;
44+
progressBox.Show();
4545
}
4646

47-
await reportProgressAsync(prgBox.ReportProgress).ConfigureAwait(false);
47+
await reportProgressAsync(progressBox.ReportProgress).ConfigureAwait(false);
4848
}
4949
catch (Exception e)
5050
{
@@ -58,12 +58,12 @@ await Application.Current.Dispatcher.InvokeAsync(() =>
5858
{
5959
await Application.Current.Dispatcher.InvokeAsync(() =>
6060
{
61-
prgBox?.Close();
61+
progressBox?.Close();
6262
});
6363
}
6464
else
6565
{
66-
prgBox?.Close();
66+
progressBox?.Close();
6767
}
6868
}
6969
}

Plugins/Flow.Launcher.Plugin.PluginsManager/PluginsManager.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,15 +205,15 @@ await DownloadFileAsync(
205205
}
206206
}
207207

208-
private async Task DownloadFileAsync(string prgBoxTitle, string downloadUrl, string filePath, CancellationTokenSource cts, bool deleteFile = true, bool showProgress = true)
208+
private async Task DownloadFileAsync(string progressBoxTitle, string downloadUrl, string filePath, CancellationTokenSource cts, bool deleteFile = true, bool showProgress = true)
209209
{
210210
if (deleteFile && File.Exists(filePath))
211211
File.Delete(filePath);
212212

213213
if (showProgress)
214214
{
215215
var exceptionHappened = false;
216-
await Context.API.ShowProgressBoxAsync(prgBoxTitle,
216+
await Context.API.ShowProgressBoxAsync(progressBoxTitle,
217217
async (reportProgress) =>
218218
{
219219
if (reportProgress == null)

0 commit comments

Comments
 (0)