the file extension not working thing
if "" is searched, returning empty
This commit is contained in:
neon443 committed 2025-10-29 16:36:27 +00:00
1 parent 002fc21308
commit 3de0479fd0
2 files changed
+5 -13

No files matched your search

+4 -12
View File
@@ -14,7 +14,10 @@ struct Emoji: Codable, Identifiable, Hashable {
var uiID: UUID = UUID()
var name: String
var localImageURL: URL {
return EmojiHoarder.container.appendingPathComponent(id.uuidString, conformingTo: .image)
let urlString = remoteImageURL.absoluteString
let split = urlString.split(separator: ".")
let fileExtension = ".\(split.last ?? "png")"
return EmojiHoarder.container.appendingPathComponent(id.uuidString+fileExtension, conformingTo: .image)
}
var remoteImageURL: URL
@@ -51,17 +54,6 @@ struct Emoji: Codable, Identifiable, Hashable {
self.id = id
self.name = apiEmoji.name
self.remoteImageURL = apiEmoji.url
let fileExtension = String(apiEmoji.urlString.split(separator: ".").last ?? "png")
// self.localImageURL = EmojiHoarder.container.appendingPathComponent(id.uuidString+"."+fileExtension, conformingTo: .image)
// Task { [weak self] in
// let (data, response) = try await URLSession.shared.data(from: apiEmoji.url)
// self.image = UIImage(data: data)
// }
// let image = try! Data(contentsOf: apiEmoji.url)
// try! image.write(to: localImageURL)
// self.image = UIImage(data: image) ?? UIImage()
}
func downloadImage() async throws -> UIImage {
+1 -1
View File
@@ -75,7 +75,7 @@ class EmojiHoarder: ObservableObject {
func filterEmojis(by searchTerm: String) {
guard !searchTerm.isEmpty else {
self.filteredEmojis = []
self.filteredEmojis = emojis
return
}
Task {
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.