mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 14:45:21 +00:00
Combo update
This commit is contained in:
@@ -171,15 +171,13 @@ final class ChatMessageWebpageBubbleContentNode: ChatMessageBubbleContentNode {
|
||||
mediaAndFlags = (webpage.image ?? file, [.preferMediaBeforeText])
|
||||
}
|
||||
} else if webpage.type == "telegram_background" {
|
||||
var topColor: UIColor?
|
||||
var bottomColor: UIColor?
|
||||
var colors: [UInt32] = []
|
||||
var rotation: Int32?
|
||||
if let wallpaper = parseWallpaperUrl(webpage.url), case let .slug(_, _, firstColor, secondColor, intensity, rotationValue) = wallpaper {
|
||||
topColor = firstColor?.withAlphaComponent(CGFloat(intensity ?? 50) / 100.0)
|
||||
bottomColor = secondColor?.withAlphaComponent(CGFloat(intensity ?? 50) / 100.0)
|
||||
if let wallpaper = parseWallpaperUrl(webpage.url), case let .slug(_, _, colorsValue, intensity, rotationValue) = wallpaper {
|
||||
colors = colorsValue
|
||||
rotation = rotationValue
|
||||
}
|
||||
let media = WallpaperPreviewMedia(content: .file(file, topColor, bottomColor, rotation, false, false))
|
||||
let media = WallpaperPreviewMedia(content: .file(file, colors, rotation, false, false))
|
||||
mediaAndFlags = (media, [.preferMediaAspectFilled])
|
||||
if let fileSize = file.size {
|
||||
badge = dataSizeString(fileSize, formatting: DataSizeStringFormatting(chatPresentationData: item.presentationData))
|
||||
@@ -207,25 +205,24 @@ final class ChatMessageWebpageBubbleContentNode: ChatMessageBubbleContentNode {
|
||||
}
|
||||
} else if let type = webpage.type {
|
||||
if type == "telegram_background" {
|
||||
var topColor: UIColor?
|
||||
var colors: [UInt32] = []
|
||||
var bottomColor: UIColor?
|
||||
var rotation: Int32?
|
||||
if let wallpaper = parseWallpaperUrl(webpage.url) {
|
||||
if case let .color(color) = wallpaper {
|
||||
topColor = color
|
||||
} else if case let .gradient(topColorValue, bottomColorValue, rotationValue) = wallpaper {
|
||||
topColor = topColorValue
|
||||
bottomColor = bottomColorValue
|
||||
colors = [color.rgb]
|
||||
} else if case let .gradient(colorsValue, rotationValue) = wallpaper {
|
||||
colors = colorsValue
|
||||
rotation = rotationValue
|
||||
}
|
||||
}
|
||||
|
||||
var content: WallpaperPreviewMediaContent?
|
||||
if let topColor = topColor {
|
||||
if let bottomColor = bottomColor {
|
||||
content = .gradient(topColor, bottomColor, rotation)
|
||||
if !colors.isEmpty {
|
||||
if colors.count >= 2 {
|
||||
content = .gradient(colors, rotation)
|
||||
} else {
|
||||
content = .color(topColor)
|
||||
content = .color(UIColor(rgb: colors[0]))
|
||||
}
|
||||
}
|
||||
if let content = content {
|
||||
@@ -254,7 +251,7 @@ final class ChatMessageWebpageBubbleContentNode: ChatMessageBubbleContentNode {
|
||||
file = contentFile
|
||||
}
|
||||
if let file = file {
|
||||
let media = WallpaperPreviewMedia(content: .file(file, nil, nil, nil, true, isSupported))
|
||||
let media = WallpaperPreviewMedia(content: .file(file, [], nil, true, isSupported))
|
||||
mediaAndFlags = (media, ChatMessageAttachedContentNodeMediaFlags())
|
||||
} else if let settings = settings {
|
||||
let media = WallpaperPreviewMedia(content: .themeSettings(settings))
|
||||
|
||||
Reference in New Issue
Block a user