diff --git a/damus/ContentView.swift b/damus/ContentView.swift index 0e6db71..ac9101a 100644 --- a/damus/ContentView.swift +++ b/damus/ContentView.swift @@ -311,13 +311,15 @@ struct ContentView: View { } func switch_timeline(_ timeline: Timeline) { + NotificationCenter.default.post(name: .switched_timeline, object: timeline) + if timeline == self.selected_timeline { NotificationCenter.default.post(name: .scroll_to_top, object: nil) return } self.selected_timeline = timeline - NotificationCenter.default.post(name: .switched_timeline, object: timeline) + //NotificationCenter.default.post(name: .switched_timeline, object: timeline) //self.selected_timeline = timeline } diff --git a/damus/Views/ProfileView.swift b/damus/Views/ProfileView.swift index 390506e..facc841 100644 --- a/damus/Views/ProfileView.swift +++ b/damus/Views/ProfileView.swift @@ -73,6 +73,8 @@ struct ProfileView: View { @StateObject var profile: ProfileModel @StateObject var followers: FollowersModel + @Environment(\.dismiss) var dismiss + //@EnvironmentObject var profile: ProfileModel var DMButton: some View { @@ -150,8 +152,10 @@ struct ProfileView: View { } .padding([.leading, .trailing], 6) .frame(maxWidth: .infinity, alignment: .topLeading) - .navigationBarTitle("Profile") + .onReceive(handle_notify(.switched_timeline)) { _ in + dismiss() + } .onAppear() { profile.subscribe() followers.subscribe()