@@ -43,8 +43,8 @@ import { MatCheckbox } from '@angular/material/checkbox';
4343 MatOption ,
4444 ColoredTextDirective ,
4545 MatCheckbox ,
46- ImageSelectCardComponent
47- ]
46+ ImageSelectCardComponent ,
47+ ] ,
4848} )
4949export class SettingsComponent implements OnInit {
5050 private ref = inject ( OverlayRefControl ) ;
@@ -78,7 +78,11 @@ export class SettingsComponent implements OnInit {
7878
7979 http . getMods ( ) . subscribe ( mods => this . mods = mods ) ;
8080 this . mod = this . sharedService . getSelectedMod ( ) ;
81- this . settings = JSON . parse ( JSON . stringify ( this . settingsService . getSettings ( ) ) ) ;
81+
82+ this . settings = { } as AppSettings ;
83+ for ( const [ key , val ] of Object . entries ( this . settingsService . signalSettings ( ) ) ) {
84+ this . settings [ key as keyof AppSettings ] = val ( ) ;
85+ }
8286 }
8387
8488 ngOnInit ( ) {
@@ -119,7 +123,7 @@ export class SettingsComponent implements OnInit {
119123 this . folderFormControl . setErrors ( null ) ;
120124 } else {
121125 this . folderFormControl . setErrors ( {
122- invalid : true
126+ invalid : true ,
123127 } ) ;
124128 }
125129 }
@@ -129,10 +133,16 @@ export class SettingsComponent implements OnInit {
129133 this . electron . saveAssetsPath ( this . folderFormControl . value ) ;
130134 }
131135 this . sharedService . saveModSelect ( this . mod ) ;
132- this . settingsService . updateSettings ( this . settings ) ;
136+
137+ const settings = this . settingsService . signalSettings ( ) ;
138+ for ( const [ k , val ] of Object . entries ( this . settings ) ) {
139+ const key = k as keyof AppSettings ;
140+ settings [ key ] . set ( val ) ;
141+ }
142+
133143 this . close ( ) ;
134144 const ref = this . snackBar . open ( 'Changing the path requires to restart the editor' , 'Restart' , {
135- duration : 6000
145+ duration : 6000 ,
136146 } ) ;
137147
138148 ref . onAction ( ) . subscribe ( ( ) => this . sharedService . relaunch ( ) ) ;
0 commit comments