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 {
|
private func immediateStatus(size: Int32?) -> MediaResourceStatus {
|
||||||
let status: 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 {
|
if let truncationSize = self.fileMap.truncationSize, self.fileMap.sum == truncationSize {
|
||||||
status = .Local
|
status = .Local
|
||||||
} else {
|
} else {
|
||||||
@ -650,6 +650,7 @@ final class MediaBoxPartialFile {
|
|||||||
if intervals.isEmpty {
|
if intervals.isEmpty {
|
||||||
if let (_, disposable) = self.currentFetch {
|
if let (_, disposable) = self.currentFetch {
|
||||||
self.currentFetch = nil
|
self.currentFetch = nil
|
||||||
|
self.updateStatuses()
|
||||||
disposable.dispose()
|
disposable.dispose()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -659,6 +660,7 @@ final class MediaBoxPartialFile {
|
|||||||
let promise = Promise<[(Range<Int>, MediaBoxFetchPriority)]>()
|
let promise = Promise<[(Range<Int>, MediaBoxFetchPriority)]>()
|
||||||
let disposable = MetaDisposable()
|
let disposable = MetaDisposable()
|
||||||
self.currentFetch = (promise, disposable)
|
self.currentFetch = (promise, disposable)
|
||||||
|
self.updateStatuses()
|
||||||
disposable.set((fetch(promise.get())
|
disposable.set((fetch(promise.get())
|
||||||
|> deliverOn(self.queue)).start(next: { [weak self] data in
|
|> deliverOn(self.queue)).start(next: { [weak self] data in
|
||||||
if let strongSelf = self {
|
if let strongSelf = self {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user