From 0a9ef628d31b07de8cf138b16efd83ac3b8b12d4 Mon Sep 17 00:00:00 2001 From: Alexandre Madeira Date: Fri, 12 Apr 2024 17:32:13 -0300 Subject: [PATCH] SeasonDetailsView now works on Mac --- .../{ => Components}/RoundedCloseButton.swift | 0 Shared/View/Review/ReviewView.swift | 14 +++++++-- Shared/View/Season/SeasonDetailView.swift | 8 +++++ Shared/View/Season/SeasonListView.swift | 6 +++- Shared/View/TMDB/AttributionView.swift | 29 ++++++++++--------- Story.xcodeproj/project.pbxproj | 2 +- 6 files changed, 41 insertions(+), 18 deletions(-) rename Shared/View/{ => Components}/RoundedCloseButton.swift (100%) diff --git a/Shared/View/RoundedCloseButton.swift b/Shared/View/Components/RoundedCloseButton.swift similarity index 100% rename from Shared/View/RoundedCloseButton.swift rename to Shared/View/Components/RoundedCloseButton.swift diff --git a/Shared/View/Review/ReviewView.swift b/Shared/View/Review/ReviewView.swift index 4670c6f3..a1bb855d 100644 --- a/Shared/View/Review/ReviewView.swift +++ b/Shared/View/Review/ReviewView.swift @@ -28,7 +28,7 @@ struct ReviewView: View { } } else { if let item { - Section { + Section { VStack { HStack(alignment: .center) { LazyImage(url: item.itemPosterImageMedium) { state in @@ -75,7 +75,7 @@ struct ReviewView: View { Section("Notes") { TextEditor(text: $note) .frame(minHeight: 150, maxHeight: 800) - + } #endif } else { @@ -83,13 +83,15 @@ struct ReviewView: View { } } } -#if os(iOS) +#if !os(tvOS) + .scrollContentBackground(settings.disableTranslucent ? .visible : .hidden) .background { if let item { TranslucentBackground(image: item.itemPosterImageMedium, useLighterMaterial: true) } } .scrollContentBackground(settings.disableTranslucent ? .visible : .hidden) +#elseif !os(tvOS) && !os(macOS) .navigationBarTitleDisplayMode(.inline) #endif .navigationTitle("Review") @@ -148,14 +150,20 @@ struct ReviewView: View { @ViewBuilder private var doneButton: some View { +#if os(macOS) + Button("Done", action: dismiss) +#else RoundedCloseButton(action: dismiss) +#endif } private var saveButton: some View { Button("Save") { save() } .disabled(!canSave) + #if !os(macOS) .buttonBorderShape(.capsule) .buttonStyle(.borderedProminent) + #endif } private func save(dismiss: Bool = true) { diff --git a/Shared/View/Season/SeasonDetailView.swift b/Shared/View/Season/SeasonDetailView.swift index 24ab8173..93f4ac79 100644 --- a/Shared/View/Season/SeasonDetailView.swift +++ b/Shared/View/Season/SeasonDetailView.swift @@ -73,6 +73,9 @@ struct SeasonDetailView: View { Text(overview) .font(.callout) .padding(.vertical) +#if os(macOS) + .padding(.horizontal) +#endif } } } @@ -82,6 +85,8 @@ struct SeasonDetailView: View { } #if !os(tvOS) && !os(macOS) .navigationBarTitleDisplayMode(.inline) +#endif +#if !os(tvOS) .scrollContentBackground(settings.disableTranslucent ? .visible : .hidden) .background { TranslucentBackground(image: item.seasonPosterUrl, useLighterMaterial: true) @@ -128,5 +133,8 @@ struct SeasonDetailView: View { .presentationDetents([.medium, .large]) .presentationDragIndicator(.visible) .presentationCornerRadius(32) +#if os(macOS) + .frame(width: 600, height: 400) +#endif } } diff --git a/Shared/View/Season/SeasonListView.swift b/Shared/View/Season/SeasonListView.swift index 25edffa9..47eb2776 100644 --- a/Shared/View/Season/SeasonListView.swift +++ b/Shared/View/Season/SeasonListView.swift @@ -212,7 +212,7 @@ struct SeasonListView: View { #endif #endif Spacer() -#if os(iOS) || os(tvOS) +#if !os(watchOS) Menu { Button("Show Season Details") { selectedSeasonDetails = season @@ -228,6 +228,10 @@ struct SeasonListView: View { Label("More", systemImage: "ellipsis.circle") .labelStyle(.iconOnly) } +#if os(macOS) + .menuStyle(.borderlessButton) + .frame(width: 40) +#endif #if os(tvOS) .padding(.horizontal, 60) #else diff --git a/Shared/View/TMDB/AttributionView.swift b/Shared/View/TMDB/AttributionView.swift index 2f184b1c..0e8c1e45 100644 --- a/Shared/View/TMDB/AttributionView.swift +++ b/Shared/View/TMDB/AttributionView.swift @@ -9,20 +9,23 @@ import SwiftUI struct AttributionView: View { var body: some View { - VStack(alignment: .center) { - Image("PrimaryCompact") - .resizable() - .scaledToFit() - .frame(width: DrawingConstants.imageWidth, - height: DrawingConstants.imageHeight, - alignment: .center) - .accessibility(hidden: true) - Text("This product uses the TMDb API but is not endorsed or certified by TMDb.") - .frame(alignment: .center) - .font(.caption) - .foregroundColor(.secondary) - .padding([.horizontal, .bottom]) + HStack(alignment: .center) { + VStack(alignment: .center) { + Image("PrimaryCompact") + .resizable() + .scaledToFit() + .frame(width: DrawingConstants.imageWidth, + height: DrawingConstants.imageHeight, + alignment: .center) + .accessibility(hidden: true) + Text("This product uses the TMDb API but is not endorsed or certified by TMDb.") + .frame(alignment: .center) + .font(.caption) + .foregroundColor(.secondary) + .padding([.horizontal, .bottom]) + } } + .frame(maxWidth: .infinity) .accessibilityElement(children: .combine) .unredacted() } diff --git a/Story.xcodeproj/project.pbxproj b/Story.xcodeproj/project.pbxproj index d53b5d0f..61025a61 100644 --- a/Story.xcodeproj/project.pbxproj +++ b/Story.xcodeproj/project.pbxproj @@ -824,7 +824,6 @@ B81941D22A0867E50057DA04 /* Up Next */, B8FB2A7A29522D22006DAC8E /* WatchlistItem */, B824E4472A05A85B00E385CE /* WatchProviders */, - B8F253B42BC86497003F27E8 /* RoundedCloseButton.swift */, ); path = View; sourceTree = ""; @@ -1371,6 +1370,7 @@ B8EC463E27D84C62009389FC /* Components */ = { isa = PBXGroup; children = ( + B8F253B42BC86497003F27E8 /* RoundedCloseButton.swift */, B86670B52B5FF63400CBA595 /* CronicaLoadingPopupView.swift */, B8CBBF1B2A4B7C3E0052A59B /* DetailedReleaseDateView.swift */, B890C57827FC999F006BE5E1 /* HeroImage.swift */,