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:
Matthew Hodgson
2026-08-03 22:55:03 +03:00
committed by Mauro
parent 39805d080e
commit 58e1a0212d
3 changed files with 23 additions and 10 deletions
+4 -1
View File
@@ -257,10 +257,13 @@ nonisolated struct NotificationContentBuilder {
let image: INImage
if !forcePlaceholder,
let mediaSource = icon.mediaSource {
switch await mediaProvider.loadThumbnailForSource(source: mediaSource, size: .init(width: 100, height: 100)) {
// Request a generous size so the square crop of a non-square avatar keeps enough resolution.
switch await mediaProvider.loadThumbnailForSource(source: mediaSource, size: .init(width: 256, height: 256)) {
case .success(let data):
if let squareData = Avatars.squareAvatarImageData(from: data) {
fetchedImage = INImage(imageData: squareData)
} else {
MXLog.error("Couldn't decode the fetched sender icon, using a placeholder.")
}
case .failure(let error):
MXLog.error("Couldn't add sender icon: \(error)")