Wallpaper fixes

This commit is contained in:
Ali
2021-05-31 17:15:56 +04:00
parent 7e52c6c345
commit 9a364604c1
5 changed files with 48 additions and 41 deletions

View File

@@ -257,6 +257,23 @@ public func chatControllerBackgroundImageSignal(wallpaper: TelegramWallpaper, me
|> afterNext { image in
cacheWallpaper(image?.0)
}
} else {
return Signal { subscriber in
let fetch = fetchedMediaResource(mediaBox: accountMediaBox, reference: MediaResourceReference.standalone(resource: file.file.resource)).start()
let data = accountMediaBox.resourceData(file.file.resource).start(next: { data in
if data.complete {
if let image = UIImage(contentsOfFile: data.path)?.precomposed() {
mediaBox.copyResourceData(file.file.resource.id, fromTempPath: data.path)
subscriber.putNext((image, true))
}
}
})
return ActionDisposable {
fetch.dispose()
data.dispose()
}
}
}
}
}