mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Initialize App.API earlier & Improve code quality
This commit is contained in:
parent
cdc5f0e122
commit
ed39937197
2 changed files with 4 additions and 14 deletions
|
|
@ -70,6 +70,8 @@ namespace Flow.Launcher
|
|||
).Build();
|
||||
Ioc.Default.ConfigureServices(host.Services);
|
||||
|
||||
API = Ioc.Default.GetRequiredService<IPublicAPI>();
|
||||
|
||||
Ioc.Default.GetRequiredService<Updater>().Initialize(Launcher.Properties.Settings.Default.GithubRepo);
|
||||
|
||||
Ioc.Default.GetRequiredService<Portable>().PreStartCleanUpAfterPortabilityUpdate();
|
||||
|
|
@ -93,9 +95,6 @@ namespace Flow.Launcher
|
|||
|
||||
PluginManager.LoadPlugins(_settings.PluginSettings);
|
||||
|
||||
API = Ioc.Default.GetRequiredService<IPublicAPI>();
|
||||
((PublicAPIInstance)API).Initialize();
|
||||
|
||||
Http.API = API;
|
||||
Http.Proxy = _settings.Proxy;
|
||||
|
||||
|
|
|
|||
|
|
@ -35,9 +35,7 @@ namespace Flow.Launcher
|
|||
private readonly SettingWindowViewModel _settingsVM;
|
||||
private readonly MainViewModel _mainVM;
|
||||
|
||||
private Updater _updater;
|
||||
|
||||
#region Constructor & Initialization
|
||||
#region Constructor
|
||||
|
||||
public PublicAPIInstance()
|
||||
{
|
||||
|
|
@ -47,13 +45,6 @@ namespace Flow.Launcher
|
|||
WebRequest.RegisterPrefix("data", new DataWebRequestFactory());
|
||||
}
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
// We need to initialize Updater not in the constructor because we want to avoid
|
||||
// recrusive dependency injection
|
||||
_updater = Ioc.Default.GetRequiredService<Updater>();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public API
|
||||
|
|
@ -86,7 +77,7 @@ namespace Flow.Launcher
|
|||
|
||||
public event VisibilityChangedEventHandler VisibilityChanged { add => _mainVM.VisibilityChanged += value; remove => _mainVM.VisibilityChanged -= value; }
|
||||
|
||||
public void CheckForNewUpdate() => _ = _updater.UpdateAppAsync(false);
|
||||
public void CheckForNewUpdate() => _ = Ioc.Default.GetRequiredService<Updater>().UpdateAppAsync(false);
|
||||
|
||||
public void SaveAppAllSettings()
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue