refactor: minor code improvements

This commit is contained in:
4gray committed 2022-01-03 12:20:18 +01:00
1 parent 5aff1070b1
commit 1aefcf3477
3 files changed
+4 -3

No files matched your search

@@ -94,7 +94,7 @@ export class EpgListComponent {
* @param programs
*/
handleEpgData(programs: { payload: EpgData }): void {
if (programs.payload?.items?.length > 0) {
if (programs?.payload?.items?.length > 0) {
this.programs = programs;
this.timeNow = moment(Date.now()).format(DATE_TIME_FORMAT);
this.dateToday = moment(Date.now()).format(DATE_FORMAT);
@@ -49,7 +49,7 @@ export class HtmlVideoPlayerComponent implements OnChanges, OnDestroy {
playChannel(channel: Channel): void {
if (this.hls) this.hls.destroy();
const url = channel.url + channel.epgParams;
if (Hls.isSupported()) {
if (Hls && Hls.isSupported()) {
console.log('... switching channel to ', channel.name, url);
this.hls = new Hls();
this.hls.attachMedia(this.videoPlayer.nativeElement);
+2 -1
View File
@@ -3,6 +3,7 @@ import { EntityState, EntityStore, StoreConfig } from '@datorama/akita';
import {
CHANNEL_SET_USER_AGENT,
EPG_GET_PROGRAM,
PLAYLIST_UPDATE_FAVORITES,
} from '../../../shared/ipc-commands';
import { Channel } from './channel.model';
import * as moment from 'moment';
@@ -48,7 +49,7 @@ export class ChannelStore extends EntityStore<ChannelState> {
} else {
favorites = [...store.favorites, channel.id];
}
this.electronService.sendIpcEvent('update-favorites', {
this.electronService.sendIpcEvent(PLAYLIST_UPDATE_FAVORITES, {
id: store.playlistId,
favorites,
});