mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
Link preview temp files.
This commit is contained in:
parent
186e4e14d2
commit
f73f100717
1 changed files with 15 additions and 5 deletions
|
@ -31,6 +31,15 @@ public class OWSLinkPreviewDraft: NSObject {
|
|||
super.init()
|
||||
}
|
||||
|
||||
deinit {
|
||||
// Eagerly clean up temp files.
|
||||
if let imageFilePath = imageFilePath {
|
||||
DispatchQueue.main.async {
|
||||
OWSFileSystem.deleteFile(imageFilePath)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fileprivate func isValid() -> Bool {
|
||||
var hasTitle = false
|
||||
if let titleValue = title {
|
||||
|
@ -462,11 +471,12 @@ public class OWSLinkPreview: MTLModel {
|
|||
|
||||
Logger.verbose("url: \(url)")
|
||||
|
||||
guard let sessionManager: AFHTTPSessionManager = ContentProxy.sessionManager(baseUrl: nil) else {
|
||||
owsFailDebug("Couldn't create session manager.")
|
||||
completion(nil)
|
||||
return
|
||||
}
|
||||
let sessionConfiguration = ContentProxy.sessionConfiguration()
|
||||
// Don't use any caching.
|
||||
sessionConfiguration.requestCachePolicy = .reloadIgnoringLocalCacheData
|
||||
sessionConfiguration.urlCache = nil
|
||||
let sessionManager = AFHTTPSessionManager(baseURL: nil,
|
||||
sessionConfiguration: sessionConfiguration)
|
||||
sessionManager.requestSerializer = AFHTTPRequestSerializer()
|
||||
sessionManager.responseSerializer = AFHTTPResponseSerializer()
|
||||
|
||||
|
|
Loading…
Reference in a new issue