mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
Various fixes
This commit is contained in:
@@ -36,6 +36,7 @@ final class PasscodeEntryControllerNode: ASDisplayNode {
|
||||
|
||||
private let modalPresentation: Bool
|
||||
|
||||
private let coverNode: ASDisplayNode
|
||||
private var backgroundCustomNode: ASDisplayNode?
|
||||
private let backgroundDimNode: ASDisplayNode
|
||||
private let backgroundImageNode: ASImageNode
|
||||
@@ -70,6 +71,9 @@ final class PasscodeEntryControllerNode: ASDisplayNode {
|
||||
self.arguments = arguments
|
||||
self.modalPresentation = modalPresentation
|
||||
|
||||
self.coverNode = ASDisplayNode()
|
||||
self.coverNode.backgroundColor = .black
|
||||
|
||||
self.backgroundImageNode = ASImageNode()
|
||||
self.backgroundImageNode.contentMode = .scaleToFill
|
||||
|
||||
@@ -140,6 +144,7 @@ final class PasscodeEntryControllerNode: ASDisplayNode {
|
||||
}
|
||||
}
|
||||
|
||||
self.addSubnode(self.coverNode)
|
||||
self.addSubnode(self.backgroundImageNode)
|
||||
self.addSubnode(self.backgroundDimNode)
|
||||
self.addSubnode(self.iconNode)
|
||||
@@ -238,8 +243,10 @@ final class PasscodeEntryControllerNode: ASDisplayNode {
|
||||
color3 = baseColor.withMultiplied(hue: 1.029, saturation: 0.729, brightness: 1.231)
|
||||
color4 = baseColor.withMultiplied(hue: 1.034, saturation: 0.583, brightness: 1.043)
|
||||
}
|
||||
self.coverNode.backgroundColor = color3
|
||||
self.background = CustomPasscodeBackground(size: size, colors: [color1, color2, color3, color4], inverted: false)
|
||||
case let .gradient(gradient):
|
||||
self.coverNode.backgroundColor = gradient.colors.first.flatMap { UIColor(rgb: $0) }
|
||||
self.background = CustomPasscodeBackground(size: size, colors: gradient.colors.compactMap { UIColor(rgb: $0) }, inverted: (gradient.settings.intensity ?? 0) < 0)
|
||||
case .image, .file:
|
||||
if let image = chatControllerBackgroundImage(theme: self.theme, wallpaper: self.wallpaper, mediaBox: self.accountManager.mediaBox, composed: false, knockoutMode: false) {
|
||||
@@ -252,6 +259,7 @@ final class PasscodeEntryControllerNode: ASDisplayNode {
|
||||
}
|
||||
}
|
||||
default:
|
||||
self.coverNode.backgroundColor = self.theme.passcode.backgroundColors.bottomColor
|
||||
self.background = GradientPasscodeBackground(size: size, backgroundColors: self.theme.passcode.backgroundColors.colors, buttonColor: self.theme.passcode.buttonColor)
|
||||
}
|
||||
|
||||
@@ -355,6 +363,8 @@ final class PasscodeEntryControllerNode: ASDisplayNode {
|
||||
}
|
||||
|
||||
func animateIn(iconFrame: CGRect, completion: @escaping () -> Void = {}) {
|
||||
self.coverNode.isHidden = true
|
||||
|
||||
let effect = self.theme.overallDarkAppearance ? UIBlurEffect(style: .dark) : UIBlurEffect(style: .light)
|
||||
UIView.animate(withDuration: 0.3, animations: {
|
||||
if #available(iOS 9.0, *) {
|
||||
@@ -386,6 +396,8 @@ final class PasscodeEntryControllerNode: ASDisplayNode {
|
||||
self.biometricButtonNode.isHidden = true
|
||||
|
||||
self.titleNode.setAttributedText(NSAttributedString(string: self.strings.Passcode_AppLockedAlert.replacingOccurrences(of: "\n", with: " "), font: titleFont, textColor: .white), animation: .slideIn, completion: {
|
||||
self.coverNode.isHidden = false
|
||||
|
||||
self.subtitleNode.isHidden = false
|
||||
self.inputFieldNode.isHidden = false
|
||||
self.keyboardNode.isHidden = false
|
||||
@@ -447,6 +459,10 @@ final class PasscodeEntryControllerNode: ASDisplayNode {
|
||||
self.validLayout = layout
|
||||
|
||||
self.updateBackground()
|
||||
|
||||
let maxSide = max(layout.size.width, layout.size.height)
|
||||
let coverSize = CGSize(width: maxSide, height: maxSide)
|
||||
self.coverNode.frame = CGRect(origin: CGPoint(x: round((layout.size.width - coverSize.width) / 2.0), y: round((layout.size.height - coverSize.height) / 2.0)), size: coverSize)
|
||||
|
||||
let bounds = CGRect(origin: CGPoint(), size: layout.size)
|
||||
transition.updateFrame(node: self.backgroundImageNode, frame: bounds)
|
||||
|
||||
Reference in New Issue
Block a user