-
-
Notifications
You must be signed in to change notification settings - Fork 309
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[iOS & tvOS] Use
AboutView
for Series Poster Routing (#1438)
* Move Series Button to the About Section IF the item is an episode. Otherwise, continue using that image as just an image. tvOS & iOS. * use posterbutton --------- Co-authored-by: Ethan Pippin <ethanpippin2343@gmail.com>
- Loading branch information
Showing
9 changed files
with
113 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
Swiftfin tvOS/Views/ItemView/Components/AboutView/Components/ImageCard.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// | ||
// Swiftfin is subject to the terms of the Mozilla Public | ||
// License, v2.0. If a copy of the MPL was not distributed with this | ||
// file, you can obtain one at https://mozilla.org/MPL/2.0/. | ||
// | ||
// Copyright (c) 2025 Jellyfin & Jellyfin Contributors | ||
// | ||
|
||
import Defaults | ||
import JellyfinAPI | ||
import SwiftUI | ||
|
||
extension ItemView.AboutView { | ||
|
||
struct ImageCard: View { | ||
|
||
// MARK: - Environment & Observed Objects | ||
|
||
@EnvironmentObject | ||
private var router: ItemCoordinator.Router | ||
|
||
@ObservedObject | ||
var viewModel: ItemViewModel | ||
|
||
// MARK: - Body | ||
|
||
var body: some View { | ||
PosterButton(item: viewModel.item, type: .portrait) | ||
.content { EmptyView() } | ||
.imageOverlay { EmptyView() } | ||
.onSelect(onSelect) | ||
.frame(height: 405) | ||
} | ||
|
||
// MARK: - On Select | ||
|
||
// Switch case to allow other funcitonality if we need to expand this beyond episode > series | ||
private func onSelect() { | ||
switch viewModel.item.type { | ||
case .episode: | ||
if let episodeViewModel = viewModel as? EpisodeItemViewModel, | ||
let seriesItem = episodeViewModel.seriesItem | ||
{ | ||
router.route(to: \.item, seriesItem) | ||
} | ||
default: | ||
break | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
Swiftfin/Views/ItemView/Components/AboutView/Components/ImageCard.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// | ||
// Swiftfin is subject to the terms of the Mozilla Public | ||
// License, v2.0. If a copy of the MPL was not distributed with this | ||
// file, you can obtain one at https://mozilla.org/MPL/2.0/. | ||
// | ||
// Copyright (c) 2025 Jellyfin & Jellyfin Contributors | ||
// | ||
|
||
import Defaults | ||
import JellyfinAPI | ||
import SwiftUI | ||
|
||
extension ItemView.AboutView { | ||
|
||
struct ImageCard: View { | ||
|
||
// MARK: - Environment & Observed Objects | ||
|
||
@EnvironmentObject | ||
private var router: ItemCoordinator.Router | ||
|
||
@ObservedObject | ||
var viewModel: ItemViewModel | ||
|
||
// MARK: - Body | ||
|
||
var body: some View { | ||
PosterButton(item: viewModel.item, type: .portrait) | ||
.content { EmptyView() } | ||
.imageOverlay { EmptyView() } | ||
.onSelect(onSelect) | ||
} | ||
|
||
// MARK: - On Select | ||
|
||
// Switch case to allow other funcitonality if we need to expand this beyond episode > series | ||
private func onSelect() { | ||
switch viewModel.item.type { | ||
case .episode: | ||
if let episodeViewModel = viewModel as? EpisodeItemViewModel, | ||
let seriesItem = episodeViewModel.seriesItem | ||
{ | ||
router.route(to: \.item, seriesItem) | ||
} | ||
default: | ||
break | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters