Adjust inverted pattern presentation

This commit is contained in:
Ali 2021-06-16 12:36:08 +04:00
parent c80bc87fea
commit 9561771c5f
2 changed files with 19 additions and 0 deletions

View File

@ -20,6 +20,12 @@ public func dateFillNeedsBlur(theme: PresentationTheme, wallpaper: TelegramWallp
return false
} else if case .color = wallpaper {
return false
} else if case let .file(_, _, _, _, isPattern, _, _, _, settings) = wallpaper {
if isPattern, let intensity = settings.intensity, intensity < 0 {
return false
} else {
return true
}
} else {
return true
}

View File

@ -112,10 +112,14 @@ public final class WallpaperBackgroundNode: ASDisplayNode {
needsCleanBackground = true
}
var isInvertedGradient = false
var hasComplexGradient = false
switch wallpaper {
case let .file(_, _, _, _, _, _, _, _, settings):
hasComplexGradient = settings.colors.count >= 3
if let intensity = settings.intensity, intensity < 0 {
isInvertedGradient = true
}
case let .gradient(_, colors, _):
hasComplexGradient = colors.count >= 3
default:
@ -125,6 +129,15 @@ public final class WallpaperBackgroundNode: ASDisplayNode {
var needsGradientBackground = false
var needsWallpaperBackground = false
if isInvertedGradient {
switch self.bubbleType {
case .free:
needsCleanBackground = false
case .incoming, .outgoing:
break
}
}
if needsCleanBackground {
if hasComplexGradient {
needsGradientBackground = backgroundNode.gradientBackgroundNode != nil