Skip to content

Commit 39d7187

Browse files
committed
Use constructor injection for updater
1 parent c072012 commit 39d7187

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

Flow.Launcher.Core/Updater.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,15 @@ namespace Flow.Launcher.Core
2323
{
2424
public class Updater
2525
{
26-
private readonly IPublicAPI API = Ioc.Default.GetRequiredService<IPublicAPI>();
26+
private readonly IPublicAPI API;
2727

2828
public string GitHubRepository { get; set; }
2929

30+
public Updater(IPublicAPI publicAPI)
31+
{
32+
API = publicAPI;
33+
}
34+
3035
public void Initialize(string gitHubRepository)
3136
{
3237
GitHubRepository = gitHubRepository;

Flow.Launcher/App.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public App()
4545
.UseContentRoot(AppContext.BaseDirectory)
4646
.ConfigureServices(services => services
4747
.AddSingleton(_ => _settings)
48-
.AddSingleton<Updater>()
48+
.AddSingleton(sp => new Updater(sp.GetRequiredService<IPublicAPI>()))
4949
.AddSingleton<Portable>()
5050
.AddSingleton<SettingWindowViewModel>()
5151
.AddSingleton<IAlphabet, PinyinAlphabet>()

0 commit comments

Comments
 (0)