This commit is contained in:
cheykrym 2025-12-11 21:43:43 +03:00
parent 3b1b2f3282
commit f69f0ae59e

View File

@ -24,6 +24,10 @@ struct PrivateChatView: View {
@EnvironmentObject private var messageCenter: IncomingMessageCenter @EnvironmentObject private var messageCenter: IncomingMessageCenter
@Environment(\.dismiss) private var dismiss @Environment(\.dismiss) private var dismiss
@State private var previousStandardAppearance: UINavigationBarAppearance?
@State private var previousScrollEdgeAppearance: UINavigationBarAppearance?
@State private var previousCompactAppearance: UINavigationBarAppearance?
init(chat: PrivateChatListItem, currentUserId: String?) { init(chat: PrivateChatListItem, currentUserId: String?) {
self.chat = chat self.chat = chat
self.currentUserId = currentUserId self.currentUserId = currentUserId
@ -94,6 +98,18 @@ struct PrivateChatView: View {
} }
.onAppear { .onAppear {
messageCenter.activeChatId = chat.chatId messageCenter.activeChatId = chat.chatId
previousStandardAppearance = UINavigationBar.appearance().standardAppearance
previousScrollEdgeAppearance = UINavigationBar.appearance().scrollEdgeAppearance
previousCompactAppearance = UINavigationBar.appearance().compactAppearance
let appearance = UINavigationBarAppearance()
appearance.configureWithDefaultBackground()
// appearance.shadowColor = .clear
UINavigationBar.appearance().standardAppearance = appearance
UINavigationBar.appearance().scrollEdgeAppearance = appearance
UINavigationBar.appearance().compactAppearance = appearance
} }
.onChange(of: viewModel.isInitialLoading) { isLoading in .onChange(of: viewModel.isInitialLoading) { isLoading in
if isLoading { if isLoading {
@ -109,6 +125,12 @@ struct PrivateChatView: View {
if messageCenter.activeChatId == chat.chatId { if messageCenter.activeChatId == chat.chatId {
messageCenter.activeChatId = nil messageCenter.activeChatId = nil
} }
if let standard = previousStandardAppearance {
UINavigationBar.appearance().standardAppearance = standard
}
UINavigationBar.appearance().scrollEdgeAppearance = previousScrollEdgeAppearance
UINavigationBar.appearance().compactAppearance = previousCompactAppearance
} }
} }