mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-14 13:16:16 -08:00
fix: add type safety to PlaybackPositionService and clarify watched state logic
- Move PlaybackPositionData interface to shared-interfaces lib - Replace all `any` types with proper PlaybackPositionData typing - Add comment clarifying position=duration semantics for watched episodes Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
adb89145a3
commit
0219d3253e
5 files changed
+29
-20
No files matched your search
@@ -1,10 +1,14 @@
|
||||
import { InjectionToken } from '@angular/core';
|
||||
import {
|
||||
PlaybackPositionData,
|
||||
XtreamCategory,
|
||||
XtreamLiveStream,
|
||||
XtreamSerieItem,
|
||||
XtreamVodStream,
|
||||
} from 'shared-interfaces';
|
||||
|
||||
// Re-export for backward compatibility
|
||||
export { PlaybackPositionData };
|
||||
import { XtreamCredentials, CategoryType, StreamType } from '../services/xtream-api.service';
|
||||
|
||||
/**
|
||||
@@ -75,21 +79,6 @@ export interface RecentlyViewedItem extends XtreamContentItem {
|
||||
viewed_at: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Playback position data for resume functionality
|
||||
*/
|
||||
export interface PlaybackPositionData {
|
||||
contentXtreamId: number;
|
||||
contentType: 'vod' | 'episode';
|
||||
seriesXtreamId?: number;
|
||||
seasonNumber?: number;
|
||||
episodeNumber?: number;
|
||||
positionSeconds: number;
|
||||
durationSeconds?: number;
|
||||
playlistId?: string;
|
||||
updatedAt?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Database category type mapping (differs from API type)
|
||||
*/
|
||||
|
||||
@@ -318,6 +318,7 @@ export function withPlaybackPositions() {
|
||||
|
||||
if (duration === 0) duration = 1; // Fallback
|
||||
|
||||
// Setting position = duration indicates episode is fully watched
|
||||
const data: PlaybackPositionData = {
|
||||
contentXtreamId: id,
|
||||
contentType: 'episode',
|
||||
|
||||
Reference in new issue
Block a user