Skip to content

Commit ef46225

Browse files
committed
Merge branch 'dev' into add_filecontent_search
2 parents 8abd97d + 0c7298c commit ef46225

File tree

10 files changed

+50
-24
lines changed

10 files changed

+50
-24
lines changed

Flow.Launcher.Core/Updater.cs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
using Flow.Launcher.Infrastructure.Logger;
1717
using System.IO;
1818
using Flow.Launcher.Infrastructure.UserSettings;
19+
using Flow.Launcher.Plugin;
1920

2021
namespace Flow.Launcher.Core
2122
{
@@ -28,11 +29,14 @@ public Updater(string gitHubRepository)
2829
GitHubRepository = gitHubRepository;
2930
}
3031

31-
public async Task UpdateApp(bool silentIfLatestVersion = true)
32+
public async Task UpdateApp(IPublicAPI api , bool silentUpdate = true)
3233
{
3334
UpdateManager updateManager;
3435
UpdateInfo newUpdateInfo;
3536

37+
if (!silentUpdate)
38+
api.ShowMsg("Please wait...", "Checking for new update");
39+
3640
try
3741
{
3842
updateManager = await GitHubUpdateManager(GitHubRepository);
@@ -62,12 +66,15 @@ public async Task UpdateApp(bool silentIfLatestVersion = true)
6266

6367
if (newReleaseVersion <= currentVersion)
6468
{
65-
if (!silentIfLatestVersion)
69+
if (!silentUpdate)
6670
MessageBox.Show("You already have the latest Flow Launcher version");
6771
updateManager.Dispose();
6872
return;
6973
}
70-
74+
75+
if (!silentUpdate)
76+
api.ShowMsg("Update found", "Updating...");
77+
7178
try
7279
{
7380
await updateManager.DownloadReleases(newUpdateInfo.ReleasesToApply);
@@ -96,11 +103,15 @@ public async Task UpdateApp(bool silentIfLatestVersion = true)
96103

97104
var newVersionTips = NewVersinoTips(newReleaseVersion.ToString());
98105

99-
MessageBox.Show(newVersionTips);
100106
Log.Info($"|Updater.UpdateApp|Update success:{newVersionTips}");
101107

102108
// always dispose UpdateManager
103109
updateManager.Dispose();
110+
111+
if (MessageBox.Show(newVersionTips, "New Update", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
112+
{
113+
UpdateManager.RestartApp(Constant.ApplicationFileName);
114+
}
104115
}
105116

106117
[UsedImplicitly]

Flow.Launcher/App.xaml.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,12 @@ private void AutoUpdates()
118118
var timer = new Timer(1000 * 60 * 60 * 5);
119119
timer.Elapsed += async (s, e) =>
120120
{
121-
await _updater.UpdateApp();
121+
await _updater.UpdateApp(API);
122122
};
123123
timer.Start();
124124

125125
// check updates on startup
126-
await _updater.UpdateApp();
126+
await _updater.UpdateApp(API);
127127
}
128128
});
129129
}

Flow.Launcher/Languages/en.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
<system:String x:Key="version">Version</system:String>
9797
<system:String x:Key="about_activate_times">You have activated Flow Launcher {0} times</system:String>
9898
<system:String x:Key="checkUpdates">Check for Updates</system:String>
99-
<system:String x:Key="newVersionTips">New version {0} is available, please restart Flow Launcher.</system:String>
99+
<system:String x:Key="newVersionTips">New version {0} is available, would you like to restart Flow Launcher to use the update?</system:String>
100100
<system:String x:Key="checkUpdatesFailed">Check updates failed, please check your connection and proxy settings to api.github.com.</system:String>
101101
<system:String x:Key="downloadUpdatesFailed">
102102
Download updates failed, please check your connection and proxy settings to github-cloud.s3.amazonaws.com,

Flow.Launcher/Themes/BlurWhite.xaml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,10 @@
99

1010
<Style x:Key="QueryBoxStyle" BasedOn="{StaticResource BaseQueryBoxStyle}" TargetType="{x:Type TextBox}">
1111
<Setter Property="Foreground" Value="#FF000000" />
12-
<Setter Property="Background" Value="#01FFFFFF" />
12+
<Setter Property="Background" Value="Transparent" />
1313
</Style>
1414

15-
<Style x:Key="QuerySuggestionBoxStyle" BasedOn="{StaticResource BaseQuerySuggestionBoxStyle}" TargetType="{x:Type TextBox}">
16-
<Setter Property="Foreground" Value="#FF000000" />
17-
<Setter Property="Background" Value="#01FFFFFF" />
18-
</Style>
15+
<Style x:Key="QuerySuggestionBoxStyle" BasedOn="{StaticResource BaseQuerySuggestionBoxStyle}" TargetType="{x:Type TextBox}" />
1916

2017
<Style x:Key="WindowBorderStyle" BasedOn="{StaticResource BaseWindowBorderStyle}" TargetType="{x:Type Border}">
2118
<Setter Property="Background">

Flow.Launcher/ViewModel/SettingWindowViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public SettingWindowViewModel(Updater updater, IPortable portable)
4545

4646
public async void UpdateApp()
4747
{
48-
await _updater.UpdateApp(false);
48+
await _updater.UpdateApp(App.API, false);
4949
}
5050

5151
public bool AutoUpdates

Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Collections.Generic;
33
using System.Diagnostics;
44
using System.IO;
@@ -9,7 +9,10 @@
99
using Flow.Launcher.Plugin.Explorer.Search;
1010
using Flow.Launcher.Plugin.Explorer.Search.FolderLinks;
1111
using System.Linq;
12-
using System.Reflection;
12+
using MessageBox = System.Windows.Forms.MessageBox;
13+
using MessageBoxIcon = System.Windows.Forms.MessageBoxIcon;
14+
using MessageBoxButton = System.Windows.Forms.MessageBoxButtons;
15+
using DialogResult = System.Windows.Forms.DialogResult;
1316

1417
namespace Flow.Launcher.Plugin.Explorer
1518
{
@@ -101,10 +104,25 @@ public List<Result> LoadContextMenus(Result selectedResult)
101104
{
102105
try
103106
{
107+
if (MessageBox.Show(
108+
string.Format(Context.API.GetTranslation("plugin_explorer_deletefilefolderconfirm"),fileOrFolder),
109+
string.Empty,
110+
MessageBoxButton.YesNo,
111+
MessageBoxIcon.Warning)
112+
== DialogResult.No)
113+
return false;
114+
104115
if (record.Type == ResultType.File)
105116
File.Delete(record.FullPath);
106117
else
107118
Directory.Delete(record.FullPath, true);
119+
120+
Task.Run(() =>
121+
{
122+
Context.API.ShowMsg(Context.API.GetTranslation("plugin_explorer_deletefilefoldersuccess"),
123+
string.Format(Context.API.GetTranslation("plugin_explorer_deletefilefoldersuccess_detail"), fileOrFolder),
124+
Constants.ExplorerIconImageFullPath);
125+
});
108126
}
109127
catch (Exception e)
110128
{
@@ -212,15 +230,11 @@ private Result CreateAddToIndexSearchExclusionListResult(SearchResult record)
212230
if(!Settings.IndexSearchExcludedSubdirectoryPaths.Any(x => x.Path == record.FullPath))
213231
Settings.IndexSearchExcludedSubdirectoryPaths.Add(new FolderLink { Path = record.FullPath });
214232

215-
var pluginDirectory = Directory.GetParent(Assembly.GetExecutingAssembly().Location.ToString());
216-
217-
var iconPath = pluginDirectory + "\\" + Constants.ExplorerIconImagePath;
218-
219233
Task.Run(() =>
220234
{
221235
Context.API.ShowMsg(Context.API.GetTranslation("plugin_explorer_excludedfromindexsearch_msg"),
222236
Context.API.GetTranslation("plugin_explorer_path") +
223-
" " + record.FullPath, iconPath);
237+
" " + record.FullPath, Constants.ExplorerIconImageFullPath);
224238

225239
// so the new path can be persisted to storage and not wait till next ViewModel save.
226240
Context.API.SaveAppAllSettings();

Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
<!--Dialogues-->
66
<system:String x:Key="plugin_explorer_select_folder_link_warning">Please select a folder link</system:String>
77
<system:String x:Key="plugin_explorer_delete_folder_link">Are you sure you want to delete {0}?</system:String>
8+
<system:String x:Key="plugin_explorer_deletefilefolderconfirm">Are you sure you want to permanently delete this {0}?</system:String>
9+
<system:String x:Key="plugin_explorer_deletefilefoldersuccess">Deletion successful</system:String>
10+
<system:String x:Key="plugin_explorer_deletefilefoldersuccess_detail">Successfully deleted the {0}</system:String>
811

912
<!--Controls-->
1013
<system:String x:Key="plugin_explorer_delete">Delete</system:String>

Plugins/Flow.Launcher.Plugin.Explorer/Search/Constants.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using System;
2-
using System.Collections.Generic;
3-
using System.Text;
2+
using System.IO;
3+
using System.Reflection;
44

55
namespace Flow.Launcher.Plugin.Explorer.Search
66
{
@@ -26,6 +26,9 @@ internal static class Constants
2626

2727
internal const string WindowsIndexingOptions = "srchadmin.dll";
2828

29+
internal static string ExplorerIconImageFullPath
30+
=> Directory.GetParent(Assembly.GetExecutingAssembly().Location.ToString()) + "\\" + ExplorerIconImagePath;
31+
2932
internal const string WindowsIndexFileContentSearchHotkey = "content:";
3033
}
3134
}

Plugins/Flow.Launcher.Plugin.Sys/Main.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,6 @@ private List<Result> Commands()
244244
{
245245
Application.Current.MainWindow.Hide();
246246
context.API.CheckForNewUpdate();
247-
context.API.ShowMsg("Please wait...",
248-
"Checking for new update");
249247
return true;
250248
}
251249
}

0 commit comments

Comments
 (0)