From 5dd4dd2abaf345293356cb3001dbac7bb345bd1f Mon Sep 17 00:00:00 2001 From: 4gray Date: Tue, 24 Dec 2024 23:19:24 +0100 Subject: [PATCH] refactor(xtream): update favorite status checks and toggleFavorite method to include IDs --- .../serial-details/serial-details.component.ts | 12 +++++++++--- .../vod-details/vod-details.component.ts | 13 +++++++++---- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/app/xtream-tauri/serial-details/serial-details.component.ts b/src/app/xtream-tauri/serial-details/serial-details.component.ts index c8a72b01b..fe2f46420 100644 --- a/src/app/xtream-tauri/serial-details/serial-details.component.ts +++ b/src/app/xtream-tauri/serial-details/serial-details.component.ts @@ -41,8 +41,11 @@ export class SerialDetailsComponent { ...currentSerial, series_id: serialId, }); - // Move checkFavoriteStatus after setting the selected item - this.xtreamStore.checkFavoriteStatus(); + + this.xtreamStore.checkFavoriteStatus( + serialId, + this.xtreamStore.currentPlaylist().id + ); }); } @@ -73,6 +76,9 @@ export class SerialDetailsComponent { } toggleFavorite() { - this.xtreamStore.toggleFavorite(); + this.xtreamStore.toggleFavorite( + this.route.snapshot.params.serialId, + this.xtreamStore.currentPlaylist().id + ); } } diff --git a/src/app/xtream-tauri/vod-details/vod-details.component.ts b/src/app/xtream-tauri/vod-details/vod-details.component.ts index 4af754d33..c4a81621f 100644 --- a/src/app/xtream-tauri/vod-details/vod-details.component.ts +++ b/src/app/xtream-tauri/vod-details/vod-details.component.ts @@ -44,12 +44,14 @@ export class VodDetailsComponent implements OnInit, OnDestroy { this.xtreamStore.getVodDetails(vodId).then((currentVod) => { this.xtreamStore.setSelectedCategory(Number(categoryId)); this.xtreamStore.setSelectedItem({ - ...currentVod.movie_data, - info: currentVod.info, + ...currentVod, stream_id: vodId, }); // Check favorite status after setting selected item - this.xtreamStore.checkFavoriteStatus(); + this.xtreamStore.checkFavoriteStatus( + vodId, + this.xtreamStore.currentPlaylist().id + ); }); } @@ -81,7 +83,10 @@ export class VodDetailsComponent implements OnInit, OnDestroy { } toggleFavorite() { - this.xtreamStore.toggleFavorite(); + this.xtreamStore.toggleFavorite( + this.route.snapshot.params.vodId, + this.xtreamStore.currentPlaylist().id + ); } private addToRecentlyViewed() {