mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
Fixed navigating back to splash screen
Fixed confirmation code url parsing Added insets around reply header labels
This commit is contained in:
@@ -96,7 +96,7 @@ final class AuthorizationSequenceSplashController: ViewController {
|
||||
}
|
||||
|
||||
private func addControllerIfNeeded() {
|
||||
if !controller.isViewLoaded {
|
||||
if !controller.isViewLoaded || controller.view.superview == nil {
|
||||
self.displayNode.view.addSubview(controller.view)
|
||||
controller.view.frame = self.displayNode.bounds;
|
||||
controller.viewDidAppear(false)
|
||||
|
||||
@@ -526,9 +526,7 @@ final class ChatMessageInteractiveMediaNode: ASDisplayNode {
|
||||
progressRequired = true
|
||||
}
|
||||
}
|
||||
case .Remote:
|
||||
progressRequired = true
|
||||
case .Fetching:
|
||||
case .Remote, .Fetching:
|
||||
if let _ = webpage, let automaticDownload = self.automaticDownload, automaticDownload {
|
||||
progressRequired = false
|
||||
} else {
|
||||
|
||||
@@ -138,10 +138,12 @@ class ChatMessageReplyInfoNode: ASDisplayNode {
|
||||
|
||||
let contrainedTextSize = CGSize(width: maximumTextWidth, height: constrainedSize.height)
|
||||
|
||||
let (titleLayout, titleApply) = titleNodeLayout(TextNodeLayoutArguments(attributedString: NSAttributedString(string: titleString, font: titleFont, textColor: titleColor), backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: contrainedTextSize, alignment: .natural, cutout: nil, insets: UIEdgeInsets()))
|
||||
let (textLayout, textApply) = textNodeLayout(TextNodeLayoutArguments(attributedString: NSAttributedString(string: textString, font: textFont, textColor: textColor), backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: contrainedTextSize, alignment: .natural, cutout: nil, insets: UIEdgeInsets()))
|
||||
let textInsets = UIEdgeInsets(top: 3.0, left: 0.0, bottom: 3.0, right: 0.0)
|
||||
|
||||
let size = CGSize(width: max(titleLayout.size.width, textLayout.size.width) + leftInset, height: titleLayout.size.height + textLayout.size.height + 2 * spacing)
|
||||
let (titleLayout, titleApply) = titleNodeLayout(TextNodeLayoutArguments(attributedString: NSAttributedString(string: titleString, font: titleFont, textColor: titleColor), backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: contrainedTextSize, alignment: .natural, cutout: nil, insets: textInsets))
|
||||
let (textLayout, textApply) = textNodeLayout(TextNodeLayoutArguments(attributedString: NSAttributedString(string: textString, font: textFont, textColor: textColor), backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: contrainedTextSize, alignment: .natural, cutout: nil, insets: textInsets))
|
||||
|
||||
let size = CGSize(width: max(titleLayout.size.width - textInsets.left - textInsets.right, textLayout.size.width - textInsets.left - textInsets.right) + leftInset, height: titleLayout.size.height + textLayout.size.height - 2 * (textInsets.top + textInsets.bottom) + 2 * spacing)
|
||||
|
||||
return (size, {
|
||||
let node: ChatMessageReplyInfoNode
|
||||
@@ -185,8 +187,8 @@ class ChatMessageReplyInfoNode: ASDisplayNode {
|
||||
node.imageNode = nil
|
||||
}
|
||||
|
||||
titleNode.frame = CGRect(origin: CGPoint(x: leftInset, y: spacing), size: titleLayout.size)
|
||||
textNode.frame = CGRect(origin: CGPoint(x: leftInset, y: titleNode.frame.maxY + spacing), size: textLayout.size)
|
||||
titleNode.frame = CGRect(origin: CGPoint(x: leftInset - textInsets.left, y: spacing - textInsets.top), size: titleLayout.size)
|
||||
textNode.frame = CGRect(origin: CGPoint(x: leftInset - textInsets.left, y: titleNode.frame.maxY - textInsets.bottom + spacing - textInsets.top), size: textLayout.size)
|
||||
|
||||
node.lineNode.image = lineImage
|
||||
node.lineNode.frame = CGRect(origin: CGPoint(x: 1.0, y: 3.0), size: CGSize(width: 2.0, height: max(0.0, size.height - 5.0)))
|
||||
|
||||
@@ -91,6 +91,16 @@ public func parseConfirmationCodeUrl(_ url: URL) -> Int? {
|
||||
return code
|
||||
}
|
||||
}
|
||||
if url.scheme == "tg" {
|
||||
if let host = url.host, let query = url.query, let parsedUrl = parseInternalUrl(query: host + "?" + query) {
|
||||
switch parsedUrl {
|
||||
case let .confirmationCode(code):
|
||||
return code
|
||||
default:
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -333,9 +333,7 @@ final class UniversalVideoGalleryItemNode: ZoomableContentGalleryItemNode {
|
||||
}
|
||||
if let file = file {
|
||||
let status = messageMediaFileStatus(account: item.account, messageId: message.id, file: file)
|
||||
if isWebpage {
|
||||
self.scrubberView.setFetchStatusSignal(nil, strings: self.strings, fileSize: file.size)
|
||||
} else {
|
||||
if !isWebpage {
|
||||
self.scrubberView.setFetchStatusSignal(status, strings: self.strings, fileSize: file.size)
|
||||
}
|
||||
|
||||
|
||||
@@ -4,13 +4,13 @@ import Postbox
|
||||
import TelegramCore
|
||||
import MtProtoKitDynamic
|
||||
|
||||
private enum ParsedInternalPeerUrlParameter {
|
||||
enum ParsedInternalPeerUrlParameter {
|
||||
case botStart(String)
|
||||
case groupBotStart(String)
|
||||
case channelMessage(Int32)
|
||||
}
|
||||
|
||||
private enum ParsedInternalUrl {
|
||||
enum ParsedInternalUrl {
|
||||
case peerName(String, ParsedInternalPeerUrlParameter?)
|
||||
case stickerPack(String)
|
||||
case join(String)
|
||||
@@ -39,7 +39,7 @@ enum ResolvedUrl {
|
||||
case confirmationCode(Int)
|
||||
}
|
||||
|
||||
private func parseInternalUrl(query: String) -> ParsedInternalUrl? {
|
||||
func parseInternalUrl(query: String) -> ParsedInternalUrl? {
|
||||
if let components = URLComponents(string: "/" + query) {
|
||||
var pathComponents = components.path.components(separatedBy: "/")
|
||||
if !pathComponents.isEmpty {
|
||||
@@ -91,6 +91,18 @@ private func parseInternalUrl(query: String) -> ParsedInternalUrl? {
|
||||
if let _ = url {
|
||||
return .internalInstantView(url: "https://t.me/\(query)")
|
||||
}
|
||||
} else if peerName == "login" {
|
||||
var code: String?
|
||||
for queryItem in queryItems {
|
||||
if let value = queryItem.value {
|
||||
if queryItem.name == "code" {
|
||||
code = value
|
||||
}
|
||||
}
|
||||
}
|
||||
if let code = code, let codeValue = Int(code) {
|
||||
return .confirmationCode(codeValue)
|
||||
}
|
||||
} else {
|
||||
for queryItem in queryItems {
|
||||
if let value = queryItem.value {
|
||||
|
||||
Reference in New Issue
Block a user