mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
[WIP]
This commit is contained in:
parent
dc7541065d
commit
1658089712
@ -1530,6 +1530,8 @@ private func extractAccountManagerState(records: AccountRecordsView<TelegramAcco
|
||||
}
|
||||
})
|
||||
|
||||
//self.addBackgroundDownloadTask()
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
@ -1664,7 +1666,21 @@ private func extractAccountManagerState(records: AccountRecordsView<TelegramAcco
|
||||
task.resume()
|
||||
}
|
||||
|
||||
private func addBackgroundDownloadTask() {
|
||||
let baseAppBundleId = Bundle.main.bundleIdentifier!
|
||||
let session = self.urlSession(identifier: "\(baseAppBundleId).backroundSession")
|
||||
|
||||
var request = URLRequest(url: URL(string: "https://example.com/\(UInt64.random(in: 0 ... UInt64.max))")!)
|
||||
request.httpMethod = "GET"
|
||||
|
||||
let task = session.downloadTask(with: request)
|
||||
Logger.shared.log("App \(self.episodeId)", "adding download task \(String(describing: request.url))")
|
||||
task.earliestBeginDate = Date(timeIntervalSinceNow: 30.0)
|
||||
task.resume()
|
||||
}
|
||||
|
||||
func urlSession(_ session: URLSession, task: URLSessionTask, didCompleteWithError error: Error?) {
|
||||
Logger.shared.log("App \(self.episodeId)", "completed download task \(String(describing: task.originalRequest?.url)) error: \(String(describing: error))")
|
||||
if let response = task.response as? HTTPURLResponse {
|
||||
if let originalRequest = task.originalRequest {
|
||||
if let requestResourceId = originalRequest.value(forHTTPHeaderField: "tresource") {
|
||||
|
Loading…
x
Reference in New Issue
Block a user