fix(jellyfin): honor continue watching action

close #1334
This commit is contained in:
edde746
2026-06-14 07:25:40 +02:00
parent e1c0df3bd7
commit 849e62df7e
9 changed files with 142 additions and 15 deletions
+4 -1
View File
@@ -23,6 +23,7 @@ class FocusableMediaCard extends StatefulWidget {
final bool forceGridMode;
final bool forceListMode;
final bool isInContinueWatching;
final bool usesContinueWatchingAction;
final String? collectionId;
/// True for downloaded content without server access
@@ -80,6 +81,7 @@ class FocusableMediaCard extends StatefulWidget {
this.forceGridMode = false,
this.forceListMode = false,
this.isInContinueWatching = false,
bool? usesContinueWatchingAction,
this.collectionId,
this.isOffline = false,
this.mixedHubContext = false,
@@ -93,7 +95,7 @@ class FocusableMediaCard extends StatefulWidget {
this.onNavigateRight,
this.onBack,
this.onFocusChange,
});
}) : usesContinueWatchingAction = usesContinueWatchingAction ?? isInContinueWatching;
@override
State<FocusableMediaCard> createState() => _FocusableMediaCardState();
@@ -134,6 +136,7 @@ class _FocusableMediaCardState extends State<FocusableMediaCard> {
forceGridMode: widget.forceGridMode,
forceListMode: widget.forceListMode,
isInContinueWatching: widget.isInContinueWatching,
usesContinueWatchingAction: widget.usesContinueWatchingAction,
collectionId: widget.collectionId,
isOffline: widget.isOffline,
mixedHubContext: widget.mixedHubContext,
+11 -2
View File
@@ -40,6 +40,7 @@ class HubSection extends StatefulWidget {
final void Function(String)? onRefresh;
final VoidCallback? onRemoveFromContinueWatching;
final bool isInContinueWatching;
final bool usesContinueWatchingAction;
final bool showServerName;
final Future<List<MediaItem>> Function()? loadMoreItems;
@@ -75,6 +76,7 @@ class HubSection extends StatefulWidget {
this.onRefresh,
this.onRemoveFromContinueWatching,
this.isInContinueWatching = false,
bool? usesContinueWatchingAction,
this.showServerName = false,
this.loadMoreItems,
this.onFocusedItemChanged,
@@ -84,7 +86,7 @@ class HubSection extends StatefulWidget {
this.onNavigateToSidebar,
this.inset = false,
this.focusScrollAlignment = 0.3,
});
}) : usesContinueWatchingAction = usesContinueWatchingAction ?? isInContinueWatching;
@override
State<HubSection> createState() => HubSectionState();
@@ -359,7 +361,12 @@ class HubSectionState extends State<HubSection> with MountedSetStateMixin {
}
Future<void> _navigateToItem(MediaItem item) async {
await navigateToMediaItem(context, item, onRefresh: widget.onRefresh, playDirectly: widget.isInContinueWatching);
await navigateToMediaItem(
context,
item,
onRefresh: widget.onRefresh,
playDirectly: widget.usesContinueWatchingAction,
);
}
void _navigateToHubDetail(BuildContext context) {
@@ -370,6 +377,7 @@ class HubSectionState extends State<HubSection> with MountedSetStateMixin {
hub: widget.hub,
loadItems: widget.loadMoreItems,
isInContinueWatching: widget.isInContinueWatching,
usesContinueWatchingAction: widget.usesContinueWatchingAction,
onRemoveFromContinueWatching: widget.onRemoveFromContinueWatching,
),
),
@@ -568,6 +576,7 @@ class HubSectionState extends State<HubSection> with MountedSetStateMixin {
onRemoveFromContinueWatching: widget.onRemoveFromContinueWatching,
forceGridMode: true,
isInContinueWatching: widget.isInContinueWatching,
usesContinueWatchingAction: widget.usesContinueWatchingAction,
mixedHubContext: isMixedHub,
),
),
+4 -3
View File
@@ -56,6 +56,7 @@ class MediaCard extends StatefulWidget {
final bool forceGridMode;
final bool forceListMode;
final bool isInContinueWatching;
final bool usesContinueWatchingAction;
final String? collectionId; // The collection ID if displaying within a collection
final bool isOffline; // True for downloaded content without server access
final bool mixedHubContext; // True when in a hub with mixed content (movies + episodes)
@@ -74,13 +75,14 @@ class MediaCard extends StatefulWidget {
this.forceGridMode = false,
this.forceListMode = false,
this.isInContinueWatching = false,
bool? usesContinueWatchingAction,
this.collectionId,
this.isOffline = false,
this.mixedHubContext = false,
this.showServerName = false,
this.episodePosterModeOverride,
this.fullBleedImage = false,
});
}) : usesContinueWatchingAction = usesContinueWatchingAction ?? isInContinueWatching;
@override
State<MediaCard> createState() => MediaCardState();
@@ -162,7 +164,7 @@ class MediaCardState extends State<MediaCard> with ContextMenuTapMixin<MediaCard
item,
onRefresh: widget.onRefresh,
isOffline: widget.isOffline,
playDirectly: widget.isInContinueWatching,
playDirectly: widget.usesContinueWatchingAction,
);
if (!context.mounted) return;
@@ -900,7 +902,6 @@ class _MediaCardHelpers {
return const SizedBox.shrink();
}
}
/// Whether this media item has a clickable title that navigates somewhere.
+13 -3
View File
@@ -302,6 +302,7 @@ class TvBrowseRail extends StatefulWidget {
final void Function(String)? onRefresh;
final VoidCallback? onRemoveFromContinueWatching;
final bool Function(MediaHub hub)? isContinueWatchingHub;
final bool Function(MediaHub hub)? usesContinueWatchingAction;
final Future<List<MediaItem>> Function(MediaHub hub)? loadMoreItems;
/// Optional per-hub trailing-slot state (loading/error/viewAll). When null the
@@ -344,6 +345,7 @@ class TvBrowseRail extends StatefulWidget {
this.onRefresh,
this.onRemoveFromContinueWatching,
this.isContinueWatchingHub,
this.usesContinueWatchingAction,
this.loadMoreItems,
this.trailingForHub,
this.onRetryHub,
@@ -915,6 +917,12 @@ class TvBrowseRailState extends State<TvBrowseRail> {
return _mediaCardKeys.putIfAbsent('${hub.id}:$itemIndex', () => GlobalKey<MediaCardState>());
}
bool _isContinueWatchingHub(MediaHub hub) => widget.isContinueWatchingHub?.call(hub) ?? false;
bool _usesContinueWatchingAction(MediaHub hub) {
return widget.usesContinueWatchingAction?.call(hub) ?? _isContinueWatchingHub(hub);
}
void _showContextMenuForCurrentItem() {
final hub = _activeHub;
if (hub == null || _itemIndex >= hub.items.length) return;
@@ -947,7 +955,7 @@ class TvBrowseRailState extends State<TvBrowseRail> {
context,
item,
onRefresh: widget.onRefresh,
playDirectly: widget.isContinueWatchingHub?.call(hub) ?? false,
playDirectly: _usesContinueWatchingAction(hub),
);
}
@@ -958,7 +966,8 @@ class TvBrowseRailState extends State<TvBrowseRail> {
builder: (context) => HubDetailScreen(
hub: hub,
loadItems: widget.loadMoreItems == null ? null : () => widget.loadMoreItems!(hub),
isInContinueWatching: widget.isContinueWatchingHub?.call(hub) ?? false,
isInContinueWatching: _isContinueWatchingHub(hub),
usesContinueWatchingAction: _usesContinueWatchingAction(hub),
onRemoveFromContinueWatching: widget.onRemoveFromContinueWatching,
),
),
@@ -1316,7 +1325,8 @@ class TvBrowseRailState extends State<TvBrowseRail> {
onRemoveFromContinueWatching: widget.onRemoveFromContinueWatching,
forceGridMode: true,
fullBleedImage: fullCardLayout,
isInContinueWatching: widget.isContinueWatchingHub?.call(hub) ?? false,
isInContinueWatching: _isContinueWatchingHub(hub),
usesContinueWatchingAction: _usesContinueWatchingAction(hub),
mixedHubContext: metrics.isMixedHub,
episodePosterModeOverride: episodePosterMode,
),