Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Flow.Launcher.Core/Plugin/JsonRPCPluginSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

namespace Flow.Launcher.Core.Plugin
{
public class JsonRPCPluginSettings
public class JsonRPCPluginSettings : ISavable
{
public required JsonRpcConfigurationModel? Configuration { get; init; }

Expand Down Expand Up @@ -419,14 +419,14 @@
}
case "hyperlink":
{
var hyperlink = new Hyperlink

Check warning on line 422 in Flow.Launcher.Core/Plugin/JsonRPCPluginSettings.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`hyperlink` is not a recognized word. (unrecognized-spelling)
{
ToolTip = attributes.Description,
NavigateUri = attributes.url
};

hyperlink.Inlines.Add(attributes.urlLabel);

Check warning on line 428 in Flow.Launcher.Core/Plugin/JsonRPCPluginSettings.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`hyperlink` is not a recognized word. (unrecognized-spelling)
hyperlink.RequestNavigate += (sender, e) =>

Check warning on line 429 in Flow.Launcher.Core/Plugin/JsonRPCPluginSettings.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`hyperlink` is not a recognized word. (unrecognized-spelling)
{
API.OpenUrl(e.Uri);
e.Handled = true;
Expand All @@ -440,7 +440,7 @@
TextAlignment = TextAlignment.Left,
TextWrapping = TextWrapping.Wrap
};
textBlock.Inlines.Add(hyperlink);

Check warning on line 443 in Flow.Launcher.Core/Plugin/JsonRPCPluginSettings.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`hyperlink` is not a recognized word. (unrecognized-spelling)

contentControl = textBlock;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
using System.Threading.Tasks;
using Flow.Launcher.Infrastructure.Logger;
using Flow.Launcher.Infrastructure.UserSettings;
using Flow.Launcher.Plugin;
using Flow.Launcher.Plugin.SharedCommands;

namespace Flow.Launcher.Infrastructure.Storage
{
public class FlowLauncherJsonStorage<T> : JsonStorage<T> where T : new()
// Expose ISaveable interface in derived class to make sure we are calling the new version of Save method
public class FlowLauncherJsonStorage<T> : JsonStorage<T>, ISavable where T : new()
{
private static readonly string ClassName = "FlowLauncherJsonStorage";

Expand Down
4 changes: 3 additions & 1 deletion Flow.Launcher.Infrastructure/Storage/PluginBinaryStorage.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
using System.IO;
using System.Threading.Tasks;
using Flow.Launcher.Infrastructure.Logger;
using Flow.Launcher.Plugin;
using Flow.Launcher.Plugin.SharedCommands;

namespace Flow.Launcher.Infrastructure.Storage
{
public class PluginBinaryStorage<T> : BinaryStorage<T> where T : new()
// Expose ISaveable interface in derived class to make sure we are calling the new version of Save method
public class PluginBinaryStorage<T> : BinaryStorage<T>, ISavable where T : new()
{
private static readonly string ClassName = "PluginBinaryStorage";

Expand Down
4 changes: 3 additions & 1 deletion Flow.Launcher.Infrastructure/Storage/PluginJsonStorage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
using System.Threading.Tasks;
using Flow.Launcher.Infrastructure.Logger;
using Flow.Launcher.Infrastructure.UserSettings;
using Flow.Launcher.Plugin;
using Flow.Launcher.Plugin.SharedCommands;

namespace Flow.Launcher.Infrastructure.Storage
{
public class PluginJsonStorage<T> : JsonStorage<T> where T : new()
// Expose ISaveable interface in derived class to make sure we are calling the new version of Save method
public class PluginJsonStorage<T> : JsonStorage<T>, ISavable where T : new()
{
// Use assembly name to check which plugin is using this storage
public readonly string AssemblyName;
Expand Down
10 changes: 4 additions & 6 deletions Flow.Launcher/PublicAPIInstance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

// Must use getter to avoid circular dependency
private Updater _updater;
private Updater Updater => _updater ??= Ioc.Default.GetRequiredService<Updater>();

Check warning on line 52 in Flow.Launcher/PublicAPIInstance.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`Ioc` is not a recognized word. (unrecognized-spelling)

private readonly object _saveSettingsLock = new();

Expand Down Expand Up @@ -147,7 +147,7 @@
ShellCommand.Execute(startInfo);
}

[System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "VSTHRD100:Avoid async void methods", Justification = "<Pending>")]

Check warning on line 150 in Flow.Launcher/PublicAPIInstance.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`VSTHRD` is not a recognized word. (unrecognized-spelling)
public async void CopyToClipboard(string stringToCopy, bool directCopy = false, bool showDefaultNotification = true)
{
if (string.IsNullOrEmpty(stringToCopy))
Expand Down Expand Up @@ -276,7 +276,7 @@
public void LogException(string className, string message, Exception e, [CallerMemberName] string methodName = "") =>
Log.Exception(className, message, e, methodName);

private readonly ConcurrentDictionary<Type, object> _pluginJsonStorages = new();
private readonly ConcurrentDictionary<Type, ISavable> _pluginJsonStorages = new();

public void RemovePluginSettings(string assemblyName)
{
Expand All @@ -294,9 +294,8 @@

public void SavePluginSettings()
{
foreach (var value in _pluginJsonStorages.Values)
foreach (var savable in _pluginJsonStorages.Values)
{
var savable = value as ISavable;
savable?.Save();
}
}
Expand Down Expand Up @@ -496,7 +495,7 @@
public bool SetCurrentTheme(ThemeData theme) =>
Theme.ChangeTheme(theme.FileNameWithoutExtension);

private readonly ConcurrentDictionary<(string, string, Type), object> _pluginBinaryStorages = new();
private readonly ConcurrentDictionary<(string, string, Type), ISavable> _pluginBinaryStorages = new();

public void RemovePluginCaches(string cacheDirectory)
{
Expand All @@ -513,9 +512,8 @@

public void SavePluginCaches()
{
foreach (var value in _pluginBinaryStorages.Values)
foreach (var savable in _pluginBinaryStorages.Values)
{
var savable = value as ISavable;
savable?.Save();
}
}
Expand Down
Loading