From 61032c84f1029baf18c2766cf8a12c8754eee6ad Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Mon, 23 Dec 2024 22:02:29 +0800 Subject: [PATCH] :bug: Scale down user image on ios notification extensions --- ios/SolarNotifyService/NotificationService.swift | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ios/SolarNotifyService/NotificationService.swift b/ios/SolarNotifyService/NotificationService.swift index 262284f..af5d1a6 100644 --- a/ios/SolarNotifyService/NotificationService.swift +++ b/ios/SolarNotifyService/NotificationService.swift @@ -80,7 +80,11 @@ class NotificationService: UNNotificationServiceExtension { let metadataCopy = metadata as? [String: String] ?? [:] 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? switch result { case .success(let value):