mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-24 07:05:35 +00:00
Various fixes
This commit is contained in:
@@ -8036,3 +8036,7 @@ Sorry for the inconvenience.";
|
||||
"PeerStatusExpiration.AtDate" = "Your status expires on %@";
|
||||
|
||||
"Chat.PanelCustomStatusInfo" = "This account uses %@ as a custom status next to its name. Such emoji statuses are available to all subscribers of Telegram Premium.";
|
||||
|
||||
"Login.CancelEmailVerification" = "Do you want to stop the email verification process?";
|
||||
"Login.CancelEmailVerificationStop" = "Stop";
|
||||
"Login.CancelEmailVerificationContinue" = "Continue";
|
||||
|
||||
@@ -54,8 +54,22 @@ public final class AuthorizationSequenceCodeEntryController: ViewController {
|
||||
return false
|
||||
}
|
||||
self.navigationBar?.backPressed = { [weak self] in
|
||||
self?.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: presentationData), title: nil, text: presentationData.strings.Login_CancelPhoneVerification, actions: [TextAlertAction(type: .genericAction, title: presentationData.strings.Login_CancelPhoneVerificationContinue, action: {
|
||||
}), TextAlertAction(type: .defaultAction, title: presentationData.strings.Login_CancelPhoneVerificationStop, action: {
|
||||
let text: String
|
||||
let proceed: String
|
||||
let stop: String
|
||||
|
||||
if let (_, _, type, _, _) = self?.data, case .email = type {
|
||||
text = presentationData.strings.Login_CancelEmailVerification
|
||||
proceed = presentationData.strings.Login_CancelEmailVerificationContinue
|
||||
stop = presentationData.strings.Login_CancelEmailVerificationStop
|
||||
} else {
|
||||
text = presentationData.strings.Login_CancelPhoneVerification
|
||||
proceed = presentationData.strings.Login_CancelPhoneVerificationContinue
|
||||
stop = presentationData.strings.Login_CancelPhoneVerificationStop
|
||||
}
|
||||
|
||||
self?.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: presentationData), title: nil, text: text, actions: [TextAlertAction(type: .genericAction, title: proceed, action: {
|
||||
}), TextAlertAction(type: .defaultAction, title: stop, action: {
|
||||
back()
|
||||
})]), in: .window(.root))
|
||||
}
|
||||
|
||||
@@ -176,17 +176,17 @@ final class AuthorizationSequenceEmailEntryControllerNode: ASDisplayNode, UIText
|
||||
private func updateButtonsVisibility(transition: ContainedViewLayoutTransition) {
|
||||
if self.currentEmail.isEmpty && self.appleSignInAllowed {
|
||||
transition.updateAlpha(node: self.proceedNode, alpha: 0.0)
|
||||
if self.proceedNode.isHidden {
|
||||
// if self.proceedNode.isHidden {
|
||||
transition.updateAlpha(node: self.dividerNode, alpha: 1.0)
|
||||
}
|
||||
// }
|
||||
if let signInWithAppleButton = self.signInWithAppleButton {
|
||||
transition.updateAlpha(layer: signInWithAppleButton.layer, alpha: 1.0)
|
||||
}
|
||||
} else {
|
||||
transition.updateAlpha(node: self.proceedNode, alpha: 1.0)
|
||||
if self.proceedNode.isHidden {
|
||||
// if self.proceedNode.isHidden {
|
||||
transition.updateAlpha(node: self.dividerNode, alpha: 0.0)
|
||||
}
|
||||
// }
|
||||
if let signInWithAppleButton = self.signInWithAppleButton {
|
||||
transition.updateAlpha(layer: signInWithAppleButton.layer, alpha: 0.0)
|
||||
}
|
||||
@@ -254,7 +254,7 @@ final class AuthorizationSequenceEmailEntryControllerNode: ASDisplayNode, UIText
|
||||
self.dividerNode.isHidden = true
|
||||
}
|
||||
|
||||
let _ = layoutAuthorizationItems(bounds: CGRect(origin: CGPoint(x: 0.0, y: insets.top), size: CGSize(width: layout.size.width, height: layout.size.height - insets.top - insets.bottom - 110.0)), items: items, transition: transition, failIfDoesNotFit: false)
|
||||
let _ = layoutAuthorizationItems(bounds: CGRect(origin: CGPoint(x: 0.0, y: insets.top), size: CGSize(width: layout.size.width, height: layout.size.height - insets.top - insets.bottom - 120.0)), items: items, transition: transition, failIfDoesNotFit: false)
|
||||
|
||||
if let signInWithAppleButton = self.signInWithAppleButton, self.appleSignInAllowed {
|
||||
signInWithAppleButton.isHidden = false
|
||||
|
||||
@@ -213,10 +213,10 @@ final class AuthorizationSequenceSignUpControllerNode: ASDisplayNode, UITextFiel
|
||||
|
||||
var insets = layout.insets(options: [.statusBar])
|
||||
if let inputHeight = layout.inputHeight {
|
||||
insets.bottom += max(inputHeight, layout.standardInputHeight)
|
||||
insets.bottom = max(inputHeight, layout.standardInputHeight)
|
||||
}
|
||||
|
||||
let additionalBottomInset: CGFloat = layout.size.width > 320.0 ? 80.0 : 10.0
|
||||
let additionalBottomInset: CGFloat = layout.size.width > 320.0 ? 90.0 : 10.0
|
||||
|
||||
self.titleNode.attributedText = NSAttributedString(string: self.strings.Login_InfoTitle, font: Font.semibold(28.0), textColor: self.theme.list.itemPrimaryTextColor)
|
||||
let titleSize = self.titleNode.measure(CGSize(width: layout.size.width, height: CGFloat.greatestFiniteMagnitude))
|
||||
|
||||
@@ -42,7 +42,7 @@ public enum TelegramExtendedMedia: PostboxCoding, Equatable {
|
||||
switch type {
|
||||
case 0:
|
||||
let width = decoder.decodeOptionalInt32ForKey("width")
|
||||
let height = decoder.decodeOptionalInt32ForKey("width")
|
||||
let height = decoder.decodeOptionalInt32ForKey("height")
|
||||
var dimensions: PixelDimensions?
|
||||
if let width = width, let height = height {
|
||||
dimensions = PixelDimensions(width: width, height: height)
|
||||
|
||||
@@ -316,7 +316,7 @@ public func makeDefaultDarkPresentationTheme(extendingThemeReference: Presentati
|
||||
accentTextColor: UIColor(rgb: 0xffffff),
|
||||
blurredBackgroundColor: UIColor(rgb: 0x1d1d1d, alpha: 0.9),
|
||||
opaqueBackgroundColor: UIColor(rgb: 0x1d1d1d).mixedWith(UIColor(rgb: 0x000000), alpha: 0.1),
|
||||
separatorColor: UIColor(rgb: 0x545458, alpha: 0.65),
|
||||
separatorColor: UIColor(rgb: 0x545458, alpha: 0.55),
|
||||
badgeBackgroundColor: UIColor(rgb: 0xffffff),
|
||||
badgeStrokeColor: UIColor(rgb: 0x1c1c1d),
|
||||
badgeTextColor: UIColor(rgb: 0x000000),
|
||||
@@ -330,7 +330,7 @@ public func makeDefaultDarkPresentationTheme(extendingThemeReference: Presentati
|
||||
|
||||
let rootTabBar = PresentationThemeRootTabBar(
|
||||
backgroundColor: rootNavigationBar.blurredBackgroundColor,
|
||||
separatorColor: UIColor(rgb: 0x3d3d40),
|
||||
separatorColor: UIColor(rgb: 0x545458, alpha: 0.55),
|
||||
iconColor: UIColor(rgb: 0x828282),
|
||||
selectedIconColor: UIColor(rgb: 0xffffff),
|
||||
textColor: UIColor(rgb: 0x828282),
|
||||
@@ -348,7 +348,7 @@ public func makeDefaultDarkPresentationTheme(extendingThemeReference: Presentati
|
||||
inputPlaceholderTextColor: UIColor(rgb: 0x8f8f8f),
|
||||
inputIconColor: UIColor(rgb: 0x8f8f8f),
|
||||
inputClearButtonColor: UIColor(rgb: 0x8f8f8f),
|
||||
separatorColor: UIColor(rgb: 0x3d3d40)
|
||||
separatorColor: UIColor(rgb: 0x545458, alpha: 0.55)
|
||||
)
|
||||
|
||||
let intro = PresentationThemeIntro(
|
||||
@@ -396,8 +396,8 @@ public func makeDefaultDarkPresentationTheme(extendingThemeReference: Presentati
|
||||
itemBlocksBackgroundColor: UIColor(rgb: 0x1c1c1d),
|
||||
itemModalBlocksBackgroundColor: UIColor(rgb: 0x2c2c2e),
|
||||
itemHighlightedBackgroundColor: UIColor(rgb: 0x313135),
|
||||
itemBlocksSeparatorColor: UIColor(rgb: 0x3d3d40),
|
||||
itemPlainSeparatorColor: UIColor(rgb: 0x3d3d40),
|
||||
itemBlocksSeparatorColor: UIColor(rgb: 0x545458, alpha: 0.55),
|
||||
itemPlainSeparatorColor: UIColor(rgb: 0x545458, alpha: 0.55),
|
||||
disclosureArrowColor: UIColor(rgb: 0xffffff, alpha: 0.28),
|
||||
sectionHeaderTextColor: UIColor(rgb: 0x8d8e93),
|
||||
freeTextColor: UIColor(rgb: 0x8d8e93),
|
||||
@@ -450,7 +450,7 @@ public func makeDefaultDarkPresentationTheme(extendingThemeReference: Presentati
|
||||
|
||||
let chatList = PresentationThemeChatList(
|
||||
backgroundColor: UIColor(rgb: 0x000000),
|
||||
itemSeparatorColor: UIColor(rgb: 0x3d3d40),
|
||||
itemSeparatorColor: UIColor(rgb: 0x545458, alpha: 0.55),
|
||||
itemBackgroundColor: UIColor(rgb: 0x000000),
|
||||
pinnedItemBackgroundColor: UIColor(rgb: 0x1c1c1d),
|
||||
itemHighlightedBackgroundColor: UIColor(rgb: 0x191919),
|
||||
@@ -593,7 +593,7 @@ public func makeDefaultDarkPresentationTheme(extendingThemeReference: Presentati
|
||||
let inputPanel = PresentationThemeChatInputPanel(
|
||||
panelBackgroundColor: rootNavigationBar.blurredBackgroundColor,
|
||||
panelBackgroundColorNoWallpaper: UIColor(rgb: 0x000000, alpha: 0.94),
|
||||
panelSeparatorColor: UIColor(rgb: 0x3d3d40),
|
||||
panelSeparatorColor: UIColor(rgb: 0x545458, alpha: 0.55),
|
||||
panelControlAccentColor: UIColor(rgb: 0xffffff),
|
||||
panelControlColor: UIColor(rgb: 0x808080),
|
||||
panelControlDisabledColor: UIColor(rgb: 0x808080, alpha: 0.5),
|
||||
@@ -612,7 +612,7 @@ public func makeDefaultDarkPresentationTheme(extendingThemeReference: Presentati
|
||||
)
|
||||
|
||||
let inputMediaPanel = PresentationThemeInputMediaPanel(
|
||||
panelSeparatorColor: UIColor(rgb: 0x3d3d40),
|
||||
panelSeparatorColor: UIColor(rgb: 0x545458, alpha: 0.55),
|
||||
panelIconColor: UIColor(rgb: 0x808080),
|
||||
panelHighlightedIconBackgroundColor: UIColor(rgb: 0x808080).withMultipliedAlpha(0.25),
|
||||
panelHighlightedIconColor: UIColor(rgb: 0x808080).mixedWith(UIColor(rgb: 0xffffff), alpha: 0.35),
|
||||
@@ -632,7 +632,7 @@ public func makeDefaultDarkPresentationTheme(extendingThemeReference: Presentati
|
||||
)
|
||||
|
||||
let inputButtonPanel = PresentationThemeInputButtonPanel(
|
||||
panelSeparatorColor: UIColor(rgb: 0x3d3d40),
|
||||
panelSeparatorColor: UIColor(rgb: 0x545458, alpha: 0.55),
|
||||
panelBackgroundColor: UIColor(rgb: 0x141414),
|
||||
buttonFillColor: UIColor(rgb: 0x5a5a5a),
|
||||
buttonStrokeColor: UIColor(rgb: 0x0c0c0c),
|
||||
@@ -643,7 +643,7 @@ public func makeDefaultDarkPresentationTheme(extendingThemeReference: Presentati
|
||||
|
||||
let historyNavigation = PresentationThemeChatHistoryNavigation(
|
||||
fillColor: UIColor(rgb: 0x1c1c1d),
|
||||
strokeColor: UIColor(rgb: 0x3d3d40),
|
||||
strokeColor: UIColor(rgb: 0x545458, alpha: 0.55),
|
||||
foregroundColor: UIColor(rgb: 0xffffff),
|
||||
badgeBackgroundColor: UIColor(rgb: 0xffffff),
|
||||
badgeStrokeColor: UIColor(rgb: 0xffffff),
|
||||
@@ -670,7 +670,7 @@ public func makeDefaultDarkPresentationTheme(extendingThemeReference: Presentati
|
||||
itemBackgroundColor: UIColor(rgb: 0x1c1c1d, alpha: 0.8),
|
||||
opaqueItemHighlightedBackgroundColor: UIColor(white: 0.0, alpha: 1.0),
|
||||
itemHighlightedBackgroundColor: UIColor(rgb: 0x000000, alpha: 0.5),
|
||||
opaqueItemSeparatorColor: UIColor(rgb: 0x3d3d40),
|
||||
opaqueItemSeparatorColor: UIColor(rgb: 0x545458, alpha: 0.55),
|
||||
standardActionTextColor: UIColor(rgb: 0xffffff),
|
||||
destructiveActionTextColor: UIColor(rgb: 0xeb5545),
|
||||
disabledActionTextColor: UIColor(rgb: 0x4d4d4d),
|
||||
|
||||
@@ -76,23 +76,74 @@ struct ChatMessageDateAndStatus {
|
||||
var dateText: String
|
||||
}
|
||||
|
||||
extension UIBezierPath {
|
||||
convenience init(roundRect rect: CGRect, topLeftRadius: CGFloat = 0.0, topRightRadius: CGFloat = 0.0, bottomLeftRadius: CGFloat = 0.0, bottomRightRadius: CGFloat = 0.0) {
|
||||
self.init()
|
||||
|
||||
let path = CGMutablePath()
|
||||
|
||||
let topLeft = rect.origin
|
||||
let topRight = CGPoint(x: rect.maxX, y: rect.minY)
|
||||
let bottomRight = CGPoint(x: rect.maxX, y: rect.maxY)
|
||||
let bottomLeft = CGPoint(x: rect.minX, y: rect.maxY)
|
||||
|
||||
if topLeftRadius != .zero {
|
||||
path.move(to: CGPoint(x: topLeft.x+topLeftRadius, y: topLeft.y))
|
||||
} else {
|
||||
path.move(to: CGPoint(x: topLeft.x, y: topLeft.y))
|
||||
}
|
||||
|
||||
if topRightRadius != .zero {
|
||||
path.addLine(to: CGPoint(x: topRight.x-topRightRadius, y: topRight.y))
|
||||
path.addCurve(to: CGPoint(x: topRight.x, y: topRight.y+topRightRadius), control1: CGPoint(x: topRight.x, y: topRight.y), control2:CGPoint(x: topRight.x, y: topRight.y + topRightRadius))
|
||||
} else {
|
||||
path.addLine(to: CGPoint(x: topRight.x, y: topRight.y))
|
||||
}
|
||||
|
||||
if bottomRightRadius != .zero {
|
||||
path.addLine(to: CGPoint(x: bottomRight.x, y: bottomRight.y-bottomRightRadius))
|
||||
path.addCurve(to: CGPoint(x: bottomRight.x-bottomRightRadius, y: bottomRight.y), control1: CGPoint(x: bottomRight.x, y: bottomRight.y), control2: CGPoint(x: bottomRight.x-bottomRightRadius, y: bottomRight.y))
|
||||
} else {
|
||||
path.addLine(to: CGPoint(x: bottomRight.x, y: bottomRight.y))
|
||||
}
|
||||
|
||||
if bottomLeftRadius != .zero {
|
||||
path.addLine(to: CGPoint(x: bottomLeft.x+bottomLeftRadius, y: bottomLeft.y))
|
||||
path.addCurve(to: CGPoint(x: bottomLeft.x, y: bottomLeft.y-bottomLeftRadius), control1: CGPoint(x: bottomLeft.x, y: bottomLeft.y), control2: CGPoint(x: bottomLeft.x, y: bottomLeft.y-bottomLeftRadius))
|
||||
} else {
|
||||
path.addLine(to: CGPoint(x: bottomLeft.x, y: bottomLeft.y))
|
||||
}
|
||||
|
||||
if topLeftRadius != .zero {
|
||||
path.addLine(to: CGPoint(x: topLeft.x, y: topLeft.y+topLeftRadius))
|
||||
path.addCurve(to: CGPoint(x: topLeft.x+topLeftRadius, y: topLeft.y) , control1: CGPoint(x: topLeft.x, y: topLeft.y) , control2: CGPoint(x: topLeft.x+topLeftRadius, y: topLeft.y))
|
||||
} else {
|
||||
path.addLine(to: CGPoint(x: topLeft.x, y: topLeft.y))
|
||||
}
|
||||
|
||||
path.closeSubpath()
|
||||
cgPath = path
|
||||
}
|
||||
}
|
||||
|
||||
private class ExtendedMediaOverlayNode: ASDisplayNode {
|
||||
private let dustNode: MediaDustNode
|
||||
private let buttonNode: HighlightTrackingButtonNode
|
||||
private let blurNode: NavigationBackgroundNode
|
||||
private let highlightedBackgroundNode: ASDisplayNode
|
||||
private let iconNode: ASImageNode
|
||||
private let textNode: ImmediateTextNode
|
||||
|
||||
|
||||
private var maskView: UIView?
|
||||
private var maskLayer: CAShapeLayer?
|
||||
|
||||
override init() {
|
||||
self.dustNode = MediaDustNode()
|
||||
|
||||
self.buttonNode = HighlightTrackingButtonNode()
|
||||
self.buttonNode.backgroundColor = UIColor(rgb: 0x000000, alpha: 0.3)
|
||||
self.buttonNode.clipsToBounds = true
|
||||
self.buttonNode.cornerRadius = 16.0
|
||||
|
||||
self.blurNode = NavigationBackgroundNode(color: .clear)
|
||||
|
||||
self.highlightedBackgroundNode = ASDisplayNode()
|
||||
self.highlightedBackgroundNode.backgroundColor = UIColor(rgb: 0xffffff, alpha: 0.2)
|
||||
self.highlightedBackgroundNode.alpha = 0.0
|
||||
@@ -106,12 +157,11 @@ private class ExtendedMediaOverlayNode: ASDisplayNode {
|
||||
super.init()
|
||||
|
||||
self.clipsToBounds = true
|
||||
self.cornerRadius = 16.0
|
||||
self.isUserInteractionEnabled = false
|
||||
|
||||
self.addSubnode(self.dustNode)
|
||||
self.addSubnode(self.buttonNode)
|
||||
self.buttonNode.addSubnode(self.blurNode)
|
||||
|
||||
self.buttonNode.addSubnode(self.highlightedBackgroundNode)
|
||||
self.addSubnode(self.iconNode)
|
||||
self.addSubnode(self.textNode)
|
||||
@@ -141,9 +191,19 @@ private class ExtendedMediaOverlayNode: ASDisplayNode {
|
||||
if #available(iOS 13.0, *) {
|
||||
self.buttonNode.layer.cornerCurve = .continuous
|
||||
}
|
||||
|
||||
let maskView = UIView()
|
||||
self.maskView = maskView
|
||||
self.dustNode.view.mask = maskView
|
||||
|
||||
let maskLayer = CAShapeLayer()
|
||||
maskLayer.fillRule = .evenOdd
|
||||
maskLayer.fillColor = UIColor.white.cgColor
|
||||
maskView.layer.addSublayer(maskLayer)
|
||||
self.maskLayer = maskLayer
|
||||
}
|
||||
|
||||
func update(size: CGSize, text: String) {
|
||||
func update(size: CGSize, text: String, corners: ImageCorners?) {
|
||||
let spacing: CGFloat = 2.0
|
||||
let padding: CGFloat = 10.0
|
||||
|
||||
@@ -156,13 +216,25 @@ private class ExtendedMediaOverlayNode: ASDisplayNode {
|
||||
let contentSize = CGSize(width: iconSize.width + textSize.width + spacing + padding * 2.0, height: 32.0)
|
||||
self.buttonNode.frame = CGRect(origin: CGPoint(x: floorToScreenPixels((size.width - contentSize.width) / 2.0), y: floorToScreenPixels((size.height - contentSize.height) / 2.0)), size: contentSize)
|
||||
self.highlightedBackgroundNode.frame = CGRect(origin: .zero, size: contentSize)
|
||||
self.blurNode.frame = self.highlightedBackgroundNode.frame
|
||||
self.blurNode.update(size: self.blurNode.frame.size, transition: .immediate)
|
||||
self.blurNode.updateColor(color: UIColor(rgb: 0x000000, alpha: 0.3), enableBlur: true, transition: .immediate)
|
||||
|
||||
self.iconNode.frame = CGRect(origin: CGPoint(x: self.buttonNode.frame.minX + padding, y: self.buttonNode.frame.minY + floorToScreenPixels((contentSize.height - iconSize.height) / 2.0) + 1.0), size: iconSize)
|
||||
self.iconNode.frame = CGRect(origin: CGPoint(x: self.buttonNode.frame.minX + padding, y: self.buttonNode.frame.minY + floorToScreenPixels((contentSize.height - iconSize.height) / 2.0) + 1.0 - UIScreenPixel), size: iconSize)
|
||||
self.textNode.frame = CGRect(origin: CGPoint(x: self.iconNode.frame.maxX + spacing, y: self.buttonNode.frame.minY + floorToScreenPixels((contentSize.height - textSize.height) / 2.0)), size: textSize)
|
||||
}
|
||||
|
||||
var leftOffset: CGFloat = 0.0
|
||||
var rightOffset: CGFloat = 0.0
|
||||
let corners = corners ?? ImageCorners(radius: 16.0)
|
||||
if case .Tail = corners.bottomLeft {
|
||||
leftOffset = 4.0
|
||||
} else if case .Tail = corners.bottomRight {
|
||||
rightOffset = 4.0
|
||||
}
|
||||
let rect = CGRect(origin: CGPoint(x: leftOffset, y: 0.0), size: CGSize(width: size.width - leftOffset - rightOffset, height: size.height))
|
||||
let path = UIBezierPath(roundRect: rect, topLeftRadius: corners.topLeft.radius, topRightRadius: corners.topRight.radius, bottomLeftRadius: corners.bottomLeft.radius, bottomRightRadius: corners.bottomRight.radius)
|
||||
let buttonPath = UIBezierPath(roundedRect: self.buttonNode.frame, cornerRadius: 16.0)
|
||||
path.append(buttonPath)
|
||||
path.usesEvenOddFillRule = true
|
||||
self.maskLayer?.path = path.cgPath
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1741,7 +1813,7 @@ final class ChatMessageInteractiveMediaNode: ASDisplayNode, GalleryItemTransitio
|
||||
break
|
||||
}
|
||||
}
|
||||
self.extendedMediaOverlayNode?.update(size: self.imageNode.frame.size, text: paymentText)
|
||||
self.extendedMediaOverlayNode?.update(size: self.imageNode.frame.size, text: paymentText, corners: self.currentImageArguments?.corners)
|
||||
} else if let extendedMediaOverlayNode = self.extendedMediaOverlayNode {
|
||||
self.extendedMediaOverlayNode = nil
|
||||
extendedMediaOverlayNode.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.3, removeOnCompletion: false, completion: { [weak extendedMediaOverlayNode] _ in
|
||||
|
||||
Reference in New Issue
Block a user