damus

nostr ios client
git clone git://jb55.com/damus
Log | Files | Refs | README | LICENSE

commit 179da9709092af840c81308624cc8e0b46e2940f
parent 2b2d124495ca6f9e4673ce8ab7bbe6f0987627d0
Author: William Casarin <jb55@jb55.com>
Date:   Tue, 11 Apr 2023 14:21:48 -0700

cleanup some dubious code

Diffstat:
Mdamus/ContentView.swift | 4+++-
Mdamus/Views/MainTabView.swift | 11++++-------
2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/damus/ContentView.swift b/damus/ContentView.swift @@ -291,7 +291,7 @@ struct ContentView: View { } .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) .background(Color(uiColor: .systemBackground).ignoresSafeArea()) } @@ -570,6 +570,8 @@ struct ContentView: View { } func switch_timeline(_ timeline: Timeline) { + self.isSideBarOpened = false + self.popToRoot() NotificationCenter.default.post(name: .switched_timeline, object: timeline) diff --git a/damus/Views/MainTabView.swift b/damus/Views/MainTabView.swift @@ -39,7 +39,6 @@ struct TabButton: View { let img: String @Binding var selected: Timeline? @Binding var new_events: NewEventsBits - @Binding var isSidebarVisible: Bool let settings: UserSettingsStore let action: (Timeline) -> () @@ -64,7 +63,6 @@ struct TabButton: View { action(timeline) let bits = timeline_to_notification_bits(timeline, ev: nil) new_events = NewEventsBits(rawValue: new_events.rawValue & ~bits.rawValue) - isSidebarVisible = false }) { Label("", systemImage: selected == timeline ? "\(img).fill" : img) .contentShape(Rectangle()) @@ -78,7 +76,6 @@ struct TabButton: View { struct TabBar: View { @Binding var new_events: NewEventsBits @Binding var selected: Timeline? - @Binding var isSidebarVisible: Bool let settings: UserSettingsStore let action: (Timeline) -> () @@ -87,10 +84,10 @@ struct TabBar: View { VStack { Divider() HStack { - TabButton(timeline: .home, img: "house", selected: $selected, new_events: $new_events, isSidebarVisible: $isSidebarVisible, 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: .search, img: "magnifyingglass.circle", selected: $selected, new_events: $new_events, isSidebarVisible: $isSidebarVisible, 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: .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, settings: settings, action: action).keyboardShortcut("2") + 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, settings: settings, action: action).keyboardShortcut("4") } } }