refactor: code style improvements

This commit is contained in:
4gray committed 2024-12-01 16:30:48 +01:00
1 parent 47ff7aa2dc
commit b3682abd37
2 files changed
+10 -8

No files matched your search

+3 -1
View File
@@ -3,6 +3,7 @@ import { MatSnackBar } from '@angular/material/snack-bar';
import { Router } from '@angular/router';
import { Store } from '@ngrx/store';
import { TranslateService } from '@ngx-translate/core';
import { isTauri } from '@tauri-apps/api/core';
import { ask } from '@tauri-apps/plugin-dialog';
import { relaunch } from '@tauri-apps/plugin-process';
import { check } from '@tauri-apps/plugin-updater';
@@ -191,7 +192,8 @@ export class AppComponent {
this.translate.use(settings.language ?? this.DEFAULT_LANG);
if (
settings.epgUrl?.length > 0 &&
settings.epgUrl?.some((u) => u !== '')
settings.epgUrl?.some((u) => u !== '') &&
isTauri()
) {
this.epgService.fetchEpg(settings.epgUrl);
}
+7 -7
View File
@@ -72,9 +72,9 @@ export class SettingsComponent implements OnInit {
languageEnum = Language;
/** Flag that indicates whether the app runs in electron environment */
isTauri = this.electronService.getAppEnvironment() === 'tauri';
isTauri = this.dataService.getAppEnvironment() === 'tauri';
isPwa = this.electronService.getAppEnvironment() === 'pwa';
isPwa = this.dataService.getAppEnvironment() === 'pwa';
osPlayers = [
{
@@ -134,7 +134,7 @@ export class SettingsComponent implements OnInit {
*/
constructor(
private dialogService: DialogService,
public electronService: DataService,
public dataService: DataService,
private epgService: EpgService,
private formBuilder: FormBuilder,
private playlistsService: PlaylistsService,
@@ -229,7 +229,7 @@ export class SettingsComponent implements OnInit {
* @returns returns true if an update is available
*/
isCurrentVersionOutdated(latestVersion: string): boolean {
this.version = this.electronService.getAppVersion();
this.version = this.dataService.getAppVersion();
return semver.lt(this.version, latestVersion);
}
@@ -240,17 +240,17 @@ export class SettingsComponent implements OnInit {
onSubmit(): void {
this.settingsStore.updateSettings(this.settingsForm.value).then(() => {
this.applyChangedSettings();
this.electronService.sendIpcEvent(
this.dataService.sendIpcEvent(
SETTINGS_UPDATE,
this.settingsForm.value
);
this.electronService.sendIpcEvent(
this.dataService.sendIpcEvent(
SET_MPV_PLAYER_PATH,
this.settingsForm.value.mpvPlayerPath
);
this.electronService.sendIpcEvent(
this.dataService.sendIpcEvent(
SET_VLC_PLAYER_PATH,
this.settingsForm.value.mpvPlayerPath
);