mirror of
https://github.com/yattee/yattee.git
synced 2025-10-25 16:58:14 +00:00
Minor UI improvements, state saving
This commit is contained in:
@@ -2,7 +2,7 @@ import Defaults
|
||||
import SwiftUI
|
||||
|
||||
struct ContentView: View {
|
||||
@StateObject private var state = AppState()
|
||||
@Default(.openChannel) var channel
|
||||
@StateObject private var profile = Profile()
|
||||
|
||||
var body: some View {
|
||||
@@ -16,9 +16,9 @@ struct ContentView: View {
|
||||
.tabItem { Text("Popular") }
|
||||
.tag(TabSelection.popular)
|
||||
|
||||
if !state.channelID.isEmpty {
|
||||
ChannelView(id: state.channelID)
|
||||
.tabItem { Text("\(state.channel) Channel") }
|
||||
if channel != nil {
|
||||
ChannelView(id: channel!.id)
|
||||
.tabItem { Text("\(channel!.name) Channel") }
|
||||
.tag(TabSelection.channel)
|
||||
}
|
||||
|
||||
@@ -34,9 +34,8 @@ struct ContentView: View {
|
||||
.tabItem { Image(systemName: "magnifyingglass") }
|
||||
.tag(TabSelection.search)
|
||||
}
|
||||
.environmentObject(profile)
|
||||
}
|
||||
.environmentObject(state)
|
||||
.environmentObject(profile)
|
||||
}
|
||||
|
||||
var tabSelection: Binding<TabSelection> {
|
||||
|
||||
@@ -3,4 +3,6 @@ import Defaults
|
||||
extension Defaults.Keys {
|
||||
static let layout = Key<ListingLayout>("listingLayout", default: .cells)
|
||||
static let tabSelection = Key<TabSelection>("tabSelection", default: .subscriptions)
|
||||
static let searchQuery = Key<String>("searchQuery", default: "")
|
||||
static let openChannel = Key<Channel?>("openChannel")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user