Skip to content

Commit ed57495

Browse files
committed
Replace dynamic type with a strongly-typed model
1 parent 44fbc6e commit ed57495

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

Flow.Launcher.Core/Plugin/PluginInstaller.cs

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -300,14 +300,14 @@ where string.Compare(existingPlugin.Metadata.Version, pluginUpdateSource.Version
300300
0 // if current version precedes version of the plugin from update source (e.g. PluginsManifest)
301301
&& !API.PluginModified(existingPlugin.Metadata.ID)
302302
select
303-
new
303+
new PluginUpdateInfo()
304304
{
305-
existingPlugin.Metadata.ID,
306-
pluginUpdateSource.Name,
307-
pluginUpdateSource.Author,
305+
ID = existingPlugin.Metadata.ID,
306+
Name = existingPlugin.Metadata.Name,
307+
Author = existingPlugin.Metadata.Author,
308308
CurrentVersion = existingPlugin.Metadata.Version,
309309
NewVersion = pluginUpdateSource.Version,
310-
existingPlugin.Metadata.IcoPath,
310+
IcoPath = existingPlugin.Metadata.IcoPath,
311311
PluginExistingMetadata = existingPlugin.Metadata,
312312
PluginNewUserPlugin = pluginUpdateSource
313313
}).ToList();
@@ -339,7 +339,7 @@ where string.Compare(existingPlugin.Metadata.Version, pluginUpdateSource.Version
339339
string.Join(", ", resultsForUpdate.Select(x => x.PluginExistingMetadata.Name)));
340340
}
341341

342-
private static void UpdateAllPlugins(IEnumerable<dynamic> resultsForUpdate)
342+
private static void UpdateAllPlugins(IEnumerable<PluginUpdateInfo> resultsForUpdate)
343343
{
344344
_ = Task.WhenAll(resultsForUpdate.Select(async plugin =>
345345
{
@@ -445,4 +445,16 @@ private static bool InstallSourceKnown(string url)
445445
x.Metadata.Website.StartsWith(constructedUrlPart)
446446
);
447447
}
448+
449+
private record PluginUpdateInfo
450+
{
451+
public string ID { get; init; }
452+
public string Name { get; init; }
453+
public string Author { get; init; }
454+
public string CurrentVersion { get; init; }
455+
public string NewVersion { get; init; }
456+
public string IcoPath { get; init; }
457+
public PluginMetadata PluginExistingMetadata { get; init; }
458+
public UserPlugin PluginNewUserPlugin { get; init; }
459+
}
448460
}

0 commit comments

Comments
 (0)