Fix to account selector on iOS

This commit is contained in:
Thomas Ricouard 2023-11-20 18:43:16 +01:00
parent 47d54fd9e6
commit b3153289c4
2 changed files with 9 additions and 4 deletions

View file

@ -46,6 +46,7 @@ public struct AppAccountsSelectorView: View {
HapticManager.shared.fireHaptic(.buttonPress) HapticManager.shared.fireHaptic(.buttonPress)
} label: { } label: {
labelView labelView
.contentShape(Rectangle())
} }
.sheet(isPresented: $isPresented, content: { .sheet(isPresented: $isPresented, content: {
accountsView.presentationDetents([.height(preferredHeight), .large]) accountsView.presentationDetents([.height(preferredHeight), .large])
@ -73,9 +74,10 @@ public struct AppAccountsSelectorView: View {
Group { Group {
if let account = currentAccount.account, !currentAccount.isLoadingAccount { if let account = currentAccount.account, !currentAccount.isLoadingAccount {
AvatarView(account: account, config: avatarConfig) AvatarView(account: account, config: avatarConfig)
.padding(.leading, 16)
} else { } else {
ProgressView() AvatarView(account: nil, config: avatarConfig)
.redacted(reason: .placeholder)
.allowsHitTesting(false)
} }
}.overlay(alignment: .topTrailing) { }.overlay(alignment: .topTrailing) {
if !currentAccount.followRequests.isEmpty || showNotificationBadge, accountCreationEnabled { if !currentAccount.followRequests.isEmpty || showNotificationBadge, accountCreationEnabled {

View file

@ -20,6 +20,7 @@ public struct AvatarView: View {
if let account = account { if let account = account {
if hasPopup { if hasPopup {
AvatarImage(account: account, config: adaptiveConfig) AvatarImage(account: account, config: adaptiveConfig)
.frame(width: config.width, height: config.height)
.onHover { hovering in .onHover { hovering in
if hovering { if hovering {
toggleTask.cancel() toggleTask.cancel()
@ -48,6 +49,7 @@ public struct AvatarView: View {
} }
} else { } else {
AvatarImage(account: account, config: adaptiveConfig) AvatarImage(account: account, config: adaptiveConfig)
.frame(width: config.width, height: config.height)
} }
} else { } else {
AvatarPlaceHolder(config: adaptiveConfig) AvatarPlaceHolder(config: adaptiveConfig)
@ -155,8 +157,9 @@ struct AvatarImage: View {
LazyImage(request: ImageRequest(url: account.avatar, processors: [.resize(size: config.size)]) LazyImage(request: ImageRequest(url: account.avatar, processors: [.resize(size: config.size)])
) { state in ) { state in
if let image = state.image { if let image = state.image {
image.resizable().scaledToFill() image
.frame(width: config.width, height: config.height) .resizable()
.scaledToFit()
.clipShape(RoundedRectangle(cornerRadius: config.cornerRadius)) .clipShape(RoundedRectangle(cornerRadius: config.cornerRadius))
.overlay( .overlay(
RoundedRectangle(cornerRadius: config.cornerRadius) RoundedRectangle(cornerRadius: config.cornerRadius)