feat(android): improve profile avatar parity

This commit is contained in:
Daniel Arantes Loverde
2026-04-17 14:41:19 -03:00
parent 9b00c472dc
commit 3c78f2558e
2 changed files with 26 additions and 3 deletions

View File

@@ -35,9 +35,15 @@ struct UserProfileView: View {
.fill(AppColors.brandSoft)
.frame(width: 110, height: 110)
.overlay {
Text(initials)
.font(.system(size: 32, weight: .bold))
.foregroundStyle(AppColors.primary)
if let imageSource = resolvedProfilePicture {
AsyncStoreImage(imageURL: imageSource)
.frame(width: 104, height: 104)
.clipShape(Circle())
} else {
Text(initials)
.font(.system(size: 32, weight: .bold))
.foregroundStyle(AppColors.primary)
}
}
Button("Remover") {
@@ -66,6 +72,13 @@ struct UserProfileView: View {
}
}
.appNoAutoCap()
textFieldSection(
title: "Foto (URL/Base64)",
placeholder: "https://... ou data:image/jpeg;base64,...",
text: $profilePicture
)
.appNoAutoCap()
}
.padding(16)
.background(AppColors.surface)
@@ -95,6 +108,12 @@ struct UserProfileView: View {
return letters.isEmpty ? "PF" : letters.uppercased()
}
private var resolvedProfilePicture: String? {
let trimmed = profilePicture.trimmingCharacters(in: .whitespacesAndNewlines)
guard trimmed.isEmpty == false else { return nil }
return ImageSourceResolver.resolve(trimmed)
}
private var canSave: Bool {
let cleanName = name.trimmingCharacters(in: .whitespacesAndNewlines)
let cleanEmail = email.trimmingCharacters(in: .whitespacesAndNewlines)