From d673a1cd4c6ca01fe91adb7667aa72d8a3faa624 Mon Sep 17 00:00:00 2001 From: Stanislas Lange Date: Fri, 30 Dec 2022 22:26:07 +0100 Subject: [PATCH] AccountDetailView: support display name with emoji in navbar title --- Packages/Account/Sources/Account/AccountDetailView.swift | 9 ++++++++- .../Account/Sources/Account/AccountDetailViewModel.swift | 2 -- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Packages/Account/Sources/Account/AccountDetailView.swift b/Packages/Account/Sources/Account/AccountDetailView.swift index 45fc1d7c..30a0a36a 100644 --- a/Packages/Account/Sources/Account/AccountDetailView.swift +++ b/Packages/Account/Sources/Account/AccountDetailView.swift @@ -92,7 +92,14 @@ public struct AccountDetailView: View { } } .edgesIgnoringSafeArea(.top) - .navigationTitle(Text(scrollOffset < -200 ? viewModel.title : "")) + .navigationBarTitleDisplayMode(.inline) + .toolbar { + ToolbarItem(placement: .principal) { + if scrollOffset < -200 { + currentAccount.account?.displayNameWithEmojis + } + } + } } @ViewBuilder diff --git a/Packages/Account/Sources/Account/AccountDetailViewModel.swift b/Packages/Account/Sources/Account/AccountDetailViewModel.swift index d497c17f..59e0fd13 100644 --- a/Packages/Account/Sources/Account/AccountDetailViewModel.swift +++ b/Packages/Account/Sources/Account/AccountDetailViewModel.swift @@ -46,7 +46,6 @@ class AccountDetailViewModel: ObservableObject, StatusesFetcher { } @Published var statusesState: StatusesState = .loading - @Published var title: String = "" @Published var relationship: Relationshionship? @Published var favourites: [Status] = [] private var favouritesNextPage: LinkHandler? @@ -89,7 +88,6 @@ class AccountDetailViewModel: ObservableObject, StatusesFetcher { self.featuredTags = try await featuredTags self.featuredTags.sort { $0.statusesCountInt > $1.statusesCountInt } self.fields = loadedAccount.fields - self.title = loadedAccount.displayName if isCurrentUser { self.followedTags = try await followedTags } else {