potentially made it so saved settings get applied with no reload in most situations

This commit is contained in:
Isaac Grynsztein
2020-03-11 22:04:22 -04:00
parent 4f4a82c3c4
commit bad4b8630b
4 changed files with 39 additions and 11 deletions

View File

@@ -213,6 +213,25 @@ export class MainComponent implements OnInit {
private router: Router, public dialog: MatDialog, private platform: Platform, private route: ActivatedRoute) {
this.audioOnly = false;
this.configLoad();
this.postsService.settings_changed.subscribe(changed => {
if (changed) {
this.loadConfig();
}
});
}
async configLoad() {
await this.loadConfig();
if (this.autoStartDownload) {
this.downloadClicked();
}
setInterval(() => this.getSimulatedOutput(), 1000);
}
async loadConfig() {
// loading config
this.postsService.loadNavItems().subscribe(res => { // loads settings
const result = !this.postsService.debugMode ? res['config_file'] : res;
@@ -266,16 +285,13 @@ export class MainComponent implements OnInit {
if (youtubeUsername && youtubeUsername !== 'null') { this.youtubeUsername = youtubeUsername };
}
if (this.autoStartDownload) {
this.downloadClicked();
}
setInterval(() => this.getSimulatedOutput(), 1000);
return true;
}, error => {
console.log(error);
});
return false;
});
}
// app initialization.