Merge pull request #247 from jellyfin/create-pull-request/patch

[ci] SwiftLint
This commit is contained in:
aiden 3 2021-12-09 19:07:03 -05:00 committed by GitHub
commit 07b2c2e063
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 17 deletions

View File

@ -15,25 +15,25 @@ struct ItemLandscapeMainView: View {
@Binding private var videoIsLoading: Bool @Binding private var videoIsLoading: Bool
@EnvironmentObject private var viewModel: ItemViewModel @EnvironmentObject private var viewModel: ItemViewModel
@EnvironmentObject private var videoPlayerItem: VideoPlayerItem @EnvironmentObject private var videoPlayerItem: VideoPlayerItem
init(videoIsLoading: Binding<Bool>) { init(videoIsLoading: Binding<Bool>) {
self._videoIsLoading = videoIsLoading self._videoIsLoading = videoIsLoading
} }
// MARK: innerBody // MARK: innerBody
private var innerBody: some View { private var innerBody: some View {
HStack { HStack {
// MARK: Sidebar Image // MARK: Sidebar Image
VStack { VStack {
ImageView(src: viewModel.item.getPrimaryImage(maxWidth: 130), ImageView(src: viewModel.item.getPrimaryImage(maxWidth: 130),
bh: viewModel.item.getPrimaryImageBlurHash()) bh: viewModel.item.getPrimaryImageBlurHash())
.frame(width: 130, height: 195) .frame(width: 130, height: 195)
.cornerRadius(10) .cornerRadius(10)
Spacer().frame(height: 15) Spacer().frame(height: 15)
Button { Button {
if let playButtonItem = viewModel.playButtonItem { if let playButtonItem = viewModel.playButtonItem {
self.videoPlayerItem.itemToPlay = playButtonItem self.videoPlayerItem.itemToPlay = playButtonItem
@ -41,7 +41,7 @@ struct ItemLandscapeMainView: View {
} }
} label: { } label: {
// MARK: Play // MARK: Play
HStack { HStack {
Image(systemName: "play.fill") Image(systemName: "play.fill")
.foregroundColor(viewModel.playButtonItem == nil ? Color(UIColor.secondaryLabel) : Color.white) .foregroundColor(viewModel.playButtonItem == nil ? Color(UIColor.secondaryLabel) : Color.white)
@ -55,19 +55,19 @@ struct ItemLandscapeMainView: View {
.background(viewModel.playButtonItem == nil ? Color(UIColor.secondarySystemFill) : Color.jellyfinPurple) .background(viewModel.playButtonItem == nil ? Color(UIColor.secondarySystemFill) : Color.jellyfinPurple)
.cornerRadius(10) .cornerRadius(10)
}.disabled(viewModel.playButtonItem == nil) }.disabled(viewModel.playButtonItem == nil)
Spacer() Spacer()
} }
ScrollView { ScrollView {
VStack(alignment: .leading) { VStack(alignment: .leading) {
// MARK: ItemLandscapeTopBarView // MARK: ItemLandscapeTopBarView
ItemLandscapeTopBarView() ItemLandscapeTopBarView()
.environmentObject(viewModel) .environmentObject(viewModel)
// MARK: ItemViewBody // MARK: ItemViewBody
if let episodeViewModel = viewModel as? SeasonItemViewModel { if let episodeViewModel = viewModel as? SeasonItemViewModel {
EpisodeCardVStackView(items: episodeViewModel.episodes) { episode in EpisodeCardVStackView(items: episodeViewModel.episodes) { episode in
itemRouter.route(to: \.item, episode) itemRouter.route(to: \.item, episode)
@ -80,9 +80,9 @@ struct ItemLandscapeMainView: View {
} }
} }
} }
// MARK: body // MARK: body
var body: some View { var body: some View {
VStack { VStack {
ZStack { ZStack {

View File

@ -10,11 +10,11 @@ import JellyfinAPI
import UIKit import UIKit
extension BaseItemPerson { extension BaseItemPerson {
// MARK: Get Image // MARK: Get Image
func getImage(baseURL: String, maxWidth: Int) -> URL { func getImage(baseURL: String, maxWidth: Int) -> URL {
let x = UIScreen.main.nativeScale * CGFloat(maxWidth) let x = UIScreen.main.nativeScale * CGFloat(maxWidth)
let urlString = ImageAPI.getItemImageWithRequestBuilder(itemId: id ?? "", let urlString = ImageAPI.getItemImageWithRequestBuilder(itemId: id ?? "",
imageType: .primary, imageType: .primary,
maxWidth: Int(x), maxWidth: Int(x),
@ -22,7 +22,7 @@ extension BaseItemPerson {
tag: primaryImageTag).URLString tag: primaryImageTag).URLString
return URL(string: urlString)! return URL(string: urlString)!
} }
func getBlurHash() -> String { func getBlurHash() -> String {
let imgURL = getImage(baseURL: "", maxWidth: 1) let imgURL = getImage(baseURL: "", maxWidth: 1)
guard let imgTag = imgURL.queryParameters?["tag"], guard let imgTag = imgURL.queryParameters?["tag"],