Fix issue where navigation fails pop to root when switching timelines
Sometimes the navigation stack fails to pop, fix this Changelog-Fixed: Fix issue where navigation fails pop to root when switching timelines
This commit is contained in:
@@ -138,6 +138,12 @@ struct ContentView: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func popToRoot() {
|
||||||
|
profile_open = false
|
||||||
|
thread_open = false
|
||||||
|
search_open = false
|
||||||
|
}
|
||||||
|
|
||||||
func MainContent(damus: DamusState) -> some View {
|
func MainContent(damus: DamusState) -> some View {
|
||||||
VStack {
|
VStack {
|
||||||
NavigationLink(destination: MaybeProfileView, isActive: $profile_open) {
|
NavigationLink(destination: MaybeProfileView, isActive: $profile_open) {
|
||||||
@@ -520,6 +526,7 @@ struct ContentView: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func switch_timeline(_ timeline: Timeline) {
|
func switch_timeline(_ timeline: Timeline) {
|
||||||
|
self.popToRoot()
|
||||||
NotificationCenter.default.post(name: .switched_timeline, object: timeline)
|
NotificationCenter.default.post(name: .switched_timeline, object: timeline)
|
||||||
|
|
||||||
if timeline == self.selected_timeline {
|
if timeline == self.selected_timeline {
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ struct RelayDetailView: View {
|
|||||||
|
|
||||||
@State var conn_color: Color
|
@State var conn_color: Color
|
||||||
|
|
||||||
|
@Environment(\.dismiss) var dismiss
|
||||||
|
|
||||||
func FieldText(_ str: String?) -> some View {
|
func FieldText(_ str: String?) -> some View {
|
||||||
Text(str ?? "No data available")
|
Text(str ?? "No data available")
|
||||||
}
|
}
|
||||||
@@ -64,6 +66,9 @@ struct RelayDetailView: View {
|
|||||||
ProgressView()
|
ProgressView()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.onReceive(handle_notify(.switched_timeline)) { notif in
|
||||||
|
dismiss()
|
||||||
|
}
|
||||||
.navigationTitle(nip11?.name ?? "")
|
.navigationTitle(nip11?.name ?? "")
|
||||||
.task {
|
.task {
|
||||||
var urlString = relay.replacingOccurrences(of: "wss://", with: "https://")
|
var urlString = relay.replacingOccurrences(of: "wss://", with: "https://")
|
||||||
|
|||||||
Reference in New Issue
Block a user