🐛 Scale down user image on ios notification extensions

This commit is contained in:
LittleSheep 2024-12-23 22:02:29 +08:00
parent 36a5b8fb39
commit 61032c84f1

View File

@ -80,7 +80,11 @@ class NotificationService: UNNotificationServiceExtension {
let metadataCopy = metadata as? [String: String] ?? [:] let metadataCopy = metadata as? [String: String] ?? [:]
let avatarUrl = getAttachmentUrl(for: avatarIdentifier) let avatarUrl = getAttachmentUrl(for: avatarIdentifier)
KingfisherManager.shared.retrieveImage(with: URL(string: avatarUrl)!, completionHandler: { result in
let targetSize = 640
let scaleProcessor = ResizingImageProcessor(referenceSize: CGSize(width: targetSize, height: targetSize), mode: .aspectFit)
KingfisherManager.shared.retrieveImage(with: URL(string: avatarUrl)!, options: [.processor(scaleProcessor)], completionHandler: { result in
var image: Data? var image: Data?
switch result { switch result {
case .success(let value): case .success(let value):