-
-
Notifications
You must be signed in to change notification settings - Fork 448
Introduce Dependency Injection for Better Development Experience #3175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 8 commits
20ffff6
8b91050
88e8437
2716c40
32cac76
1b76a2b
a748141
3cb9d1d
2a423f0
ff110b3
c3f71c2
3bebb69
8d83849
cdc5f0e
ed39937
8b290a6
f9983b5
bb25774
23a1e5b
ed16d34
6a2389f
25684a9
23f6342
8b6dcd0
cdf02d5
c072012
39d7187
39d34b1
e022ad6
a3964f5
d4f9099
e989b5a
8496cfc
ad63b0e
f5f0986
ef68ccb
91490c0
16798a0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,14 +17,17 @@ | |
using Flow.Launcher.Plugin; | ||
using System.Text.Json.Serialization; | ||
using System.Threading; | ||
using CommunityToolkit.Mvvm.DependencyInjection; | ||
|
||
namespace Flow.Launcher.Core | ||
{ | ||
public class Updater | ||
{ | ||
public string GitHubRepository { get; } | ||
private readonly IPublicAPI API = Ioc.Default.GetRequiredService<IPublicAPI>(); | ||
|
||
|
||
public Updater(string gitHubRepository) | ||
public string GitHubRepository { get; set; } | ||
|
||
public void Initialize(string gitHubRepository) | ||
{ | ||
GitHubRepository = gitHubRepository; | ||
} | ||
Jack251970 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
@@ -53,7 +56,7 @@ public async Task UpdateAppAsync(IPublicAPI api, bool silentUpdate = true) | |
if (newReleaseVersion <= currentVersion) | ||
{ | ||
if (!silentUpdate) | ||
MessageBoxEx.Show(api.GetTranslation("update_flowlauncher_already_on_latest")); | ||
API.ShowMsgBox(api.GetTranslation("update_flowlauncher_already_on_latest")); | ||
return; | ||
} | ||
|
||
|
@@ -68,9 +71,9 @@ public async Task UpdateAppAsync(IPublicAPI api, bool silentUpdate = true) | |
if (DataLocation.PortableDataLocationInUse()) | ||
{ | ||
var targetDestination = updateManager.RootAppDirectory + $"\\app-{newReleaseVersion.ToString()}\\{DataLocation.PortableFolderName}"; | ||
FilesFolders.CopyAll(DataLocation.PortableDataPath, targetDestination, MessageBoxEx.Show); | ||
if (!FilesFolders.VerifyBothFolderFilesEqual(DataLocation.PortableDataPath, targetDestination, MessageBoxEx.Show)) | ||
MessageBoxEx.Show(string.Format(api.GetTranslation("update_flowlauncher_fail_moving_portable_user_profile_data"), | ||
FilesFolders.CopyAll(DataLocation.PortableDataPath, targetDestination, (s) => API.ShowMsgBox(s)); | ||
if (!FilesFolders.VerifyBothFolderFilesEqual(DataLocation.PortableDataPath, targetDestination, (s) => API.ShowMsgBox(s))) | ||
API.ShowMsgBox(string.Format(api.GetTranslation("update_flowlauncher_fail_moving_portable_user_profile_data"), | ||
DataLocation.PortableDataPath, | ||
targetDestination)); | ||
} | ||
|
@@ -83,7 +86,7 @@ public async Task UpdateAppAsync(IPublicAPI api, bool silentUpdate = true) | |
|
||
Log.Info($"|Updater.UpdateApp|Update success:{newVersionTips}"); | ||
|
||
if (MessageBoxEx.Show(newVersionTips, api.GetTranslation("update_flowlauncher_new_update"), MessageBoxButton.YesNo) == MessageBoxResult.Yes) | ||
if (API.ShowMsgBox(newVersionTips, api.GetTranslation("update_flowlauncher_new_update"), MessageBoxButton.YesNo) == MessageBoxResult.Yes) | ||
{ | ||
UpdateManager.RestartApp(Constant.ApplicationFileName); | ||
} | ||
|
Uh oh!
There was an error while loading. Please reload this page.