mirror of
https://github.com/yattee/yattee.git
synced 2025-08-06 10:44:06 +00:00
Search improvements for iOS
This commit is contained in:
@@ -16,8 +16,7 @@ struct AppSidebarNavigation: View {
|
||||
@EnvironmentObject<InstancesModel> private var instances
|
||||
@EnvironmentObject<NavigationModel> private var navigation
|
||||
@EnvironmentObject<PlaylistsModel> private var playlists
|
||||
@EnvironmentObject<Recents> private var recents
|
||||
@EnvironmentObject<SearchModel> private var search
|
||||
@EnvironmentObject<RecentsModel> private var recents
|
||||
@EnvironmentObject<SubscriptionsModel> private var subscriptions
|
||||
|
||||
@State private var didApplyPrimaryViewWorkAround = false
|
||||
@@ -56,23 +55,6 @@ struct AppSidebarNavigation: View {
|
||||
Text("Select section")
|
||||
}
|
||||
.environment(\.navigationStyle, .sidebar)
|
||||
.searchable(text: $search.queryText, placement: .sidebar) {
|
||||
ForEach(search.querySuggestions.collection, id: \.self) { suggestion in
|
||||
Text(suggestion)
|
||||
.searchCompletion(suggestion)
|
||||
}
|
||||
}
|
||||
.onChange(of: search.queryText) { query in
|
||||
search.loadSuggestions(query)
|
||||
}
|
||||
.onSubmit(of: .search) {
|
||||
search.changeQuery { query in
|
||||
query.query = search.queryText
|
||||
}
|
||||
recents.open(RecentItem(from: search.queryText))
|
||||
|
||||
navigation.tabSelection = .search
|
||||
}
|
||||
}
|
||||
|
||||
var sidebar: some View {
|
||||
@@ -87,12 +69,6 @@ struct AppSidebarNavigation: View {
|
||||
scrollScrollViewToItem(scrollView: scrollView, for: navigation.tabSelection)
|
||||
}
|
||||
}
|
||||
.background {
|
||||
NavigationLink(destination: SearchView(), tag: TabSelection.search, selection: selection) {
|
||||
Color.clear
|
||||
}
|
||||
.hidden()
|
||||
}
|
||||
.listStyle(.sidebar)
|
||||
}
|
||||
.toolbar {
|
||||
@@ -144,6 +120,12 @@ struct AppSidebarNavigation: View {
|
||||
Label("Trending", systemImage: "chart.line.uptrend.xyaxis")
|
||||
.accessibility(label: Text("Trending"))
|
||||
}
|
||||
|
||||
NavigationLink(destination: LazyView(SearchView()), tag: TabSelection.search, selection: selection) {
|
||||
Label("Search", systemImage: "magnifyingglass")
|
||||
.accessibility(label: Text("Search"))
|
||||
}
|
||||
.keyboardShortcut("f")
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -5,7 +5,7 @@ struct AppSidebarRecents: View {
|
||||
@Binding var selection: TabSelection?
|
||||
|
||||
@EnvironmentObject<NavigationModel> private var navigation
|
||||
@EnvironmentObject<Recents> private var recents
|
||||
@EnvironmentObject<RecentsModel> private var recents
|
||||
|
||||
@Default(.recentlyOpened) private var recentItems
|
||||
|
||||
@@ -44,7 +44,7 @@ struct AppSidebarRecents: View {
|
||||
}
|
||||
|
||||
struct RecentNavigationLink<DestinationContent: View>: View {
|
||||
@EnvironmentObject<Recents> private var recents
|
||||
@EnvironmentObject<RecentsModel> private var recents
|
||||
|
||||
var recent: RecentItem
|
||||
@Binding var selection: TabSelection?
|
||||
|
@@ -4,7 +4,7 @@ import SwiftUI
|
||||
struct AppTabNavigation: View {
|
||||
@EnvironmentObject<NavigationModel> private var navigation
|
||||
@EnvironmentObject<SearchModel> private var search
|
||||
@EnvironmentObject<Recents> private var recents
|
||||
@EnvironmentObject<RecentsModel> private var recents
|
||||
|
||||
var body: some View {
|
||||
TabView(selection: $navigation.tabSelection) {
|
||||
@@ -78,9 +78,7 @@ struct AppTabNavigation: View {
|
||||
query.query = search.queryText
|
||||
}
|
||||
|
||||
recents.open(RecentItem(from: search.queryText))
|
||||
|
||||
navigation.tabSelection = .search
|
||||
recents.addQuery(search.queryText)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
@@ -4,7 +4,7 @@ import SwiftUI
|
||||
struct ContentView: View {
|
||||
@StateObject private var navigation = NavigationModel()
|
||||
@StateObject private var playback = PlaybackModel()
|
||||
@StateObject private var recents = Recents()
|
||||
@StateObject private var recents = RecentsModel()
|
||||
|
||||
@EnvironmentObject<InvidiousAPI> private var api
|
||||
@EnvironmentObject<InstancesModel> private var instances
|
||||
@@ -34,6 +34,7 @@ struct ContentView: View {
|
||||
.sheet(isPresented: $navigation.showingVideo) {
|
||||
if let video = navigation.video {
|
||||
VideoPlayerView(video)
|
||||
.environmentObject(playback)
|
||||
|
||||
#if !os(iOS)
|
||||
.frame(minWidth: 550, minHeight: 720)
|
||||
|
Reference in New Issue
Block a user