updated resizing and gonna do gifs

fix crazy lag when changing pack name
fix ui sizing issue on stickerpicker
This commit is contained in:
neon443 committed 2026-05-02 11:25:04 +01:00
1 parent 7a40a84e82
commit fd8e7f1fe5
5 files changed
+41 -14

No files matched your search

+13 -7
View File
@@ -61,6 +61,7 @@ extension StickerProtocol {
nonisolated
func downloadImage() async throws {
let targetSize = CGSize(width: 500, height: 500)
if let data = try? await Data(contentsOf: localImageURL),
let _ = UIImage(data: data) {
return
@@ -68,15 +69,20 @@ extension StickerProtocol {
var (data, _) = try await URLSession.shared.data(from: remoteImageURL)
print(await GifManager.gifFrom(data: data).count)
if let uiImage = UIImage(data: data),
let cgImage = uiImage.cgImage,
await !self.localImageURLString.contains(".gif"),
cgImage.width < 500 || cgImage.height < 500 {
if await self.localImageURLString.suffix(4) == ".gif" {
} else {
data = await resize(image: uiImage, to: CGSize(width: 500, height: 500)).pngData()!
await GifManager.gifFrom(data: data).count == 1 {
data = await resize(image: uiImage, to: targetSize).pngData()!
} else {
var frames: [(frame: CGImage, showFor: Double)] = []
for frame in await GifManager.gifFrom(data: data) {
frames.append((
await resize(image: UIImage(cgImage: frame.frame), to: targetSize).cgImage!,
frame.showFor
))
}
data = await GifManager.dataFrom(frames: frames)!
}
try! await data.write(to: localImageURL)
return
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.