mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-11-07 17:30:12 +00:00
Merge branch 'beta'
This commit is contained in:
commit
dddc38ec3e
@ -1083,7 +1083,7 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
|
|||||||
let layoutOffset: CGFloat = 0.0
|
let layoutOffset: CGFloat = 0.0
|
||||||
|
|
||||||
let rawContentOriginX = 2.0
|
let rawContentOriginX = 2.0
|
||||||
let rawContentWidth = params.width - leftInset - params.rightInset - 10.0 - reorderInset
|
let rawContentWidth = params.width - leftInset - params.rightInset - 10.0 - editingOffset
|
||||||
|
|
||||||
let (dateLayout, dateApply) = dateLayout(TextNodeLayoutArguments(attributedString: dateAttributedString, backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: rawContentWidth, height: CGFloat.greatestFiniteMagnitude), alignment: .natural, cutout: nil, insets: UIEdgeInsets()))
|
let (dateLayout, dateApply) = dateLayout(TextNodeLayoutArguments(attributedString: dateAttributedString, backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: rawContentWidth, height: CGFloat.greatestFiniteMagnitude), alignment: .natural, cutout: nil, insets: UIEdgeInsets()))
|
||||||
|
|
||||||
|
|||||||
@ -36,14 +36,14 @@ public final class TwoFactorDataInputScreen: ViewController {
|
|||||||
let defaultTheme = NavigationBarTheme(rootControllerTheme: self.presentationData.theme)
|
let defaultTheme = NavigationBarTheme(rootControllerTheme: self.presentationData.theme)
|
||||||
let navigationBarTheme = NavigationBarTheme(buttonColor: defaultTheme.buttonColor, disabledButtonColor: defaultTheme.disabledButtonColor, primaryTextColor: defaultTheme.primaryTextColor, backgroundColor: .clear, separatorColor: .clear, badgeBackgroundColor: defaultTheme.badgeBackgroundColor, badgeStrokeColor: defaultTheme.badgeStrokeColor, badgeTextColor: defaultTheme.badgeTextColor)
|
let navigationBarTheme = NavigationBarTheme(buttonColor: defaultTheme.buttonColor, disabledButtonColor: defaultTheme.disabledButtonColor, primaryTextColor: defaultTheme.primaryTextColor, backgroundColor: .clear, separatorColor: .clear, badgeBackgroundColor: defaultTheme.badgeBackgroundColor, badgeStrokeColor: defaultTheme.badgeStrokeColor, badgeTextColor: defaultTheme.badgeTextColor)
|
||||||
|
|
||||||
super.init(navigationBarPresentationData: NavigationBarPresentationData(theme: navigationBarTheme, strings: NavigationBarStrings(back: self.presentationData.strings.Wallet_Navigation_Back, close: self.presentationData.strings.Wallet_Navigation_Close)))
|
super.init(navigationBarPresentationData: NavigationBarPresentationData(theme: navigationBarTheme, strings: NavigationBarStrings(back: self.presentationData.strings.Common_Back, close: self.presentationData.strings.Common_Close)))
|
||||||
|
|
||||||
self.statusBar.statusBarStyle = self.presentationData.theme.rootController.statusBarStyle.style
|
self.statusBar.statusBarStyle = self.presentationData.theme.rootController.statusBarStyle.style
|
||||||
self.navigationPresentation = .modalInLargeLayout
|
self.navigationPresentation = .modalInLargeLayout
|
||||||
self.supportedOrientations = ViewControllerSupportedOrientations(regularSize: .all, compactSize: .portrait)
|
self.supportedOrientations = ViewControllerSupportedOrientations(regularSize: .all, compactSize: .portrait)
|
||||||
self.navigationBar?.intrinsicCanTransitionInline = false
|
self.navigationBar?.intrinsicCanTransitionInline = false
|
||||||
|
|
||||||
self.navigationItem.backBarButtonItem = UIBarButtonItem(title: self.presentationData.strings.Wallet_Navigation_Back, style: .plain, target: nil, action: nil)
|
self.navigationItem.backBarButtonItem = UIBarButtonItem(title: self.presentationData.strings.Common_Back, style: .plain, target: nil, action: nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
required init(coder aDecoder: NSCoder) {
|
required init(coder aDecoder: NSCoder) {
|
||||||
|
|||||||
@ -30,14 +30,14 @@ public final class TwoFactorAuthSplashScreen: ViewController {
|
|||||||
let defaultTheme = NavigationBarTheme(rootControllerTheme: self.presentationData.theme)
|
let defaultTheme = NavigationBarTheme(rootControllerTheme: self.presentationData.theme)
|
||||||
let navigationBarTheme = NavigationBarTheme(buttonColor: defaultTheme.buttonColor, disabledButtonColor: defaultTheme.disabledButtonColor, primaryTextColor: defaultTheme.primaryTextColor, backgroundColor: .clear, separatorColor: .clear, badgeBackgroundColor: defaultTheme.badgeBackgroundColor, badgeStrokeColor: defaultTheme.badgeStrokeColor, badgeTextColor: defaultTheme.badgeTextColor)
|
let navigationBarTheme = NavigationBarTheme(buttonColor: defaultTheme.buttonColor, disabledButtonColor: defaultTheme.disabledButtonColor, primaryTextColor: defaultTheme.primaryTextColor, backgroundColor: .clear, separatorColor: .clear, badgeBackgroundColor: defaultTheme.badgeBackgroundColor, badgeStrokeColor: defaultTheme.badgeStrokeColor, badgeTextColor: defaultTheme.badgeTextColor)
|
||||||
|
|
||||||
super.init(navigationBarPresentationData: NavigationBarPresentationData(theme: navigationBarTheme, strings: NavigationBarStrings(back: self.presentationData.strings.Wallet_Intro_NotNow, close: self.presentationData.strings.Wallet_Navigation_Close)))
|
super.init(navigationBarPresentationData: NavigationBarPresentationData(theme: navigationBarTheme, strings: NavigationBarStrings(back: self.presentationData.strings.Common_Back, close: self.presentationData.strings.Common_Close)))
|
||||||
|
|
||||||
self.statusBar.statusBarStyle = self.presentationData.theme.rootController.statusBarStyle.style
|
self.statusBar.statusBarStyle = self.presentationData.theme.rootController.statusBarStyle.style
|
||||||
self.navigationPresentation = .modalInLargeLayout
|
self.navigationPresentation = .modalInLargeLayout
|
||||||
self.supportedOrientations = ViewControllerSupportedOrientations(regularSize: .all, compactSize: .portrait)
|
self.supportedOrientations = ViewControllerSupportedOrientations(regularSize: .all, compactSize: .portrait)
|
||||||
self.navigationBar?.intrinsicCanTransitionInline = false
|
self.navigationBar?.intrinsicCanTransitionInline = false
|
||||||
|
|
||||||
self.navigationItem.backBarButtonItem = UIBarButtonItem(title: self.presentationData.strings.Wallet_Navigation_Back, style: .plain, target: nil, action: nil)
|
self.navigationItem.backBarButtonItem = UIBarButtonItem(title: self.presentationData.strings.Common_Back, style: .plain, target: nil, action: nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
required init(coder aDecoder: NSCoder) {
|
required init(coder aDecoder: NSCoder) {
|
||||||
|
|||||||
@ -13,7 +13,7 @@ public enum SemanticStatusNodeState: Equatable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private protocol SemanticStatusNodeStateDrawingState: NSObjectProtocol {
|
private protocol SemanticStatusNodeStateDrawingState: NSObjectProtocol {
|
||||||
func draw(context: CGContext, size: CGSize)
|
func draw(context: CGContext, size: CGSize, foregroundColor: UIColor)
|
||||||
}
|
}
|
||||||
|
|
||||||
private protocol SemanticStatusNodeStateContext: class {
|
private protocol SemanticStatusNodeStateContext: class {
|
||||||
@ -75,15 +75,21 @@ private final class SemanticStatusNodeIconContext: SemanticStatusNodeStateContex
|
|||||||
super.init()
|
super.init()
|
||||||
}
|
}
|
||||||
|
|
||||||
func draw(context: CGContext, size: CGSize) {
|
func draw(context: CGContext, size: CGSize, foregroundColor: UIColor) {
|
||||||
context.saveGState()
|
context.saveGState()
|
||||||
context.translateBy(x: size.width / 2.0, y: size.height / 2.0)
|
context.translateBy(x: size.width / 2.0, y: size.height / 2.0)
|
||||||
context.scaleBy(x: max(0.01, self.transitionFraction), y: max(0.01, self.transitionFraction))
|
context.scaleBy(x: max(0.01, self.transitionFraction), y: max(0.01, self.transitionFraction))
|
||||||
context.translateBy(x: -size.width / 2.0, y: -size.height / 2.0)
|
context.translateBy(x: -size.width / 2.0, y: -size.height / 2.0)
|
||||||
|
|
||||||
context.setBlendMode(.destinationOut)
|
if foregroundColor.alpha.isZero {
|
||||||
context.setFillColor(UIColor(white: 0.0, alpha: self.transitionFraction).cgColor)
|
context.setBlendMode(.destinationOut)
|
||||||
context.setStrokeColor(UIColor(white: 0.0, alpha: self.transitionFraction).cgColor)
|
context.setFillColor(UIColor(white: 0.0, alpha: self.transitionFraction).cgColor)
|
||||||
|
context.setStrokeColor(UIColor(white: 0.0, alpha: self.transitionFraction).cgColor)
|
||||||
|
} else {
|
||||||
|
context.setBlendMode(.normal)
|
||||||
|
context.setFillColor(foregroundColor.withAlphaComponent(foregroundColor.alpha * self.transitionFraction).cgColor)
|
||||||
|
context.setStrokeColor(foregroundColor.withAlphaComponent(foregroundColor.alpha * self.transitionFraction).cgColor)
|
||||||
|
}
|
||||||
|
|
||||||
switch self.icon {
|
switch self.icon {
|
||||||
case .none:
|
case .none:
|
||||||
@ -229,14 +235,22 @@ private final class SemanticStatusNodeProgressContext: SemanticStatusNodeStateCo
|
|||||||
super.init()
|
super.init()
|
||||||
}
|
}
|
||||||
|
|
||||||
func draw(context: CGContext, size: CGSize) {
|
func draw(context: CGContext, size: CGSize, foregroundColor: UIColor) {
|
||||||
let diameter = size.width
|
let diameter = size.width
|
||||||
|
|
||||||
let factor = diameter / 50.0
|
let factor = diameter / 50.0
|
||||||
|
|
||||||
context.saveGState()
|
context.saveGState()
|
||||||
context.setBlendMode(.destinationOut)
|
|
||||||
context.setStrokeColor(UIColor(white: 0.0, alpha: self.transitionFraction).cgColor)
|
if foregroundColor.alpha.isZero {
|
||||||
|
context.setBlendMode(.destinationOut)
|
||||||
|
context.setFillColor(UIColor(white: 0.0, alpha: self.transitionFraction).cgColor)
|
||||||
|
context.setStrokeColor(UIColor(white: 0.0, alpha: self.transitionFraction).cgColor)
|
||||||
|
} else {
|
||||||
|
context.setBlendMode(.normal)
|
||||||
|
context.setFillColor(foregroundColor.withAlphaComponent(foregroundColor.alpha * self.transitionFraction).cgColor)
|
||||||
|
context.setStrokeColor(foregroundColor.withAlphaComponent(foregroundColor.alpha * self.transitionFraction).cgColor)
|
||||||
|
}
|
||||||
|
|
||||||
var progress = self.value ?? 0.1
|
var progress = self.value ?? 0.1
|
||||||
var startAngle = -CGFloat.pi / 2.0
|
var startAngle = -CGFloat.pi / 2.0
|
||||||
@ -270,8 +284,15 @@ private final class SemanticStatusNodeProgressContext: SemanticStatusNodeStateCo
|
|||||||
context.restoreGState()
|
context.restoreGState()
|
||||||
|
|
||||||
if self.displayCancel {
|
if self.displayCancel {
|
||||||
context.setBlendMode(.destinationOut)
|
if foregroundColor.alpha.isZero {
|
||||||
context.setStrokeColor(UIColor(white: 0.0, alpha: self.transitionFraction).cgColor)
|
context.setBlendMode(.destinationOut)
|
||||||
|
context.setFillColor(UIColor(white: 0.0, alpha: self.transitionFraction).cgColor)
|
||||||
|
context.setStrokeColor(UIColor(white: 0.0, alpha: self.transitionFraction).cgColor)
|
||||||
|
} else {
|
||||||
|
context.setBlendMode(.normal)
|
||||||
|
context.setFillColor(foregroundColor.withAlphaComponent(foregroundColor.alpha * self.transitionFraction).cgColor)
|
||||||
|
context.setStrokeColor(foregroundColor.withAlphaComponent(foregroundColor.alpha * self.transitionFraction).cgColor)
|
||||||
|
}
|
||||||
|
|
||||||
context.saveGState()
|
context.saveGState()
|
||||||
context.translateBy(x: size.width / 2.0, y: size.height / 2.0)
|
context.translateBy(x: size.width / 2.0, y: size.height / 2.0)
|
||||||
@ -388,11 +409,13 @@ private final class SemanticStatusNodeTransitionDrawingState {
|
|||||||
|
|
||||||
private final class SemanticStatusNodeDrawingState: NSObject {
|
private final class SemanticStatusNodeDrawingState: NSObject {
|
||||||
let background: UIColor
|
let background: UIColor
|
||||||
|
let foreground: UIColor
|
||||||
let transitionState: SemanticStatusNodeTransitionDrawingState?
|
let transitionState: SemanticStatusNodeTransitionDrawingState?
|
||||||
let drawingState: SemanticStatusNodeStateDrawingState
|
let drawingState: SemanticStatusNodeStateDrawingState
|
||||||
|
|
||||||
init(background: UIColor, transitionState: SemanticStatusNodeTransitionDrawingState?, drawingState: SemanticStatusNodeStateDrawingState) {
|
init(background: UIColor, foreground: UIColor, transitionState: SemanticStatusNodeTransitionDrawingState?, drawingState: SemanticStatusNodeStateDrawingState) {
|
||||||
self.background = background
|
self.background = background
|
||||||
|
self.foreground = foreground
|
||||||
self.transitionState = transitionState
|
self.transitionState = transitionState
|
||||||
self.drawingState = drawingState
|
self.drawingState = drawingState
|
||||||
|
|
||||||
@ -421,14 +444,21 @@ public final class SemanticStatusNode: ASControlNode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public var foregroundNodeColor: UIColor {
|
||||||
|
didSet {
|
||||||
|
self.setNeedsDisplay()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private var animator: ConstantDisplayLinkAnimator?
|
private var animator: ConstantDisplayLinkAnimator?
|
||||||
|
|
||||||
public private(set) var state: SemanticStatusNodeState
|
public private(set) var state: SemanticStatusNodeState
|
||||||
private var transtionContext: SemanticStatusNodeTransitionContext?
|
private var transtionContext: SemanticStatusNodeTransitionContext?
|
||||||
private var stateContext: SemanticStatusNodeStateContext
|
private var stateContext: SemanticStatusNodeStateContext
|
||||||
|
|
||||||
public init(backgroundNodeColor: UIColor) {
|
public init(backgroundNodeColor: UIColor, foregroundNodeColor: UIColor) {
|
||||||
self.backgroundNodeColor = backgroundNodeColor
|
self.backgroundNodeColor = backgroundNodeColor
|
||||||
|
self.foregroundNodeColor = foregroundNodeColor
|
||||||
self.state = .none
|
self.state = .none
|
||||||
self.stateContext = self.state.context(current: nil)
|
self.stateContext = self.state.context(current: nil)
|
||||||
|
|
||||||
@ -505,7 +535,7 @@ public final class SemanticStatusNode: ASControlNode {
|
|||||||
transitionState = SemanticStatusNodeTransitionDrawingState(transition: t, drawingState: transitionContext.previousStateContext.drawingState(transitionFraction: 1.0 - t))
|
transitionState = SemanticStatusNodeTransitionDrawingState(transition: t, drawingState: transitionContext.previousStateContext.drawingState(transitionFraction: 1.0 - t))
|
||||||
}
|
}
|
||||||
|
|
||||||
return SemanticStatusNodeDrawingState(background: self.backgroundNodeColor, transitionState: transitionState, drawingState: self.stateContext.drawingState(transitionFraction: transitionFraction))
|
return SemanticStatusNodeDrawingState(background: self.backgroundNodeColor, foreground: self.foregroundNodeColor, transitionState: transitionState, drawingState: self.stateContext.drawingState(transitionFraction: transitionFraction))
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc override public class func draw(_ bounds: CGRect, withParameters parameters: Any?, isCancelled: () -> Bool, isRasterizing: Bool) {
|
@objc override public class func draw(_ bounds: CGRect, withParameters parameters: Any?, isCancelled: () -> Bool, isRasterizing: Bool) {
|
||||||
@ -524,8 +554,8 @@ public final class SemanticStatusNode: ASControlNode {
|
|||||||
context.setFillColor(parameters.background.cgColor)
|
context.setFillColor(parameters.background.cgColor)
|
||||||
context.fillEllipse(in: CGRect(origin: CGPoint(), size: bounds.size))
|
context.fillEllipse(in: CGRect(origin: CGPoint(), size: bounds.size))
|
||||||
if let transitionState = parameters.transitionState {
|
if let transitionState = parameters.transitionState {
|
||||||
transitionState.drawingState.draw(context: context, size: bounds.size)
|
transitionState.drawingState.draw(context: context, size: bounds.size, foregroundColor: parameters.foreground)
|
||||||
}
|
}
|
||||||
parameters.drawingState.draw(context: context, size: bounds.size)
|
parameters.drawingState.draw(context: context, size: bounds.size, foregroundColor: parameters.foreground)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -799,14 +799,17 @@ final class ChatMessageInteractiveFileNode: ASDisplayNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let backgroundNodeColor: UIColor
|
let backgroundNodeColor: UIColor
|
||||||
|
let foregroundNodeColor: UIColor
|
||||||
if self.iconNode != nil {
|
if self.iconNode != nil {
|
||||||
backgroundNodeColor = presentationData.theme.theme.chat.message.mediaOverlayControlColors.fillColor
|
backgroundNodeColor = presentationData.theme.theme.chat.message.mediaOverlayControlColors.fillColor
|
||||||
|
foregroundNodeColor = .white
|
||||||
} else {
|
} else {
|
||||||
backgroundNodeColor = messageTheme.mediaActiveControlColor
|
backgroundNodeColor = messageTheme.mediaActiveControlColor
|
||||||
|
foregroundNodeColor = .clear
|
||||||
}
|
}
|
||||||
|
|
||||||
if state != .none && self.statusNode == nil {
|
if state != .none && self.statusNode == nil {
|
||||||
let statusNode = SemanticStatusNode(backgroundNodeColor: backgroundNodeColor)
|
let statusNode = SemanticStatusNode(backgroundNodeColor: backgroundNodeColor, foregroundNodeColor: foregroundNodeColor)
|
||||||
self.statusNode = statusNode
|
self.statusNode = statusNode
|
||||||
statusNode.frame = progressFrame
|
statusNode.frame = progressFrame
|
||||||
self.addSubnode(statusNode)
|
self.addSubnode(statusNode)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user