mirror of
https://github.com/yattee/yattee.git
synced 2024-12-22 13:33:42 +00:00
Channel/playlist view transition improvements
This commit is contained in:
parent
ddf306d5c1
commit
33d52aeed3
@ -107,7 +107,7 @@ final class NavigationModel: ObservableObject {
|
||||
navigation.sidebarSectionChanged.toggle()
|
||||
navigation.tabSelection = .recentlyOpened(recent.tag)
|
||||
} else {
|
||||
withAnimation {
|
||||
withAnimation(.linear(duration: 0.3)) {
|
||||
navigation.presentingChannel = true
|
||||
}
|
||||
}
|
||||
@ -137,7 +137,7 @@ final class NavigationModel: ObservableObject {
|
||||
navigation.sidebarSectionChanged.toggle()
|
||||
navigation.tabSelection = .recentlyOpened(recent.tag)
|
||||
} else {
|
||||
withAnimation {
|
||||
withAnimation(.linear(duration: 0.3)) {
|
||||
navigation.presentingPlaylist = true
|
||||
}
|
||||
}
|
||||
|
@ -156,9 +156,8 @@ struct AppTabNavigation: View {
|
||||
.environmentObject(player)
|
||||
.environmentObject(subscriptions)
|
||||
.environmentObject(thumbnailsModel)
|
||||
.transition(.asymmetric(insertion: .flipFromBottom, removal: .move(edge: .bottom)))
|
||||
} else {
|
||||
EmptyView()
|
||||
.id("channelVideos")
|
||||
.transition(.move(edge: .bottom))
|
||||
}
|
||||
}
|
||||
|
||||
@ -171,9 +170,8 @@ struct AppTabNavigation: View {
|
||||
.environmentObject(player)
|
||||
.environmentObject(subscriptions)
|
||||
.environmentObject(thumbnailsModel)
|
||||
.transition(.asymmetric(insertion: .flipFromBottom, removal: .move(edge: .bottom)))
|
||||
} else {
|
||||
EmptyView()
|
||||
.id("channelPlaylist")
|
||||
.transition(.move(edge: .bottom))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,19 +2,11 @@ import Siesta
|
||||
import SwiftUI
|
||||
|
||||
struct ChannelPlaylistView: View {
|
||||
#if os(iOS)
|
||||
static let hiddenOffset = max(UIScreen.main.bounds.height, UIScreen.main.bounds.width) + 100
|
||||
#endif
|
||||
|
||||
var playlist: ChannelPlaylist?
|
||||
|
||||
@State private var presentingShareSheet = false
|
||||
@State private var shareURL: URL?
|
||||
|
||||
#if os(iOS)
|
||||
@State private var viewVerticalOffset = Self.hiddenOffset
|
||||
#endif
|
||||
|
||||
@StateObject private var store = Store<ChannelPlaylist>()
|
||||
|
||||
@Environment(\.colorScheme) private var colorScheme
|
||||
@ -51,17 +43,6 @@ struct ChannelPlaylistView: View {
|
||||
content
|
||||
}
|
||||
}
|
||||
#if os(iOS)
|
||||
.onChange(of: navigation.presentingPlaylist) { newValue in
|
||||
if newValue {
|
||||
store.clear()
|
||||
viewVerticalOffset = 0
|
||||
resource?.load()
|
||||
} else {
|
||||
viewVerticalOffset = Self.hiddenOffset
|
||||
}
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
BrowserPlayerControls {
|
||||
content
|
||||
@ -92,7 +73,13 @@ struct ChannelPlaylistView: View {
|
||||
.environment(\.inChannelPlaylistView, true)
|
||||
}
|
||||
.onAppear {
|
||||
resource?.loadIfNeeded()
|
||||
if navigationStyle == .tab {
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
|
||||
resource?.loadIfNeeded()
|
||||
}
|
||||
} else {
|
||||
resource?.loadIfNeeded()
|
||||
}
|
||||
}
|
||||
#if os(tvOS)
|
||||
.background(Color.background(scheme: colorScheme))
|
||||
|
@ -2,19 +2,12 @@ import Siesta
|
||||
import SwiftUI
|
||||
|
||||
struct ChannelVideosView: View {
|
||||
#if os(iOS)
|
||||
static let hiddenOffset = max(UIScreen.main.bounds.height, UIScreen.main.bounds.width) + 100
|
||||
#endif
|
||||
var channel: Channel?
|
||||
|
||||
@State private var presentingShareSheet = false
|
||||
@State private var shareURL: URL?
|
||||
@State private var subscriptionToggleButtonDisabled = false
|
||||
|
||||
#if os(iOS)
|
||||
@State private var viewVerticalOffset = Self.hiddenOffset
|
||||
#endif
|
||||
|
||||
@StateObject private var store = Store<Channel>()
|
||||
|
||||
@Environment(\.colorScheme) private var colorScheme
|
||||
@ -47,17 +40,6 @@ struct ChannelVideosView: View {
|
||||
content
|
||||
}
|
||||
}
|
||||
#if os(iOS)
|
||||
.onChange(of: navigation.presentingChannel) { newValue in
|
||||
if newValue {
|
||||
store.clear()
|
||||
viewVerticalOffset = 0
|
||||
resource?.load()
|
||||
} else {
|
||||
viewVerticalOffset = Self.hiddenOffset
|
||||
}
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
BrowserPlayerControls {
|
||||
content
|
||||
@ -132,7 +114,13 @@ struct ChannelVideosView: View {
|
||||
}
|
||||
#endif
|
||||
.onAppear {
|
||||
resource?.loadIfNeeded()
|
||||
if navigationStyle == .tab {
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
|
||||
resource?.loadIfNeeded()
|
||||
}
|
||||
} else {
|
||||
resource?.loadIfNeeded()
|
||||
}
|
||||
}
|
||||
#if !os(tvOS)
|
||||
.navigationTitle(navigationTitle)
|
||||
|
Loading…
Reference in New Issue
Block a user