Skip to content

Commit a918e7d

Browse files
committed
Merge Dev
2 parents cb13985 + ce525b3 commit a918e7d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+833
-468
lines changed

Flow.Launcher.Core/Plugin/PluginAssemblyLoader.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,4 @@ internal bool ExistsInReferencedPluginPackage(AssemblyName assemblyName)
5454
return referencedPluginPackageDependencyResolver.ResolveAssemblyToPath(assemblyName) != null;
5555
}
5656
}
57-
}
57+
}

Flow.Launcher.Core/Plugin/PluginManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,4 +320,4 @@ public static void ReplaceActionKeyword(string id, string oldActionKeyword, stri
320320
}
321321
}
322322
}
323-
}
323+
}

Flow.Launcher.Core/Plugin/PluginsLoader.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,4 +183,4 @@ public static IEnumerable<PluginPair> ExecutablePlugins(IEnumerable<PluginMetada
183183
});
184184
}
185185
}
186-
}
186+
}

Flow.Launcher.Core/Updater.cs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ public async Task UpdateApp(IPublicAPI api, bool silentUpdate = true)
3535
UpdateInfo newUpdateInfo;
3636

3737
if (!silentUpdate)
38-
api.ShowMsg("Please wait...", "Checking for new update");
38+
api.ShowMsg(api.GetTranslation("pleaseWait"),
39+
api.GetTranslation("update_flowlauncher_update_check"));
3940

4041
using var updateManager = await GitHubUpdateManager(GitHubRepository).ConfigureAwait(false);
4142

@@ -51,12 +52,13 @@ public async Task UpdateApp(IPublicAPI api, bool silentUpdate = true)
5152
if (newReleaseVersion <= currentVersion)
5253
{
5354
if (!silentUpdate)
54-
MessageBox.Show("You already have the latest Flow Launcher version");
55+
MessageBox.Show(api.GetTranslation("update_flowlauncher_already_on_latest"));
5556
return;
5657
}
5758

5859
if (!silentUpdate)
59-
api.ShowMsg("Update found", "Updating...");
60+
api.ShowMsg(api.GetTranslation("update_flowlauncher_update_found"),
61+
api.GetTranslation("update_flowlauncher_updating"));
6062

6163
await updateManager.DownloadReleases(newUpdateInfo.ReleasesToApply).ConfigureAwait(false);
6264

@@ -67,8 +69,9 @@ public async Task UpdateApp(IPublicAPI api, bool silentUpdate = true)
6769
var targetDestination = updateManager.RootAppDirectory + $"\\app-{newReleaseVersion.ToString()}\\{DataLocation.PortableFolderName}";
6870
FilesFolders.CopyAll(DataLocation.PortableDataPath, targetDestination);
6971
if (!FilesFolders.VerifyBothFolderFilesEqual(DataLocation.PortableDataPath, targetDestination))
70-
MessageBox.Show("Flow Launcher was not able to move your user profile data to the new update version. Please manually " +
71-
$"move your profile data folder from {DataLocation.PortableDataPath} to {targetDestination}");
72+
MessageBox.Show(string.Format(api.GetTranslation("update_flowlauncher_fail_moving_portable_user_profile_data"),
73+
DataLocation.PortableDataPath,
74+
targetDestination));
7275
}
7376
else
7477
{
@@ -79,15 +82,16 @@ public async Task UpdateApp(IPublicAPI api, bool silentUpdate = true)
7982

8083
Log.Info($"|Updater.UpdateApp|Update success:{newVersionTips}");
8184

82-
if (MessageBox.Show(newVersionTips, "New Update", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
85+
if (MessageBox.Show(newVersionTips, api.GetTranslation("update_flowlauncher_new_update"), MessageBoxButton.YesNo) == MessageBoxResult.Yes)
8386
{
8487
UpdateManager.RestartApp(Constant.ApplicationFileName);
8588
}
8689
}
8790
catch (Exception e) when (e is HttpRequestException || e is WebException || e is SocketException)
8891
{
8992
Log.Exception($"|Updater.UpdateApp|Check your connection and proxy settings to github-cloud.s3.amazonaws.com.", e);
90-
api.ShowMsg("Update Failed", "Check your connection and try updating proxy settings to github-cloud.s3.amazonaws.com.");
93+
api.ShowMsg(api.GetTranslation("update_flowlauncher_fail"),
94+
api.GetTranslation("update_flowlauncher_check_connection"));
9195
return;
9296
}
9397
}

Flow.Launcher.Infrastructure/Image/ImageLoader.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ public static void Initialize()
3939

4040
var usage = LoadStorageToConcurrentDictionary();
4141

42-
4342
foreach (var icon in new[] { Constant.DefaultIcon, Constant.MissingImgIcon })
4443
{
4544
ImageSource img = new BitmapImage(new Uri(icon));

Flow.Launcher.Infrastructure/Storage/JsonStorage.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace Flow.Launcher.Infrastructure.Storage
99
/// <summary>
1010
/// Serialize object using json format.
1111
/// </summary>
12-
public class JsonStrorage<T>
12+
public class JsonStrorage<T> where T : new()
1313
{
1414
private readonly JsonSerializerOptions _serializerSettings;
1515
private T _data;
@@ -76,7 +76,7 @@ private void LoadDefault()
7676
BackupOriginFile();
7777
}
7878

79-
_data = JsonSerializer.Deserialize<T>("{}", _serializerSettings);
79+
_data = new T();
8080
Save();
8181
}
8282

Flow.Launcher.Plugin/Flow.Launcher.Plugin.csproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
</PropertyGroup>
1515

1616
<PropertyGroup>
17-
<Version>1.3.1</Version>
18-
<PackageVersion>1.3.1</PackageVersion>
19-
<AssemblyVersion>1.3.1</AssemblyVersion>
20-
<FileVersion>1.3.1</FileVersion>
17+
<Version>1.4.0</Version>
18+
<PackageVersion>1.4.0</PackageVersion>
19+
<AssemblyVersion>1.4.0</AssemblyVersion>
20+
<FileVersion>1.4.0</FileVersion>
2121
<PackageId>Flow.Launcher.Plugin</PackageId>
2222
<Authors>Flow-Launcher</Authors>
2323
<PackageLicenseExpression>MIT</PackageLicenseExpression>
@@ -64,4 +64,4 @@
6464
<PackageReference Include="JetBrains.Annotations" Version="2019.1.3" />
6565
</ItemGroup>
6666

67-
</Project>
67+
</Project>

Flow.Launcher.Plugin/IAsyncPlugin.cs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,28 @@
44

55
namespace Flow.Launcher.Plugin
66
{
7+
/// <summary>
8+
/// Asynchronous Plugin Model for Flow Launcher
9+
/// </summary>
710
public interface IAsyncPlugin
811
{
12+
/// <summary>
13+
/// Asynchronous Querying
14+
/// </summary>
15+
/// <para>
16+
/// If the Querying or Init method requires high IO transmission
17+
/// or performing CPU intense jobs (performing better with cancellation), please use this IAsyncPlugin interface
18+
/// </para>
19+
/// <param name="query">Query to search</param>
20+
/// <param name="token">Cancel when querying job is obsolete</param>
21+
/// <returns></returns>
922
Task<List<Result>> QueryAsync(Query query, CancellationToken token);
23+
24+
/// <summary>
25+
/// Initialize plugin asynchrously (will still wait finish to continue)
26+
/// </summary>
27+
/// <param name="context"></param>
28+
/// <returns></returns>
1029
Task InitAsync(PluginInitContext context);
1130
}
12-
}
31+
}

Flow.Launcher.Plugin/IPlugin.cs

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,30 @@
22

33
namespace Flow.Launcher.Plugin
44
{
5+
/// <summary>
6+
/// Synchronous Plugin Model for Flow Launcher
7+
/// <para>
8+
/// If the Querying or Init method requires high IO transmission
9+
/// or performaing CPU intense jobs (performing better with cancellation), please try the IAsyncPlugin interface
10+
/// </para>
11+
/// </summary>
512
public interface IPlugin
613
{
14+
/// <summary>
15+
/// Querying when user's search changes
16+
/// <para>
17+
/// This method will be called within a Task.Run,
18+
/// so please avoid synchrously wait for long.
19+
/// </para>
20+
/// </summary>
21+
/// <param name="query">Query to search</param>
22+
/// <returns></returns>
723
List<Result> Query(Query query);
8-
24+
25+
/// <summary>
26+
/// Initialize plugin
27+
/// </summary>
28+
/// <param name="context"></param>
929
void Init(PluginInitContext context);
1030
}
11-
}
31+
}

Flow.Launcher.Plugin/Interfaces/IAsyncReloadable.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,19 @@
22

33
namespace Flow.Launcher.Plugin
44
{
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>
516
public interface IAsyncReloadable
617
{
718
Task ReloadDataAsync();
819
}
9-
}
20+
}

0 commit comments

Comments
 (0)