mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-11 11:06:16 -08:00
refactor(portals): adapt favorites interface
This commit is contained in:
1 parent
49f3359461
commit
88362d23d8
2 files changed
+24
-10
No files matched your search
@@ -155,7 +155,7 @@ export class PlaylistsService {
|
||||
);
|
||||
}
|
||||
|
||||
removeFromPortalFavorites(portalId: string, favoriteId: number) {
|
||||
removeFromPortalFavorites(portalId: string, favoriteId: number | string) {
|
||||
return this.getPlaylistById(portalId).pipe(
|
||||
switchMap((portal) =>
|
||||
this.dbService.update(DbStores.Playlists, {
|
||||
|
||||
@@ -42,7 +42,9 @@ export class VodDetailsComponent implements OnInit {
|
||||
.getPortalFavorites(this.portalId)
|
||||
.subscribe((favorites) => {
|
||||
this.isFavorite = favorites.some(
|
||||
(i) => i.stream_id === this.item.movie_data.stream_id
|
||||
(i) =>
|
||||
i?.stream_id === this.item?.movie_data?.stream_id ||
|
||||
(i as any)?.details?.id === (this.item as any)?.id
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -50,16 +52,28 @@ export class VodDetailsComponent implements OnInit {
|
||||
toggleFavorite() {
|
||||
if (this.isFavorite) {
|
||||
this.removeFromFavoritesClicked.emit(
|
||||
this.item.movie_data.stream_id
|
||||
this.item?.movie_data?.stream_id || (this.item as any)?.id
|
||||
);
|
||||
} else {
|
||||
this.addToFavoritesClicked.emit({
|
||||
name: this.item.movie_data.name,
|
||||
stream_id: this.item.movie_data.stream_id,
|
||||
container_extension: this.item.movie_data.container_extension,
|
||||
cover: this.item.info.movie_image,
|
||||
stream_type: 'movie',
|
||||
});
|
||||
// stalker mode
|
||||
if ((this.item as any).cmd) {
|
||||
this.addToFavoritesClicked.emit({
|
||||
name: this.item.info.name,
|
||||
stream_id: (this.item as any).id,
|
||||
cover: this.item.info.movie_image,
|
||||
cmd: (this.item as any).cmd || '',
|
||||
details: this.item,
|
||||
});
|
||||
} else {
|
||||
this.addToFavoritesClicked.emit({
|
||||
name: this.item.info.name,
|
||||
stream_id: this.item.movie_data.stream_id,
|
||||
container_extension:
|
||||
this.item.movie_data.container_extension,
|
||||
cover: this.item.info.movie_image,
|
||||
stream_type: 'movie',
|
||||
});
|
||||
}
|
||||
}
|
||||
this.isFavorite = !this.isFavorite;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user