cleanup some dubious code
This commit is contained in:
@@ -291,7 +291,7 @@ struct ContentView: View {
|
|||||||
}
|
}
|
||||||
.navigationViewStyle(.stack)
|
.navigationViewStyle(.stack)
|
||||||
|
|
||||||
TabBar(new_events: $home.new_events, selected: $selected_timeline, isSidebarVisible: $isSideBarOpened, settings: damus.settings, action: switch_timeline)
|
TabBar(new_events: $home.new_events, selected: $selected_timeline, settings: damus.settings, action: switch_timeline)
|
||||||
.padding([.bottom], 8)
|
.padding([.bottom], 8)
|
||||||
.background(Color(uiColor: .systemBackground).ignoresSafeArea())
|
.background(Color(uiColor: .systemBackground).ignoresSafeArea())
|
||||||
}
|
}
|
||||||
@@ -570,6 +570,8 @@ struct ContentView: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func switch_timeline(_ timeline: Timeline) {
|
func switch_timeline(_ timeline: Timeline) {
|
||||||
|
self.isSideBarOpened = false
|
||||||
|
|
||||||
self.popToRoot()
|
self.popToRoot()
|
||||||
NotificationCenter.default.post(name: .switched_timeline, object: timeline)
|
NotificationCenter.default.post(name: .switched_timeline, object: timeline)
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ struct TabButton: View {
|
|||||||
let img: String
|
let img: String
|
||||||
@Binding var selected: Timeline?
|
@Binding var selected: Timeline?
|
||||||
@Binding var new_events: NewEventsBits
|
@Binding var new_events: NewEventsBits
|
||||||
@Binding var isSidebarVisible: Bool
|
|
||||||
|
|
||||||
let settings: UserSettingsStore
|
let settings: UserSettingsStore
|
||||||
let action: (Timeline) -> ()
|
let action: (Timeline) -> ()
|
||||||
@@ -64,7 +63,6 @@ struct TabButton: View {
|
|||||||
action(timeline)
|
action(timeline)
|
||||||
let bits = timeline_to_notification_bits(timeline, ev: nil)
|
let bits = timeline_to_notification_bits(timeline, ev: nil)
|
||||||
new_events = NewEventsBits(rawValue: new_events.rawValue & ~bits.rawValue)
|
new_events = NewEventsBits(rawValue: new_events.rawValue & ~bits.rawValue)
|
||||||
isSidebarVisible = false
|
|
||||||
}) {
|
}) {
|
||||||
Label("", systemImage: selected == timeline ? "\(img).fill" : img)
|
Label("", systemImage: selected == timeline ? "\(img).fill" : img)
|
||||||
.contentShape(Rectangle())
|
.contentShape(Rectangle())
|
||||||
@@ -78,7 +76,6 @@ struct TabButton: View {
|
|||||||
struct TabBar: View {
|
struct TabBar: View {
|
||||||
@Binding var new_events: NewEventsBits
|
@Binding var new_events: NewEventsBits
|
||||||
@Binding var selected: Timeline?
|
@Binding var selected: Timeline?
|
||||||
@Binding var isSidebarVisible: Bool
|
|
||||||
|
|
||||||
let settings: UserSettingsStore
|
let settings: UserSettingsStore
|
||||||
let action: (Timeline) -> ()
|
let action: (Timeline) -> ()
|
||||||
@@ -87,10 +84,10 @@ struct TabBar: View {
|
|||||||
VStack {
|
VStack {
|
||||||
Divider()
|
Divider()
|
||||||
HStack {
|
HStack {
|
||||||
TabButton(timeline: .home, img: "house", selected: $selected, new_events: $new_events, isSidebarVisible: $isSidebarVisible, settings: settings, action: action).keyboardShortcut("1")
|
TabButton(timeline: .home, img: "house", selected: $selected, new_events: $new_events, settings: settings, action: action).keyboardShortcut("1")
|
||||||
TabButton(timeline: .dms, img: "bubble.left.and.bubble.right", selected: $selected, new_events: $new_events, isSidebarVisible: $isSidebarVisible, settings: settings, action: action).keyboardShortcut("2")
|
TabButton(timeline: .dms, img: "bubble.left.and.bubble.right", selected: $selected, new_events: $new_events, settings: settings, action: action).keyboardShortcut("2")
|
||||||
TabButton(timeline: .search, img: "magnifyingglass.circle", selected: $selected, new_events: $new_events, isSidebarVisible: $isSidebarVisible, settings: settings, action: action).keyboardShortcut("3")
|
TabButton(timeline: .search, img: "magnifyingglass.circle", selected: $selected, new_events: $new_events, settings: settings, action: action).keyboardShortcut("3")
|
||||||
TabButton(timeline: .notifications, img: "bell", selected: $selected, new_events: $new_events, isSidebarVisible: $isSidebarVisible, settings: settings, action: action).keyboardShortcut("4")
|
TabButton(timeline: .notifications, img: "bell", selected: $selected, new_events: $new_events, settings: settings, action: action).keyboardShortcut("4")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user