mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-10-31 08:15:24 +00:00
Fix broken avatar aspect ratio in the share sheet and notifications
The media repo serves thumbnails with the scale method, so avatars keep their source aspect ratio. The system stretches whatever INImage we donate to fill a circle, distorting any non-square avatar in the share sheet's conversation suggestions (and notifications, which are donated the same image). Centre-crop donated avatars to a square before handing them to the system, in both the timeline's send message intent donation and the NSE's communication context.
This commit is contained in:
@@ -259,7 +259,9 @@ nonisolated struct NotificationContentBuilder {
|
||||
let mediaSource = icon.mediaSource {
|
||||
switch await mediaProvider.loadThumbnailForSource(source: mediaSource, size: .init(width: 100, height: 100)) {
|
||||
case .success(let data):
|
||||
fetchedImage = INImage(imageData: data)
|
||||
if let squareData = Avatars.squareAvatarImageData(from: data) {
|
||||
fetchedImage = INImage(imageData: squareData)
|
||||
}
|
||||
case .failure(let error):
|
||||
MXLog.error("Couldn't add sender icon: \(error)")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user