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