2727using System . Collections . Specialized ;
2828using CommunityToolkit . Mvvm . DependencyInjection ;
2929using Flow . Launcher . Core ;
30+ using Flow . Launcher . Infrastructure . UserSettings ;
3031
3132namespace 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
0 commit comments