mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 14:45:21 +00:00
Memory management issues
This commit is contained in:
@@ -92,7 +92,7 @@ private final class PrefetchManagerInnerImpl {
|
||||
}
|
||||
|
||||
self.listDisposable = (combineLatest(orderedPreloadMedia, sharedContext.automaticMediaDownloadSettings, networkType)
|
||||
|> deliverOn(self.queue)).start(next: { [weak self] orderedPreloadMedia, automaticDownloadSettings, networkType in
|
||||
|> deliverOn(self.queue)).startStrict(next: { [weak self] orderedPreloadMedia, automaticDownloadSettings, networkType in
|
||||
self?.updateOrderedPreloadMedia(orderedPreloadMedia, automaticDownloadSettings: automaticDownloadSettings, networkType: networkType)
|
||||
})
|
||||
}
|
||||
@@ -172,16 +172,16 @@ private final class PrefetchManagerInnerImpl {
|
||||
|
||||
if case .full = automaticDownload {
|
||||
if let image = media as? TelegramMediaImage {
|
||||
context.fetchDisposable.set(messageMediaImageInteractiveFetched(fetchManager: self.fetchManager, messageId: mediaItem.media.index.id, messageReference: MessageReference(peer: mediaItem.media.peer, author: nil, id: mediaItem.media.index.id, timestamp: mediaItem.media.index.timestamp, incoming: true, secret: false), image: image, resource: resource._asResource(), userInitiated: false, priority: priority, storeToDownloadsPeerId: nil).start())
|
||||
context.fetchDisposable.set(messageMediaImageInteractiveFetched(fetchManager: self.fetchManager, messageId: mediaItem.media.index.id, messageReference: MessageReference(peer: mediaItem.media.peer, author: nil, id: mediaItem.media.index.id, timestamp: mediaItem.media.index.timestamp, incoming: true, secret: false), image: image, resource: resource._asResource(), userInitiated: false, priority: priority, storeToDownloadsPeerId: nil).startStrict())
|
||||
} else if let _ = media as? TelegramMediaWebFile {
|
||||
//strongSelf.fetchDisposable.set(chatMessageWebFileInteractiveFetched(account: context.account, image: image).start())
|
||||
//strongSelf.fetchDisposable.set(chatMessageWebFileInteractiveFetched(account: context.account, image: image).startStrict())
|
||||
} else if let file = media as? TelegramMediaFile {
|
||||
let fetchSignal = messageMediaFileInteractiveFetched(fetchManager: self.fetchManager, messageId: mediaItem.media.index.id, messageReference: MessageReference(peer: mediaItem.media.peer, author: nil, id: mediaItem.media.index.id, timestamp: mediaItem.media.index.timestamp, incoming: true, secret: false), file: file, userInitiated: false, priority: priority)
|
||||
context.fetchDisposable.set(fetchSignal.start())
|
||||
context.fetchDisposable.set(fetchSignal.startStrict())
|
||||
}
|
||||
} else if case .prefetch = automaticDownload, mediaItem.media.peer.id.namespace != Namespaces.Peer.SecretChat {
|
||||
if let file = media as? TelegramMediaFile, let _ = file.size {
|
||||
context.fetchDisposable.set(preloadVideoResource(postbox: self.account.postbox, userLocation: .peer(mediaItem.media.index.id.peerId), userContentType: MediaResourceUserContentType(file: file), resourceReference: FileMediaReference.message(message: MessageReference(peer: mediaItem.media.peer, author: nil, id: mediaItem.media.index.id, timestamp: mediaItem.media.index.timestamp, incoming: true, secret: false), media: file).resourceReference(file.resource), duration: 4.0).start())
|
||||
context.fetchDisposable.set(preloadVideoResource(postbox: self.account.postbox, userLocation: .peer(mediaItem.media.index.id.peerId), userContentType: MediaResourceUserContentType(file: file), resourceReference: FileMediaReference.message(message: MessageReference(peer: mediaItem.media.peer, author: nil, id: mediaItem.media.index.id, timestamp: mediaItem.media.index.timestamp, incoming: true, secret: false), media: file).resourceReference(file.resource), duration: 4.0).startStrict())
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -216,7 +216,7 @@ private final class PrefetchManagerInnerImpl {
|
||||
|
||||
if case .full = automaticDownload {
|
||||
let fetchSignal = freeMediaFileInteractiveFetched(fetchManager: self.fetchManager, fileReference: .standalone(media: media), priority: priority)
|
||||
context.fetchDisposable.set(fetchSignal.start())
|
||||
context.fetchDisposable.set(fetchSignal.startStrict())
|
||||
}
|
||||
|
||||
order += 1
|
||||
@@ -258,7 +258,7 @@ private final class PrefetchManagerInnerImpl {
|
||||
} else {
|
||||
return .complete()
|
||||
}
|
||||
}).start())
|
||||
}).startStrict())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user