From 3ecee6101388d3ee88787d2dabafb9be19b71d0b Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Wed, 20 Mar 2024 12:29:10 -0400 Subject: [PATCH] Fix Save to Photos UIActivity icon being stretched --- Tusker/Activities/SaveToPhotosActivity.swift | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Tusker/Activities/SaveToPhotosActivity.swift b/Tusker/Activities/SaveToPhotosActivity.swift index 6bc802da..b4bb99ac 100644 --- a/Tusker/Activities/SaveToPhotosActivity.swift +++ b/Tusker/Activities/SaveToPhotosActivity.swift @@ -23,7 +23,14 @@ class SaveToPhotosActivity: UIActivity { return "Save to Photos" } override var activityImage: UIImage? { - UIImage(systemName: "square.and.arrow.down") + // Just using the symbol image directly causes it to be stretched. + let symbol = UIImage(systemName: "square.and.arrow.down", withConfiguration: UIImage.SymbolConfiguration(scale: .large))! + let format = UIGraphicsImageRendererFormat() + format.scale = UIScreen.main.scale + return UIGraphicsImageRenderer(size: CGSize(width: 76, height: 76), format: format).image { ctx in + let rect = AVMakeRect(aspectRatio: symbol.size, insideRect: CGRect(x: 0, y: 0, width: 76, height: 76)) + symbol.draw(in: rect) + } } override func canPerform(withActivityItems activityItems: [Any]) -> Bool {