Various Fixes

This commit is contained in:
Ilya Laktyushin 2022-01-31 03:43:19 +03:00
parent 4b360aae52
commit 7da4e1001f
4 changed files with 28 additions and 12 deletions

View File

@ -67,9 +67,6 @@ private final class SortHeaderButton: HighlightableButtonNode {
strongSelf.contextAction?(strongSelf.containerNode, gesture)
}
self.containerNode.frame = CGRect(origin: CGPoint(), size: CGSize(width: 26.0, height: 44.0))
self.referenceNode.frame = self.containerNode.bounds
self.update(theme: presentationData.theme, strings: presentationData.strings)
}
@ -82,10 +79,15 @@ private final class SortHeaderButton: HighlightableButtonNode {
self.textNode.attributedText = NSAttributedString(string: strings.Contacts_Sort, font: Font.regular(17.0), textColor: theme.rootController.navigationBar.accentTextColor)
let size = self.textNode.updateLayout(CGSize(width: 100.0, height: 44.0))
self.textNode.frame = CGRect(origin: CGPoint(x: 0.0, y: floorToScreenPixels((44.0 - size.height) / 2.0)), size: size)
self.containerNode.frame = CGRect(origin: CGPoint(), size: CGSize(width: size.width, height: 44.0))
self.referenceNode.frame = self.containerNode.bounds
}
override func calculateSizeThatFits(_ constrainedSize: CGSize) -> CGSize {
return CGSize(width: 44.0, height: 44.0)
let size = self.textNode.updateLayout(CGSize(width: 100.0, height: 44.0))
return CGSize(width: size.width, height: 44.0)
}
func onLayout() {

View File

@ -1083,15 +1083,25 @@ private class StorageUsageClearProgressOverlayNode: ASDisplayNode, ActionSheetGr
self.descriptionTextNode.attributedText = NSAttributedString(string: self.presentationData.strings.ClearCache_KeepOpenedDescription, font: Font.regular(15.0), textColor: self.presentationData.theme.actionSheet.secondaryTextColor)
let descriptionTextSize = self.descriptionTextNode.updateLayout(CGSize(width: size.width - inset * 3.0, height: size.height))
let descriptionTextFrame = CGRect(origin: CGPoint(x: floorToScreenPixels((size.width - descriptionTextSize.width) / 2.0), y: progressFrame.minY - spacing - 9.0 - descriptionTextSize.height), size: descriptionTextSize)
self.descriptionTextNode.frame = descriptionTextFrame
var descriptionTextFrame = CGRect(origin: CGPoint(x: floorToScreenPixels((size.width - descriptionTextSize.width) / 2.0), y: progressFrame.minY - spacing - 9.0 - descriptionTextSize.height), size: descriptionTextSize)
self.progressTextNode.attributedText = NSAttributedString(string: self.presentationData.strings.ClearCache_Progress(Int(progress * 100.0)).string, font: Font.with(size: 17.0, design: .regular, weight: .bold, traits: [.monospacedNumbers]), textColor: self.presentationData.theme.actionSheet.primaryTextColor)
let progressTextSize = self.progressTextNode.updateLayout(size)
let progressTextFrame = CGRect(origin: CGPoint(x: floorToScreenPixels((size.width - progressTextSize.width) / 2.0), y: descriptionTextFrame.minY - spacing - progressTextSize.height), size: progressTextSize)
self.progressTextNode.frame = progressTextFrame
var progressTextFrame = CGRect(origin: CGPoint(x: floorToScreenPixels((size.width - progressTextSize.width) / 2.0), y: descriptionTextFrame.minY - spacing - progressTextSize.height), size: progressTextSize)
let availableHeight = progressTextFrame.minY
if availableHeight < 100.0 {
let offset = availableHeight / 2.0 - spacing
descriptionTextFrame = descriptionTextFrame.offsetBy(dx: 0.0, dy: -offset)
progressTextFrame = progressTextFrame.offsetBy(dx: 0.0, dy: -offset)
self.animationNode.alpha = 0.0
} else {
self.animationNode.alpha = 1.0
}
self.progressTextNode.frame = progressTextFrame
self.descriptionTextNode.frame = descriptionTextFrame
let imageSide = min(160.0, availableHeight - 30.0)
let imageSize = CGSize(width: imageSide, height: imageSide)

View File

@ -991,7 +991,11 @@ private func infoItems(data: PeerInfoScreenData?, context: AccountContext, prese
}
if let aboutText = aboutText {
items[.peerInfo]!.append(PeerInfoScreenLabeledValueItem(id: ItemAbout, label: presentationData.strings.Channel_Info_Description, text: aboutText, textColor: .primary, textBehavior: .multiLine(maxLines: 100, enabledEntities: enabledPublicBioEntities), action: nil, longTapAction: bioContextAction, linkItemAction: bioLinkAction, requestLayout: {
var enabledEntities = enabledPublicBioEntities
if case .group = channel.info {
enabledEntities = enabledPrivateBioEntities
}
items[.peerInfo]!.append(PeerInfoScreenLabeledValueItem(id: ItemAbout, label: presentationData.strings.Channel_Info_Description, text: aboutText, textColor: .primary, textBehavior: .multiLine(maxLines: 100, enabledEntities: enabledEntities), action: nil, longTapAction: bioContextAction, linkItemAction: bioLinkAction, requestLayout: {
interaction.requestLayout()
}))
}
@ -1041,7 +1045,7 @@ private func infoItems(data: PeerInfoScreenData?, context: AccountContext, prese
}
if let aboutText = aboutText {
items[.peerInfo]!.append(PeerInfoScreenLabeledValueItem(id: 0, label: presentationData.strings.Channel_Info_Description, text: aboutText, textColor: .primary, textBehavior: .multiLine(maxLines: 100, enabledEntities: enabledPublicBioEntities), action: nil, longTapAction: bioContextAction, linkItemAction: bioLinkAction, requestLayout: {
items[.peerInfo]!.append(PeerInfoScreenLabeledValueItem(id: 0, label: presentationData.strings.Channel_Info_Description, text: aboutText, textColor: .primary, textBehavior: .multiLine(maxLines: 100, enabledEntities: enabledPrivateBioEntities), action: nil, longTapAction: bioContextAction, linkItemAction: bioLinkAction, requestLayout: {
interaction.requestLayout()
}))
}

View File

@ -193,7 +193,7 @@ public func generateTextEntities(_ text: String, enabledTypes: EnabledEntityType
guard let host = url.host?.lowercased() else {
return
}
if host == "telegram.org" || host == "t.me" {
if ["telegram.org", "www.telegram.org", "t.me", "www.t.me"].contains(host) {
} else {
return
}