Skip to content

Commit 91490c0

Browse files
committed
Remove usage of _settingsVM._settings and make _settings private
1 parent ef68ccb commit 91490c0

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

Flow.Launcher/PublicAPIInstance.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,21 @@
2727
using System.Collections.Specialized;
2828
using CommunityToolkit.Mvvm.DependencyInjection;
2929
using Flow.Launcher.Core;
30+
using Flow.Launcher.Infrastructure.UserSettings;
3031

3132
namespace Flow.Launcher
3233
{
3334
public class PublicAPIInstance : IPublicAPI
3435
{
36+
private readonly Settings _settings;
3537
private readonly SettingWindowViewModel _settingsVM;
3638
private readonly MainViewModel _mainVM;
3739

3840
#region Constructor
3941

4042
public PublicAPIInstance()
4143
{
44+
_settings = Ioc.Default.GetRequiredService<Settings>();
4245
_settingsVM = Ioc.Default.GetRequiredService<SettingWindowViewModel>();
4346
_mainVM = Ioc.Default.GetRequiredService<MainViewModel>();
4447
GlobalHotkey.hookedKeyboardCallback = KListener_hookedKeyboardCallback;
@@ -247,7 +250,7 @@ public void SavePluginSettings()
247250
public void OpenDirectory(string DirectoryPath, string FileNameOrFilePath = null)
248251
{
249252
using var explorer = new Process();
250-
var explorerInfo = _settingsVM._settings.CustomExplorer;
253+
var explorerInfo = _settings.CustomExplorer;
251254

252255
explorer.StartInfo = new ProcessStartInfo
253256
{
@@ -268,7 +271,7 @@ private void OpenUri(Uri uri, bool? inPrivate = null)
268271
{
269272
if (uri.Scheme == Uri.UriSchemeHttp || uri.Scheme == Uri.UriSchemeHttps)
270273
{
271-
var browserInfo = _settingsVM._settings.CustomBrowser;
274+
var browserInfo = _settings.CustomBrowser;
272275

273276
var path = browserInfo.Path == "*" ? "" : browserInfo.Path;
274277

Flow.Launcher/ViewModel/SettingWindowViewModel.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
using CommunityToolkit.Mvvm.DependencyInjection;
2-
using Flow.Launcher.Infrastructure.UserSettings;
1+
using Flow.Launcher.Infrastructure.UserSettings;
32
using Flow.Launcher.Plugin;
43

54
namespace Flow.Launcher.ViewModel;
65

76
public partial class SettingWindowViewModel : BaseModel
87
{
9-
public readonly Settings _settings;
8+
private readonly Settings _settings;
109

1110
public SettingWindowViewModel(Settings settings)
1211
{

0 commit comments

Comments
 (0)