From 62726e345c9d854f513ce901d7e484b1f1b294c6 Mon Sep 17 00:00:00 2001 From: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com> Date: Mon, 10 Jul 2023 07:57:23 +0100 Subject: [PATCH] ios: fix user profile in toolbar (#2667) --- .../Shared/Views/ChatList/ChatListView.swift | 27 +++++++++---------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/apps/ios/Shared/Views/ChatList/ChatListView.swift b/apps/ios/Shared/Views/ChatList/ChatListView.swift index 9e85f0d467..cf206e74ce 100644 --- a/apps/ios/Shared/Views/ChatList/ChatListView.swift +++ b/apps/ios/Shared/Views/ChatList/ChatListView.swift @@ -76,7 +76,19 @@ struct ChatListView: View { .navigationBarTitleDisplayMode(.inline) .toolbar { ToolbarItem(placement: .navigationBarLeading) { - Button { + let user = chatModel.currentUser ?? User.sampleData + ZStack(alignment: .topTrailing) { + ProfileImage(imageStr: user.image, color: Color(uiColor: .quaternaryLabel)) + .frame(width: 32, height: 32) + .padding(.trailing, 4) + let allRead = chatModel.users + .filter { u in !u.user.activeUser && !u.user.hidden } + .allSatisfy { u in u.unreadCount == 0 } + if !allRead { + unreadBadge(size: 12) + } + } + .onTapGesture { if chatModel.users.filter({ u in u.user.activeUser || !u.user.hidden }).count > 1 { withAnimation { userPickerVisible.toggle() @@ -84,19 +96,6 @@ struct ChatListView: View { } else { showSettings = true } - } label: { - let user = chatModel.currentUser ?? User.sampleData - ZStack(alignment: .topTrailing) { - ProfileImage(imageStr: user.image, color: Color(uiColor: .quaternaryLabel)) - .frame(width: 32, height: 32) - .padding(.trailing, 4) - let allRead = chatModel.users - .filter { u in !u.user.activeUser && !u.user.hidden } - .allSatisfy { u in u.unreadCount == 0 } - if !allRead { - unreadBadge(size: 12) - } - } } } ToolbarItem(placement: .principal) {