mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 22:55:00 +00:00
Fix more warnings
This commit is contained in:
@@ -72,20 +72,20 @@ public func chatControllerBackgroundImage(theme: PresentationTheme?, wallpaper i
|
||||
backgroundImage = UIImage(contentsOfFile: path)?.precomposed()
|
||||
}
|
||||
}
|
||||
case let .file(file):
|
||||
case let .file(_, _, _, _, _, _, _, file, settings):
|
||||
if wallpaper.isPattern {
|
||||
backgroundImage = nil
|
||||
} else {
|
||||
if file.settings.blur && composed {
|
||||
if settings.blur && composed {
|
||||
var image: UIImage?
|
||||
let _ = mediaBox.cachedResourceRepresentation(file.file.resource, representation: CachedBlurredWallpaperRepresentation(), complete: true, fetch: true, attemptSynchronously: true).start(next: { data in
|
||||
let _ = mediaBox.cachedResourceRepresentation(file.resource, representation: CachedBlurredWallpaperRepresentation(), complete: true, fetch: true, attemptSynchronously: true).start(next: { data in
|
||||
if data.complete {
|
||||
image = UIImage(contentsOfFile: data.path)?.precomposed()
|
||||
}
|
||||
})
|
||||
backgroundImage = image
|
||||
}
|
||||
if backgroundImage == nil, let path = mediaBox.completedResourcePath(file.file.resource) {
|
||||
if backgroundImage == nil, let path = mediaBox.completedResourcePath(file.resource) {
|
||||
succeed = false
|
||||
backgroundImage = UIImage(contentsOfFile: path)?.precomposed()
|
||||
}
|
||||
@@ -166,17 +166,17 @@ public func chatControllerBackgroundImageSignal(wallpaper: TelegramWallpaper, me
|
||||
}
|
||||
}
|
||||
}
|
||||
case let .file(file):
|
||||
case let .file(_, _, _, _, _, _, slug, file, settings):
|
||||
if wallpaper.isPattern {
|
||||
return .single((nil, true))
|
||||
} else {
|
||||
if file.settings.blur {
|
||||
if settings.blur {
|
||||
let representation = CachedBlurredWallpaperRepresentation()
|
||||
|
||||
if FileManager.default.fileExists(atPath: mediaBox.cachedRepresentationCompletePath(file.file.resource.id, representation: representation)) {
|
||||
if FileManager.default.fileExists(atPath: mediaBox.cachedRepresentationCompletePath(file.resource.id, representation: representation)) {
|
||||
let effectiveMediaBox = mediaBox
|
||||
|
||||
return effectiveMediaBox.cachedResourceRepresentation(file.file.resource, representation: representation, complete: true, fetch: true, attemptSynchronously: true)
|
||||
return effectiveMediaBox.cachedResourceRepresentation(file.resource, representation: representation, complete: true, fetch: true, attemptSynchronously: true)
|
||||
|> map { data -> (UIImage?, Bool)? in
|
||||
if data.complete {
|
||||
return (UIImage(contentsOfFile: data.path)?.precomposed(), true)
|
||||
@@ -189,17 +189,17 @@ public func chatControllerBackgroundImageSignal(wallpaper: TelegramWallpaper, me
|
||||
}
|
||||
} else {
|
||||
return Signal { subscriber in
|
||||
let fetch = fetchedMediaResource(mediaBox: accountMediaBox, reference: MediaResourceReference.wallpaper(wallpaper: WallpaperReference.slug(file.slug), resource: file.file.resource)).start()
|
||||
let fetch = fetchedMediaResource(mediaBox: accountMediaBox, reference: MediaResourceReference.wallpaper(wallpaper: WallpaperReference.slug(slug), resource: file.resource)).start()
|
||||
var didOutputBlurred = false
|
||||
let data = accountMediaBox.cachedResourceRepresentation(file.file.resource, representation: representation, complete: true, fetch: true, attemptSynchronously: true).start(next: { data in
|
||||
let data = accountMediaBox.cachedResourceRepresentation(file.resource, representation: representation, complete: true, fetch: true, attemptSynchronously: true).start(next: { data in
|
||||
if data.complete {
|
||||
if let image = UIImage(contentsOfFile: data.path)?.precomposed() {
|
||||
mediaBox.copyResourceData(file.file.resource.id, fromTempPath: data.path)
|
||||
mediaBox.copyResourceData(file.resource.id, fromTempPath: data.path)
|
||||
subscriber.putNext((image, true))
|
||||
}
|
||||
} else if !didOutputBlurred {
|
||||
didOutputBlurred = true
|
||||
if let immediateThumbnailData = file.file.immediateThumbnailData, let decodedData = decodeTinyThumbnail(data: immediateThumbnailData) {
|
||||
if let immediateThumbnailData = file.immediateThumbnailData, let decodedData = decodeTinyThumbnail(data: immediateThumbnailData) {
|
||||
if let image = UIImage(data: decodedData)?.precomposed() {
|
||||
subscriber.putNext((image, false))
|
||||
}
|
||||
@@ -215,9 +215,9 @@ public func chatControllerBackgroundImageSignal(wallpaper: TelegramWallpaper, me
|
||||
}
|
||||
} else {
|
||||
var path: String?
|
||||
if let maybePath = mediaBox.completedResourcePath(file.file.resource) {
|
||||
if let maybePath = mediaBox.completedResourcePath(file.resource) {
|
||||
path = maybePath
|
||||
} else if let maybePath = accountMediaBox.completedResourcePath(file.file.resource) {
|
||||
} else if let maybePath = accountMediaBox.completedResourcePath(file.resource) {
|
||||
path = maybePath
|
||||
}
|
||||
if let path = path {
|
||||
@@ -227,17 +227,17 @@ public func chatControllerBackgroundImageSignal(wallpaper: TelegramWallpaper, me
|
||||
}
|
||||
} else {
|
||||
return Signal { subscriber in
|
||||
let fetch = fetchedMediaResource(mediaBox: accountMediaBox, reference: MediaResourceReference.wallpaper(wallpaper: WallpaperReference.slug(file.slug), resource: file.file.resource)).start()
|
||||
let fetch = fetchedMediaResource(mediaBox: accountMediaBox, reference: MediaResourceReference.wallpaper(wallpaper: WallpaperReference.slug(slug), resource: file.resource)).start()
|
||||
var didOutputBlurred = false
|
||||
let data = accountMediaBox.resourceData(file.file.resource).start(next: { data in
|
||||
let data = accountMediaBox.resourceData(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)
|
||||
mediaBox.copyResourceData(file.resource.id, fromTempPath: data.path)
|
||||
subscriber.putNext((image, true))
|
||||
}
|
||||
} else if !didOutputBlurred {
|
||||
didOutputBlurred = true
|
||||
if let immediateThumbnailData = file.file.immediateThumbnailData, let decodedData = decodeTinyThumbnail(data: immediateThumbnailData) {
|
||||
if let immediateThumbnailData = file.immediateThumbnailData, let decodedData = decodeTinyThumbnail(data: immediateThumbnailData) {
|
||||
if let image = UIImage(data: decodedData)?.precomposed() {
|
||||
subscriber.putNext((image, false))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user