mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 22:55:00 +00:00
Browser improvements
This commit is contained in:
@@ -280,6 +280,7 @@ final class AddressBarContentComponent: Component {
|
||||
}
|
||||
title = title.idnaDecoded ?? title
|
||||
}
|
||||
|
||||
self.update(theme: component.theme, strings: component.strings, size: availableSize, isActive: isActive, title: title.lowercased(), isSecure: component.isSecure, collapseFraction: collapseFraction, transition: transition)
|
||||
|
||||
return availableSize
|
||||
@@ -438,7 +439,25 @@ final class AddressBarContentComponent: Component {
|
||||
textField.addTarget(self, action: #selector(self.textFieldChanged(_:)), for: .editingChanged)
|
||||
}
|
||||
|
||||
textField.text = self.component?.url ?? ""
|
||||
var address = self.component?.url ?? ""
|
||||
if let components = URLComponents(string: address) {
|
||||
if #available(iOS 16.0, *), let encodedHost = components.encodedHost {
|
||||
if let decodedHost = components.host, encodedHost != decodedHost {
|
||||
address = address.replacingOccurrences(of: encodedHost, with: decodedHost)
|
||||
}
|
||||
} else if let encodedHost = components.host {
|
||||
if let decodedHost = components.host?.idnaDecoded, encodedHost != decodedHost {
|
||||
address = address.replacingOccurrences(of: encodedHost, with: decodedHost)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if textField.text != address {
|
||||
textField.text = address
|
||||
self.clearIconView.isHidden = address.isEmpty
|
||||
self.clearIconButton.isHidden = address.isEmpty
|
||||
self.placeholderContent.view?.isHidden = !address.isEmpty
|
||||
}
|
||||
|
||||
textField.textColor = theme.rootController.navigationSearchBar.inputTextColor
|
||||
transition.setFrame(view: textField, frame: CGRect(origin: CGPoint(x: backgroundFrame.minX + sideInset, y: backgroundFrame.minY - UIScreenPixel), size: CGSize(width: backgroundFrame.width - sideInset - 32.0, height: backgroundFrame.height)))
|
||||
|
||||
Reference in New Issue
Block a user