From a4855775efcf275b931190f85dc999ad400bb2d3 Mon Sep 17 00:00:00 2001 From: Jack Chakany Date: Thu, 23 Feb 2023 19:24:28 -0500 Subject: [PATCH] Fix navbar title so it changes based on what page you were on previously. --- damus/ContentView.swift | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/damus/ContentView.swift b/damus/ContentView.swift index 6486c952..40b5e98a 100644 --- a/damus/ContentView.swift +++ b/damus/ContentView.swift @@ -203,7 +203,20 @@ struct ContentView: View { EmptyView() } } - .navigationBarTitle(selected_timeline == .home ? NSLocalizedString("Home", comment: "Navigation bar title for Home view where posts and replies appear from those who the user is following.") : NSLocalizedString("Universe 🛸", comment: "Navigation bar title for universal view where posts from all connected relay servers appear."), displayMode: .inline) + .navigationBarTitle({ + switch selected_timeline { + case .home: + return NSLocalizedString("Home", comment: "Navigation bar title for Home view where posts and replies appear from those who the user is following.") + case .dms: + return NSLocalizedString("DMs", comment: "Navigation bar title for DMs view, where DM is the English abbreviation for Direct Message.") + case .notifications: + return NSLocalizedString("Notifications", comment: "Navigation bar title for Notifications view.") + case .search: + return NSLocalizedString("Universe 🛸", comment: "Navigation bar title for the universal view where posts from all connected relay servers appear.") + case .none: + return NSLocalizedString("", comment: "Toolbar label for unknown views. This label would be displayed only if a new timeline view is added but a toolbar label was not explicitly assigned to it yet.") + } + }(), displayMode: .inline) .toolbar { ToolbarItem(placement: .principal) { timelineNavItem