-
-
Notifications
You must be signed in to change notification settings - Fork 306
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'jellyfin:main' into iOSSettingsUpdate
- Loading branch information
Showing
54 changed files
with
2,943 additions
and
365 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// | ||
// 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 JellyfinAPI | ||
import Stinsen | ||
import SwiftUI | ||
|
||
final class ItemImagePickerCoordinator: NavigationCoordinatable { | ||
|
||
// MARK: - Navigation Stack | ||
|
||
let stack = Stinsen.NavigationStack(initial: \ItemImagePickerCoordinator.start) | ||
|
||
@Root | ||
var start = makeStart | ||
|
||
// MARK: - Routes | ||
|
||
@Route(.push) | ||
var cropImage = makeCropImage | ||
|
||
// MARK: - Observed Object | ||
|
||
private let viewModel: ItemImagesViewModel | ||
|
||
// MARK: - Image Variable | ||
|
||
let type: ImageType | ||
|
||
// MARK: - Initializer | ||
|
||
init(viewModel: ItemImagesViewModel, type: ImageType) { | ||
self.viewModel = viewModel | ||
self.type = type | ||
} | ||
|
||
// MARK: - Crop Image View | ||
|
||
func makeCropImage(image: UIImage) -> some View { | ||
ItemPhotoCropView(viewModel: viewModel, image: image, type: type) | ||
} | ||
|
||
@ViewBuilder | ||
func makeStart() -> some View { | ||
ItemImagePicker() | ||
} | ||
} |
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,60 @@ | ||
// | ||
// 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 Factory | ||
import JellyfinAPI | ||
import Stinsen | ||
import SwiftUI | ||
|
||
final class ItemImagesCoordinator: ObservableObject, NavigationCoordinatable { | ||
|
||
// MARK: - Navigation Stack | ||
|
||
let stack = NavigationStack(initial: \ItemImagesCoordinator.start) | ||
|
||
@Root | ||
var start = makeStart | ||
|
||
private let viewModel: ItemImagesViewModel | ||
|
||
// MARK: - Route to Add Remote Image | ||
|
||
@Route(.push) | ||
var addImage = makeAddImage | ||
|
||
// MARK: - Route to Photo Picker | ||
|
||
@Route(.modal) | ||
var photoPicker = makePhotoPicker | ||
|
||
// MARK: - Initializer | ||
|
||
init(viewModel: ItemImagesViewModel) { | ||
self.viewModel = viewModel | ||
} | ||
|
||
// MARK: - Add Remote Images View | ||
|
||
@ViewBuilder | ||
func makeAddImage(imageType: ImageType) -> some View { | ||
AddItemImageView(viewModel: viewModel, imageType: imageType) | ||
} | ||
|
||
// MARK: - Photo Picker View | ||
|
||
func makePhotoPicker(type: ImageType) -> NavigationViewCoordinator<ItemImagePickerCoordinator> { | ||
NavigationViewCoordinator(ItemImagePickerCoordinator(viewModel: self.viewModel, type: type)) | ||
} | ||
|
||
// MARK: - Start | ||
|
||
@ViewBuilder | ||
func makeStart() -> some View { | ||
ItemImagesView(viewModel: self.viewModel) | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// | ||
// 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 Foundation | ||
import JellyfinAPI | ||
|
||
extension ImageInfo: @retroactive Identifiable { | ||
|
||
public var id: Int { | ||
hashValue | ||
} | ||
} | ||
|
||
extension ImageInfo { | ||
|
||
func itemImageSource(itemID: String, client: JellyfinClient) -> ImageSource { | ||
let parameters = Paths.GetItemImageParameters( | ||
tag: imageTag, | ||
imageIndex: imageIndex | ||
) | ||
let request = Paths.getItemImage( | ||
itemID: itemID, | ||
imageType: imageType?.rawValue ?? "", | ||
parameters: parameters | ||
) | ||
|
||
let itemImageURL = client.fullURL(with: request) | ||
|
||
return ImageSource(url: itemImageURL) | ||
} | ||
} |
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,44 @@ | ||
// | ||
// 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 Foundation | ||
import JellyfinAPI | ||
|
||
extension ImageType: Displayable { | ||
|
||
var displayTitle: String { | ||
switch self { | ||
case .primary: | ||
return L10n.primary | ||
case .art: | ||
return L10n.art | ||
case .backdrop: | ||
return L10n.backdrop | ||
case .banner: | ||
return L10n.banner | ||
case .logo: | ||
return L10n.logo | ||
case .thumb: | ||
return L10n.thumb | ||
case .disc: | ||
return L10n.disc | ||
case .box: | ||
return L10n.box | ||
case .screenshot: | ||
return L10n.screenshot | ||
case .menu: | ||
return L10n.menu | ||
case .chapter: | ||
return L10n.chapter | ||
case .boxRear: | ||
return L10n.boxRear | ||
case .profile: | ||
return L10n.profile | ||
} | ||
} | ||
} |
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,34 @@ | ||
// | ||
// 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 Foundation | ||
import JellyfinAPI | ||
import SwiftUI | ||
|
||
extension RemoteImageInfo: @retroactive Identifiable, Poster { | ||
|
||
var displayTitle: String { | ||
providerName ?? L10n.unknown | ||
} | ||
|
||
var unwrappedIDHashOrZero: Int { | ||
id | ||
} | ||
|
||
var subtitle: String? { | ||
language | ||
} | ||
|
||
var systemImage: String { | ||
"photo" | ||
} | ||
|
||
public var id: Int { | ||
hashValue | ||
} | ||
} |
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
Oops, something went wrong.