mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-13 20:56:19 -08:00
refactor: auto-update mechanism
This commit is contained in:
1 parent
02192a73be
commit
e0c6eb6790
9 files changed
+207
-89
No files matched your search
@@ -4,9 +4,11 @@ import { Router } from '@angular/router';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { ModalWindow } from 'ngx-whats-new/lib/modal-window.interface';
|
||||
import { firstValueFrom } from 'rxjs';
|
||||
import * as semver from 'semver';
|
||||
import { IpcCommand } from '../../shared/ipc-command.class';
|
||||
import {
|
||||
AUTO_UPDATE_PLAYLISTS,
|
||||
EPG_ERROR,
|
||||
EPG_FETCH_DONE,
|
||||
ERROR,
|
||||
@@ -17,6 +19,7 @@ import {
|
||||
} from '../../shared/ipc-commands';
|
||||
import { DataService } from './services/data.service';
|
||||
import { EpgService } from './services/epg.service';
|
||||
import { PlaylistsService } from './services/playlists.service';
|
||||
import { SettingsService } from './services/settings.service';
|
||||
import { WhatsNewService } from './services/whats-new.service';
|
||||
import { Language } from './settings/language.enum';
|
||||
@@ -58,13 +61,11 @@ export class AppComponent {
|
||||
|
||||
listeners = [];
|
||||
|
||||
/**
|
||||
* Creates an instance of AppComponent
|
||||
*/
|
||||
constructor(
|
||||
private electronService: DataService,
|
||||
private epgService: EpgService,
|
||||
private ngZone: NgZone,
|
||||
private playlistService: PlaylistsService,
|
||||
private router: Router,
|
||||
private store: Store,
|
||||
private snackBar: MatSnackBar,
|
||||
@@ -93,16 +94,28 @@ export class AppComponent {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts all the functions to initialize the component
|
||||
*/
|
||||
ngOnInit(): void {
|
||||
ngOnInit() {
|
||||
this.store.dispatch(PlaylistActions.loadPlaylists());
|
||||
this.translate.setDefaultLang(this.DEFAULT_LANG);
|
||||
|
||||
this.setRendererListeners();
|
||||
this.initSettings();
|
||||
this.handleWhatsNewDialog();
|
||||
|
||||
this.triggerAutoUpdateMechanism();
|
||||
}
|
||||
|
||||
async triggerAutoUpdateMechanism() {
|
||||
if (this.electronService.isElectron) {
|
||||
const playlistForAutoUpdate = await firstValueFrom(
|
||||
this.playlistService.getPlaylistsForAutoUpdate()
|
||||
);
|
||||
if (playlistForAutoUpdate && playlistForAutoUpdate.length > 0)
|
||||
this.electronService.sendIpcEvent(
|
||||
AUTO_UPDATE_PLAYLISTS,
|
||||
playlistForAutoUpdate
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user