mirror of
https://github.com/yattee/yattee.git
synced 2025-08-05 02:04:07 +00:00
Settings for iOS/macOS
This commit is contained in:
@@ -2,7 +2,7 @@ import Defaults
|
||||
import SwiftUI
|
||||
|
||||
struct VideoView: View {
|
||||
@EnvironmentObject<NavigationState> private var navigationState
|
||||
@EnvironmentObject<NavigationModel> private var navigation
|
||||
|
||||
#if os(iOS)
|
||||
@Environment(\.verticalSizeClass) private var verticalSizeClass
|
||||
@@ -21,7 +21,7 @@ struct VideoView: View {
|
||||
content
|
||||
}
|
||||
} else {
|
||||
Button(action: { navigationState.playVideo(video) }) {
|
||||
Button(action: { navigation.playVideo(video) }) {
|
||||
content
|
||||
}
|
||||
}
|
||||
@@ -125,7 +125,7 @@ struct VideoView: View {
|
||||
VStack(alignment: .leading, spacing: 0) {
|
||||
thumbnail
|
||||
|
||||
VStack(alignment: .leading) {
|
||||
VStack(alignment: .leading, spacing: 0) {
|
||||
videoDetail(video.title, lineLimit: additionalDetailsAvailable ? 2 : 3)
|
||||
#if os(tvOS)
|
||||
.frame(minHeight: additionalDetailsAvailable ? 80 : 120, alignment: .top)
|
||||
@@ -155,7 +155,9 @@ struct VideoView: View {
|
||||
}
|
||||
}
|
||||
.frame(minHeight: 30, alignment: .top)
|
||||
.padding(.bottom, 10)
|
||||
#if os(tvOS)
|
||||
.padding(.bottom, 10)
|
||||
#endif
|
||||
}
|
||||
.padding(.top, 4)
|
||||
.frame(minWidth: 0, maxWidth: .infinity, alignment: .topLeading)
|
||||
|
@@ -20,7 +20,7 @@ struct VideosCellsHorizontal: View {
|
||||
.padding(.trailing, 20)
|
||||
.padding(.bottom, 40)
|
||||
#else
|
||||
.frame(maxWidth: 300)
|
||||
.frame(width: 300)
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -32,6 +32,11 @@ struct VideosCellsHorizontal: View {
|
||||
.padding(.vertical, 20)
|
||||
#endif
|
||||
}
|
||||
.onAppear {
|
||||
if let video = videos.first {
|
||||
scrollView.scrollTo(video.id, anchor: .leading)
|
||||
}
|
||||
}
|
||||
.onChange(of: videos) { [videos] newVideos in
|
||||
#if !os(tvOS)
|
||||
guard !videos.isEmpty, let video = newVideos.first else {
|
||||
@@ -45,7 +50,7 @@ struct VideosCellsHorizontal: View {
|
||||
#if os(tvOS)
|
||||
.frame(height: 560)
|
||||
#else
|
||||
.frame(height: 320)
|
||||
.frame(height: 280)
|
||||
#endif
|
||||
|
||||
.edgesIgnoringSafeArea(.horizontal)
|
||||
@@ -55,7 +60,7 @@ struct VideosCellsHorizontal: View {
|
||||
struct VideoCellsHorizontal_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
VideosCellsHorizontal(videos: Video.allFixtures)
|
||||
.environmentObject(NavigationState())
|
||||
.environmentObject(Subscriptions())
|
||||
.environmentObject(NavigationModel())
|
||||
.environmentObject(SubscriptionsModel())
|
||||
}
|
||||
}
|
||||
|
@@ -72,6 +72,6 @@ struct VideoCellsView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
VideosView(videos: Video.allFixtures)
|
||||
.frame(minWidth: 1000)
|
||||
.environmentObject(NavigationState())
|
||||
.environmentObject(NavigationModel())
|
||||
}
|
||||
}
|
||||
|
@@ -2,7 +2,7 @@ import Defaults
|
||||
import SwiftUI
|
||||
|
||||
struct VideosView: View {
|
||||
@EnvironmentObject<NavigationState> private var navigationState
|
||||
@EnvironmentObject<NavigationModel> private var navigation
|
||||
|
||||
#if os(tvOS)
|
||||
@Default(.layout) private var layout
|
||||
|
Reference in New Issue
Block a user