diff --git a/submodules/Display/Display/TextNode.swift b/submodules/Display/Display/TextNode.swift index 4f46c270b1..7a0bc0a530 100644 --- a/submodules/Display/Display/TextNode.swift +++ b/submodules/Display/Display/TextNode.swift @@ -401,11 +401,11 @@ public final class TextNodeLayout: NSObject { let lineRange = NSIntersectionRange(range, line.range) if lineRange.length != 0 { var leftOffset: CGFloat = 0.0 - if lineRange.location != line.range.location { + if lineRange.location != line.range.location || line.isRTL { leftOffset = floor(CTLineGetOffsetForStringIndex(line.line, lineRange.location, nil)) } var rightOffset: CGFloat = line.frame.width - if lineRange.location + lineRange.length != line.range.length { + if lineRange.location + lineRange.length != line.range.length || line.isRTL { var secondaryOffset: CGFloat = 0.0 let rawOffset = CTLineGetOffsetForStringIndex(line.line, lineRange.location + lineRange.length, &secondaryOffset) rightOffset = ceil(rawOffset) @@ -417,7 +417,10 @@ public final class TextNodeLayout: NSObject { lineFrame = displayLineFrame(frame: lineFrame, isRTL: line.isRTL, boundingRect: CGRect(origin: CGPoint(), size: self.size), cutout: self.cutout) - rects.append((lineFrame, CGRect(origin: CGPoint(x: lineFrame.minX + leftOffset + self.insets.left, y: lineFrame.minY + self.insets.top), size: CGSize(width: rightOffset - leftOffset, height: lineFrame.size.height)))) + let width = abs(rightOffset - leftOffset) + if width > 1.0 { + rects.append((lineFrame, CGRect(origin: CGPoint(x: lineFrame.minX + (leftOffset < rightOffset ? leftOffset : rightOffset) + self.insets.left, y: lineFrame.minY + self.insets.top), size: CGSize(width: width, height: lineFrame.size.height)))) + } } } if !rects.isEmpty { diff --git a/submodules/TelegramUI/TelegramUI/ChatScheduleTimeControllerNode.swift b/submodules/TelegramUI/TelegramUI/ChatScheduleTimeControllerNode.swift index 58a88a7467..ea5e3f9788 100644 --- a/submodules/TelegramUI/TelegramUI/ChatScheduleTimeControllerNode.swift +++ b/submodules/TelegramUI/TelegramUI/ChatScheduleTimeControllerNode.swift @@ -105,8 +105,6 @@ class ChatScheduleTimeControllerNode: ViewControllerTracingNode, UIScrollViewDel self.pickerView.timeZone = TimeZone.current self.pickerView.minuteInterval = 5 - self.pickerView.maximumDate = Date(timeIntervalSince1970: Double(Int32.max - 1)) - self.pickerView.setValue(self.presentationData.theme.actionSheet.primaryTextColor, forKey: "textColor") self.contentContainerNode.view.addSubview(self.pickerView) @@ -137,6 +135,10 @@ class ChatScheduleTimeControllerNode: ViewControllerTracingNode, UIScrollViewDel components.second = 0 let minute = (components.minute ?? 0) % 5 + if let date = calendar.date(byAdding: .day, value: 365, to: currentDate) { + self.pickerView.maximumDate = date + } + if let date = calendar.date(byAdding: .minute, value: 5 - minute, to: calendar.date(from: components)!) { self.pickerView.minimumDate = date self.pickerView.date = date diff --git a/submodules/TelegramUI/TelegramUI/ItemListSingleLineInputItem.swift b/submodules/TelegramUI/TelegramUI/ItemListSingleLineInputItem.swift index b44ee1900e..6b03cc0b88 100644 --- a/submodules/TelegramUI/TelegramUI/ItemListSingleLineInputItem.swift +++ b/submodules/TelegramUI/TelegramUI/ItemListSingleLineInputItem.swift @@ -178,7 +178,7 @@ class ItemListSingleLineInputItemNode: ListViewItemNode, UITextFieldDelegate, It } let leftInset: CGFloat = 16.0 + params.leftInset - var rightInset: CGFloat = params.rightInset + var rightInset: CGFloat = 16.0 + params.rightInset if item.clearButton { rightInset += 32.0 diff --git a/submodules/TelegramUI/TelegramUI/TextNode.swift b/submodules/TelegramUI/TelegramUI/TextNode.swift deleted file mode 100644 index 211fc1be84..0000000000 --- a/submodules/TelegramUI/TelegramUI/TextNode.swift +++ /dev/null @@ -1,6 +0,0 @@ -import Foundation -import UIKit -import AsyncDisplayKit -import Display -import Postbox - diff --git a/submodules/TelegramUI/TelegramUI_Xcode.xcodeproj/project.pbxproj b/submodules/TelegramUI/TelegramUI_Xcode.xcodeproj/project.pbxproj index dbedc8a0c0..ee32f8b641 100644 --- a/submodules/TelegramUI/TelegramUI_Xcode.xcodeproj/project.pbxproj +++ b/submodules/TelegramUI/TelegramUI_Xcode.xcodeproj/project.pbxproj @@ -857,7 +857,6 @@ D0EC6D2C1EB9F58800EBF1C3 /* TouchDownGestureRecognizer.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0F69CFB1D6B87D30046BCD6 /* TouchDownGestureRecognizer.swift */; }; D0EC6D301EB9F58800EBF1C3 /* RadialProgressNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0F69DC41D6B89E10046BCD6 /* RadialProgressNode.swift */; }; D0EC6D311EB9F58800EBF1C3 /* RadialTimeoutNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D00C7CE51E378FD00080C3D5 /* RadialTimeoutNode.swift */; }; - D0EC6D321EB9F58800EBF1C3 /* TextNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0F69DC21D6B89DA0046BCD6 /* TextNode.swift */; }; D0EC6D351EB9F58800EBF1C3 /* SearchBarNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0F69DCB1D6B8A0D0046BCD6 /* SearchBarNode.swift */; }; D0EC6D361EB9F58800EBF1C3 /* SearchBarPlaceholderNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0F69DCC1D6B8A0D0046BCD6 /* SearchBarPlaceholderNode.swift */; }; D0EC6D371EB9F58800EBF1C3 /* SearchDisplayController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0F69DCD1D6B8A0D0046BCD6 /* SearchDisplayController.swift */; }; @@ -2293,7 +2292,6 @@ D0F69CD61D6B87D30046BCD6 /* MediaManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MediaManager.swift; sourceTree = ""; }; D0F69CFB1D6B87D30046BCD6 /* TouchDownGestureRecognizer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TouchDownGestureRecognizer.swift; sourceTree = ""; }; D0F69DB91D6B88190046BCD6 /* TelegramUI.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = TelegramUI.xcconfig; path = TelegramUI/Config/TelegramUI.xcconfig; sourceTree = ""; }; - D0F69DC21D6B89DA0046BCD6 /* TextNode.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextNode.swift; sourceTree = ""; }; D0F69DC41D6B89E10046BCD6 /* RadialProgressNode.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RadialProgressNode.swift; sourceTree = ""; }; D0F69DCB1D6B8A0D0046BCD6 /* SearchBarNode.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SearchBarNode.swift; sourceTree = ""; }; D0F69DCC1D6B8A0D0046BCD6 /* SearchBarPlaceholderNode.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SearchBarPlaceholderNode.swift; sourceTree = ""; }; @@ -4398,7 +4396,6 @@ D0477D191F617E4B00412B44 /* Video */, D0F69DC41D6B89E10046BCD6 /* RadialProgressNode.swift */, D00C7CE51E378FD00080C3D5 /* RadialTimeoutNode.swift */, - D0F69DC21D6B89DA0046BCD6 /* TextNode.swift */, D0943AF51FDAAE7E001522CC /* MultipleAvatarsNode.swift */, D0568AAC1DF198130022E7DA /* AudioWaveformNode.swift */, D0BC38621E3F9EFA0044D6FE /* EditableTokenListNode.swift */, @@ -5431,7 +5428,6 @@ D0BE30492061C0F500FBE6D8 /* SecureIdAuthHeaderNode.swift in Sources */, D0EC6D301EB9F58800EBF1C3 /* RadialProgressNode.swift in Sources */, D0EC6D311EB9F58800EBF1C3 /* RadialTimeoutNode.swift in Sources */, - D0EC6D321EB9F58800EBF1C3 /* TextNode.swift in Sources */, D0BFAE5020AB2A1300793CF2 /* PeerBanTimeoutController.swift in Sources */, 09CE950A2237B93500A7D2C3 /* SettingsSearchResultItem.swift in Sources */, D0AE303922B1D3620058D3BC /* LegacyBridgeAudio.swift in Sources */, diff --git a/submodules/UrlEscaping/Sources/UrlEscaping.swift b/submodules/UrlEscaping/Sources/UrlEscaping.swift index 3fd9fabd82..38f936e0bf 100644 --- a/submodules/UrlEscaping/Sources/UrlEscaping.swift +++ b/submodules/UrlEscaping/Sources/UrlEscaping.swift @@ -32,7 +32,8 @@ public extension CharacterSet { } public func isValidUrl(_ url: String) -> Bool { - if let url = URL(string: url), ["http", "https"].contains(url.scheme), let host = url.host, host.contains(".") && url.user == nil { + + if let escapedUrl = url.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed), let url = URL(string: escapedUrl), ["http", "https"].contains(url.scheme), let host = url.host, host.contains(".") && url.user == nil { let components = host.components(separatedBy: ".") let domain = (components.first ?? "") if domain.isEmpty {