mirror of
https://github.com/neon443/StickerSlack.git
synced 2026-11-30 12:44:51 +00:00
uikit imageview for plainemojicell
need to do gifs, but ts looking good tbh some other stuff lowk forgot
This commit is contained in:
6 files changed
+127
-32
No files matched your search
@@ -38,10 +38,26 @@ extension StickerProtocol {
|
||||
return try? MSSticker(contentsOfFileURL: localImageURL, localizedDescription: name)
|
||||
}
|
||||
|
||||
var isLocal: Bool {
|
||||
nonisolated var isLocal: Bool {
|
||||
return FileManager.default.fileExists(atPath: localImageURLString)
|
||||
}
|
||||
|
||||
nonisolated func data() async -> Data? {
|
||||
var result: (data: Data, response: URLResponse)
|
||||
do {
|
||||
result = try await URLSession.shared.data(from: isLocal ? localImageURL : remoteImageURL)
|
||||
} catch {
|
||||
print(error.localizedDescription)
|
||||
return nil
|
||||
}
|
||||
return result.data
|
||||
}
|
||||
|
||||
nonisolated func image() async -> UIImage? {
|
||||
guard let data = await data() else { return nil }
|
||||
return UIImage(data: data)
|
||||
}
|
||||
|
||||
var image: UIImage? {
|
||||
if FileManager.default.fileExists(atPath: localImageURLString),
|
||||
let data = try? Data(contentsOf: localImageURL),
|
||||
@@ -52,7 +68,7 @@ extension StickerProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
var type: StickerType {
|
||||
nonisolated var type: StickerType {
|
||||
let typeOfSelf = Swift.type(of: self)
|
||||
if typeOfSelf == Emoji.self {
|
||||
return .slackEmoji
|
||||
|
||||