mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 06:55:59 +00:00
Indent blank lines and address avatar crop review feedback
Indent the new method's blank lines to satisfy SwiftFormat's indent-blank-lines rule, which failed the Tests CI jobs. Also address review findings on the crop itself: - Request a 256pt thumbnail box at both donation sites so cropping a scaled (aspect-fit) thumbnail to its minor axis keeps enough resolution for the share sheet's circle. - Round the draw offsets to whole pixels so odd-sized crops blit instead of resampling. - Log when fetched avatar data can't be decoded rather than silently swapping in the placeholder, and document the non-obvious format.scale pinning.
This commit is contained in:
@@ -650,9 +650,14 @@ class TimelineController: TimelineControllerProtocol {
|
||||
}
|
||||
|
||||
if let avatarURL, let mediaSource = try? MediaSourceProxy(url: avatarURL, mimeType: nil) {
|
||||
if case let .success(avatarData) = await mediaProvider.loadThumbnailForSource(source: mediaSource, size: .init(width: 100, height: 100)),
|
||||
let squareAvatarData = Avatars.squareAvatarImageData(from: avatarData) {
|
||||
sendMessageIntent.setImage(INImage(imageData: squareAvatarData), forParameterNamed: \.speakableGroupName)
|
||||
// Request a generous size so the square crop of a non-square avatar keeps enough resolution.
|
||||
if case let .success(avatarData) = await mediaProvider.loadThumbnailForSource(source: mediaSource, size: .init(width: 256, height: 256)) {
|
||||
if let squareAvatarData = Avatars.squareAvatarImageData(from: avatarData) {
|
||||
sendMessageIntent.setImage(INImage(imageData: squareAvatarData), forParameterNamed: \.speakableGroupName)
|
||||
} else {
|
||||
MXLog.error("Failed processing the room avatar for the send message intent, using a placeholder.")
|
||||
addPlacehoder()
|
||||
}
|
||||
} else {
|
||||
addPlacehoder()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user