mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-10-09 03:20:48 +00:00
Mark file as pending if it has pending fetch
This commit is contained in:
parent
e1432e4171
commit
9eee3f16ac
@ -599,7 +599,7 @@ final class MediaBoxPartialFile {
|
||||
|
||||
private func immediateStatus(size: Int32?) -> MediaResourceStatus {
|
||||
let status: MediaResourceStatus
|
||||
if self.fullRangeRequests.isEmpty {
|
||||
if self.fullRangeRequests.isEmpty && self.currentFetch == nil {
|
||||
if let truncationSize = self.fileMap.truncationSize, self.fileMap.sum == truncationSize {
|
||||
status = .Local
|
||||
} else {
|
||||
@ -650,6 +650,7 @@ final class MediaBoxPartialFile {
|
||||
if intervals.isEmpty {
|
||||
if let (_, disposable) = self.currentFetch {
|
||||
self.currentFetch = nil
|
||||
self.updateStatuses()
|
||||
disposable.dispose()
|
||||
}
|
||||
} else {
|
||||
@ -659,6 +660,7 @@ final class MediaBoxPartialFile {
|
||||
let promise = Promise<[(Range<Int>, MediaBoxFetchPriority)]>()
|
||||
let disposable = MetaDisposable()
|
||||
self.currentFetch = (promise, disposable)
|
||||
self.updateStatuses()
|
||||
disposable.set((fetch(promise.get())
|
||||
|> deliverOn(self.queue)).start(next: { [weak self] data in
|
||||
if let strongSelf = self {
|
||||
|
Loading…
x
Reference in New Issue
Block a user