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

View file

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