animations in emojirow

animated deleting/downloading emojis
stopped it glitching when downloading/deleting an emoji
removed refresh() and uiID cos its not necessary sob
moved downloadImage() to stickerprotocol extension
bundled an image so test emoji loading is faster
This commit is contained in:
neon443 committed 2026-03-08 22:38:14 +00:00
1 parent 7d83ae2101
commit ccaaa8e519
10 files changed
+77 -65

No files matched your search

+19
View File
@@ -33,6 +33,25 @@ extension StickerProtocol {
}
}
nonisolated
func downloadImage() async throws {
if let data = try? await Data(contentsOf: localImageURL),
let _ = UIImage(data: data) {
return
}
var (data, _) = try await URLSession.shared.data(from: remoteImageURL)
if let uiImage = UIImage(data: data),
let cgImage = uiImage.cgImage,
await !self.localImageURLString.contains(".gif"),
cgImage.width < 300 || cgImage.height < 300 {
data = await resize(image: uiImage, to: CGSize(width: 300, height: 300)).pngData()!
}
try! await data.write(to: localImageURL)
return
}
func deleteImage() {
try? FileManager.default.removeItem(at: localImageURL)
return
@@ -10,7 +10,6 @@ import Messages
protocol StickerProtocol: Codable, Identifiable, Hashable {
var id: UUID { get set }
var uiID: UUID { get set }
var name: String { get set }
var localImageURL: URL { get }
@@ -24,7 +23,6 @@ protocol StickerProtocol: Codable, Identifiable, Hashable {
func downloadImage() async throws
func deleteImage()
mutating func refresh()
func resize(image: UIImage, to targetSize: CGSize) -> UIImage
static var test: Self { get }
}
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.