mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-09 17:36:15 -08:00
refactor: extend store with current epg program field
This commit is contained in:
2 files changed
+15
No files matched your search
@@ -105,6 +105,7 @@ export class EpgListComponent {
|
||||
} else {
|
||||
this.items = [];
|
||||
this.channel = null;
|
||||
this.channelStore.setCurrentEpgProgram(undefined);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,6 +156,7 @@ export class EpgListComponent {
|
||||
this.playingNow = this.items.find(
|
||||
(item) => this.timeNow >= item.start && this.timeNow <= item.stop
|
||||
);
|
||||
this.channelStore.setCurrentEpgProgram(this.playingNow);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -9,6 +9,7 @@ import { EpgProgram } from '../player/models/epg-program.model';
|
||||
export interface ChannelState extends EntityState<Channel> {
|
||||
active: Channel;
|
||||
epgAvailable: boolean;
|
||||
currentEpgProgram: EpgProgram;
|
||||
favorites: string[];
|
||||
playlistId: string;
|
||||
}
|
||||
@@ -23,6 +24,7 @@ export class ChannelStore extends EntityStore<ChannelState> {
|
||||
constructor(private electronService: ElectronService) {
|
||||
super({
|
||||
active: undefined,
|
||||
currentEpgProgram: undefined,
|
||||
epgAvailable: false,
|
||||
favorites: [],
|
||||
playlistId: '',
|
||||
@@ -123,4 +125,15 @@ export class ChannelStore extends EntityStore<ChannelState> {
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the active epg program for the active channel
|
||||
* @param currentEpgProgram program to set
|
||||
*/
|
||||
setCurrentEpgProgram(currentEpgProgram: EpgProgram): void {
|
||||
this.update((store) => ({
|
||||
...store,
|
||||
currentEpgProgram,
|
||||
}));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user