mirror of
https://github.com/yattee/yattee.git
synced 2024-12-22 21:43:41 +00:00
Navigation improvements
This commit is contained in:
parent
a2e23fe72c
commit
31c5ed1643
@ -78,7 +78,7 @@ final class NavigationModel: ObservableObject {
|
||||
return
|
||||
}
|
||||
|
||||
navigation.presentingPlaylist = false
|
||||
player.presentingPlayer = false
|
||||
navigation.presentingChannel = false
|
||||
|
||||
let recent = RecentItem(from: channel)
|
||||
@ -116,7 +116,6 @@ final class NavigationModel: ObservableObject {
|
||||
navigationStyle: NavigationStyle,
|
||||
delay: Bool = false
|
||||
) {
|
||||
navigation.presentingChannel = false
|
||||
navigation.presentingPlaylist = false
|
||||
|
||||
let recent = RecentItem(from: playlist)
|
||||
|
@ -22,4 +22,8 @@ final class Store<Data>: ResourceObserver, ObservableObject {
|
||||
func replace(_ items: Data) {
|
||||
all = items
|
||||
}
|
||||
|
||||
func clear() {
|
||||
all = nil
|
||||
}
|
||||
}
|
||||
|
@ -43,8 +43,8 @@ struct AppTabNavigation: View {
|
||||
searchNavigationView
|
||||
}
|
||||
.id(accounts.current?.id ?? "")
|
||||
.overlay(channelView)
|
||||
.overlay(playlistView)
|
||||
.overlay(channelView)
|
||||
.environment(\.navigationStyle, .tab)
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ struct ChannelPlaylistView: View {
|
||||
}
|
||||
|
||||
private var presentedPlaylist: ChannelPlaylist? {
|
||||
recents.presentedPlaylist ?? playlist
|
||||
playlist ?? recents.presentedPlaylist
|
||||
}
|
||||
|
||||
private var resource: Resource? {
|
||||
@ -54,6 +54,7 @@ struct ChannelPlaylistView: View {
|
||||
#if os(iOS)
|
||||
.onChange(of: navigation.presentingPlaylist) { newValue in
|
||||
if newValue {
|
||||
store.clear()
|
||||
viewVerticalOffset = 0
|
||||
resource?.load()
|
||||
} else {
|
||||
@ -61,6 +62,7 @@ struct ChannelPlaylistView: View {
|
||||
}
|
||||
}
|
||||
.offset(y: viewVerticalOffset)
|
||||
.opacity(viewVerticalOffset == Self.hiddenOffset ? 0 : 1)
|
||||
.animation(.easeIn(duration: 0.2), value: viewVerticalOffset)
|
||||
#endif
|
||||
} else {
|
||||
|
@ -33,7 +33,7 @@ struct ChannelVideosView: View {
|
||||
@Namespace private var focusNamespace
|
||||
|
||||
var presentedChannel: Channel? {
|
||||
recents.presentedChannel ?? channel
|
||||
channel ?? recents.presentedChannel
|
||||
}
|
||||
|
||||
var videos: [ContentItem] {
|
||||
@ -50,13 +50,15 @@ struct ChannelVideosView: View {
|
||||
#if os(iOS)
|
||||
.onChange(of: navigation.presentingChannel) { newValue in
|
||||
if newValue {
|
||||
resource?.load()
|
||||
store.clear()
|
||||
viewVerticalOffset = 0
|
||||
resource?.load()
|
||||
} else {
|
||||
viewVerticalOffset = Self.hiddenOffset
|
||||
}
|
||||
}
|
||||
.offset(y: viewVerticalOffset)
|
||||
.opacity(viewVerticalOffset == Self.hiddenOffset ? 0 : 1)
|
||||
.animation(.easeIn(duration: 0.2), value: viewVerticalOffset)
|
||||
#endif
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user