mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-07-25 12:25:19 +00:00
Keep processed images for outgoing messages
This commit is contained in:
@@ -2449,12 +2449,6 @@ final class ChatViewModel: ObservableObject, BitchatDelegate {
|
||||
Task.detached(priority: .userInitiated) { [weak self] in
|
||||
guard let self = self else { return }
|
||||
var processedURL: URL?
|
||||
defer {
|
||||
if let url = processedURL {
|
||||
try? FileManager.default.removeItem(at: url)
|
||||
}
|
||||
cleanup?()
|
||||
}
|
||||
do {
|
||||
let outputURL = try ImageUtils.processImage(at: sourceURL)
|
||||
processedURL = outputURL
|
||||
@@ -2490,7 +2484,11 @@ final class ChatViewModel: ObservableObject, BitchatDelegate {
|
||||
await MainActor.run {
|
||||
self.addSystemMessage("Failed to prepare image for sending.")
|
||||
}
|
||||
if let url = processedURL {
|
||||
try? FileManager.default.removeItem(at: url)
|
||||
}
|
||||
}
|
||||
cleanup?()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user