tvOS layout fixes

This commit is contained in:
Arkadiusz Fal 2022-11-10 22:51:30 +01:00
parent d779ec7215
commit 21b61982ad
6 changed files with 25 additions and 17 deletions

View File

@ -58,7 +58,11 @@ struct PlayerQueueRow: View {
} label: { } label: {
VideoBanner(video: item.video, playbackTime: watchStoppedAt, videoDuration: watch?.videoDuration) VideoBanner(video: item.video, playbackTime: watchStoppedAt, videoDuration: watch?.videoDuration)
} }
#if os(tvOS)
.buttonStyle(.card)
#else
.buttonStyle(.plain) .buttonStyle(.plain)
#endif
} }
private var watch: Watch? { private var watch: Watch? {

View File

@ -167,10 +167,6 @@ struct TrendingView: View {
} }
} }
#if os(iOS)
Spacer()
#endif
HStack { HStack {
Text("Country") Text("Country")
.foregroundColor(.secondary) .foregroundColor(.secondary)
@ -178,13 +174,11 @@ struct TrendingView: View {
countryButton countryButton
} }
#if os(tvOS) if let favoriteItem {
if let favoriteItem { FavoriteButton(item: favoriteItem)
FavoriteButton(item: favoriteItem) .id(favoriteItem.id)
.id(favoriteItem.id) .labelStyle(.iconOnly)
.labelStyle(.iconOnly) }
}
#endif
} }
} }
#endif #endif

View File

@ -71,8 +71,17 @@ struct VideoBanner: View {
.padding(.vertical, playbackTime.isNil ? 0 : 5) .padding(.vertical, playbackTime.isNil ? 0 : 5)
} }
.contentShape(Rectangle()) .contentShape(Rectangle())
.buttonStyle(.plain) #if os(tvOS)
.frame(minWidth: 0, maxWidth: .infinity, minHeight: 0, maxHeight: 100, alignment: .center) .buttonStyle(.card)
#else
.buttonStyle(.plain)
#endif
.frame(minWidth: 0, maxWidth: .infinity, minHeight: 0, maxHeight: 100, alignment: .center)
#if os(tvOS)
.padding(.vertical, 20)
.padding(.trailing, 10)
#endif
} }
private var stackAlignment: VerticalAlignment { private var stackAlignment: VerticalAlignment {

View File

@ -25,12 +25,12 @@ struct PopularView: View {
.navigationTitle("Popular") .navigationTitle("Popular")
#endif #endif
} }
#if !os(tvOS)
.toolbar { .toolbar {
ToolbarItem(placement: .automatic) { ToolbarItem(placement: .automatic) {
FavoriteButton(item: FavoriteItem(section: .popular)) FavoriteButton(item: FavoriteItem(section: .popular))
} }
} }
#if !os(tvOS)
.background( .background(
Button("Refresh") { Button("Refresh") {
resource?.load() resource?.load()

View File

@ -37,12 +37,13 @@ struct SubscriptionsView: View {
#endif #endif
} }
} }
#if !os(tvOS)
.toolbar { .toolbar {
ToolbarItem(placement: .automatic) { ToolbarItem(placement: .automatic) {
FavoriteButton(item: FavoriteItem(section: .subscriptions)) FavoriteButton(item: FavoriteItem(section: .subscriptions))
} }
} }
#if !os(tvOS)
.background( .background(
Button("Refresh") { Button("Refresh") {
loadResources(force: true) loadResources(force: true)

View File

@ -358,7 +358,6 @@
37599F36272B44000087F250 /* FavoritesModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37599F33272B44000087F250 /* FavoritesModel.swift */; }; 37599F36272B44000087F250 /* FavoritesModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37599F33272B44000087F250 /* FavoritesModel.swift */; };
37599F38272B4D740087F250 /* FavoriteButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37599F37272B4D740087F250 /* FavoriteButton.swift */; }; 37599F38272B4D740087F250 /* FavoriteButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37599F37272B4D740087F250 /* FavoriteButton.swift */; };
37599F39272B4D740087F250 /* FavoriteButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37599F37272B4D740087F250 /* FavoriteButton.swift */; }; 37599F39272B4D740087F250 /* FavoriteButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37599F37272B4D740087F250 /* FavoriteButton.swift */; };
37599F3A272B4D740087F250 /* FavoriteButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37599F37272B4D740087F250 /* FavoriteButton.swift */; };
375B537428DF6CBB004C1D19 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 375B537828DF6CBB004C1D19 /* Localizable.strings */; }; 375B537428DF6CBB004C1D19 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 375B537828DF6CBB004C1D19 /* Localizable.strings */; };
375B537528DF6CBB004C1D19 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 375B537828DF6CBB004C1D19 /* Localizable.strings */; }; 375B537528DF6CBB004C1D19 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 375B537828DF6CBB004C1D19 /* Localizable.strings */; };
375B537628DF6CBB004C1D19 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 375B537828DF6CBB004C1D19 /* Localizable.strings */; }; 375B537628DF6CBB004C1D19 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 375B537828DF6CBB004C1D19 /* Localizable.strings */; };
@ -581,6 +580,7 @@
379775952689365600DD52A8 /* Array+Next.swift in Sources */ = {isa = PBXBuildFile; fileRef = 379775922689365600DD52A8 /* Array+Next.swift */; }; 379775952689365600DD52A8 /* Array+Next.swift in Sources */ = {isa = PBXBuildFile; fileRef = 379775922689365600DD52A8 /* Array+Next.swift */; };
3799AC0928B03CED001376F9 /* ActiveLabel in Frameworks */ = {isa = PBXBuildFile; productRef = 3799AC0828B03CED001376F9 /* ActiveLabel */; }; 3799AC0928B03CED001376F9 /* ActiveLabel in Frameworks */ = {isa = PBXBuildFile; productRef = 3799AC0828B03CED001376F9 /* ActiveLabel */; };
379B0253287A1CDF001015B5 /* OrientationTracker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 379B0252287A1CDF001015B5 /* OrientationTracker.swift */; }; 379B0253287A1CDF001015B5 /* OrientationTracker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 379B0252287A1CDF001015B5 /* OrientationTracker.swift */; };
379C0F49291DA5AB00256D07 /* FavoriteButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37599F37272B4D740087F250 /* FavoriteButton.swift */; };
379DC3D128BA4EB400B09677 /* Seek.swift in Sources */ = {isa = PBXBuildFile; fileRef = 379DC3D028BA4EB400B09677 /* Seek.swift */; }; 379DC3D128BA4EB400B09677 /* Seek.swift in Sources */ = {isa = PBXBuildFile; fileRef = 379DC3D028BA4EB400B09677 /* Seek.swift */; };
379DC3D228BA4EB400B09677 /* Seek.swift in Sources */ = {isa = PBXBuildFile; fileRef = 379DC3D028BA4EB400B09677 /* Seek.swift */; }; 379DC3D228BA4EB400B09677 /* Seek.swift in Sources */ = {isa = PBXBuildFile; fileRef = 379DC3D028BA4EB400B09677 /* Seek.swift */; };
379DC3D328BA4EB400B09677 /* Seek.swift in Sources */ = {isa = PBXBuildFile; fileRef = 379DC3D028BA4EB400B09677 /* Seek.swift */; }; 379DC3D328BA4EB400B09677 /* Seek.swift in Sources */ = {isa = PBXBuildFile; fileRef = 379DC3D028BA4EB400B09677 /* Seek.swift */; };
@ -3505,8 +3505,8 @@
370F4FAA27CC163B001B35DC /* PlayerBackend.swift in Sources */, 370F4FAA27CC163B001B35DC /* PlayerBackend.swift in Sources */,
376A33E62720CB35000C1D6B /* Account.swift in Sources */, 376A33E62720CB35000C1D6B /* Account.swift in Sources */,
3763C98B290C7A50004D3B5F /* OpenVideosView.swift in Sources */, 3763C98B290C7A50004D3B5F /* OpenVideosView.swift in Sources */,
379C0F49291DA5AB00256D07 /* FavoriteButton.swift in Sources */,
375F7412289DC35A00747050 /* PlayerBackendView.swift in Sources */, 375F7412289DC35A00747050 /* PlayerBackendView.swift in Sources */,
37599F3A272B4D740087F250 /* FavoriteButton.swift in Sources */,
37EF5C242739D37B00B03725 /* MenuModel.swift in Sources */, 37EF5C242739D37B00B03725 /* MenuModel.swift in Sources */,
37C7A1D7267BFD9D0010EAD6 /* SponsorBlockSegment.swift in Sources */, 37C7A1D7267BFD9D0010EAD6 /* SponsorBlockSegment.swift in Sources */,
377ABC4E286E6A78009C986F /* LocationsSettings.swift in Sources */, 377ABC4E286E6A78009C986F /* LocationsSettings.swift in Sources */,