Various improvements

This commit is contained in:
Ilya Laktyushin 2024-08-12 19:43:48 +02:00
parent 5d9d794f15
commit 4d9b98b448
5 changed files with 22 additions and 13 deletions

View File

@ -12804,7 +12804,7 @@ Sorry for the inconvenience.";
"SendStarReactions.SectionTop" = "Top Senders"; "SendStarReactions.SectionTop" = "Top Senders";
"SendStarReactions.ShowMyselfInTop" = "Show me in Top Senders"; "SendStarReactions.ShowMyselfInTop" = "Show me in Top Senders";
"SendStarReactions.SendButtonTitle" = "Send # %@"; "SendStarReactions.SendButtonTitle" = "Send # %@";
"SendStarReactions.TermsOfServiceFooter" = "By sending Stars you agree to the [Terms of Service](https://telegram.org/privacy)"; "SendStarReactions.TermsOfServiceFooter" = "By sending Stars you agree to the [Terms of Service](https://telegram.org/tos/stars)";
"PeerInfo.AllowedReactions.StarReactions" = "Enable Paid Reactions"; "PeerInfo.AllowedReactions.StarReactions" = "Enable Paid Reactions";
"PeerInfo.AllowedReactions.StarReactionsFooter" = "Switch this on to let your subscribers set paid reactions with Telegram Stars, which you will be able to withdraw later as TON. [Learn More >](https://telegram.org/privacy)"; "PeerInfo.AllowedReactions.StarReactionsFooter" = "Switch this on to let your subscribers set paid reactions with Telegram Stars, which you will be able to withdraw later as TON. [Learn More >](https://telegram.org/privacy)";

View File

@ -131,7 +131,6 @@ final class BrowserPdfContent: UIView, BrowserContent, UIScrollViewDelegate, PDF
private var searchResultsCount: Int = 0 private var searchResultsCount: Int = 0
private var searchResults: [PDFSelection] = [] private var searchResults: [PDFSelection] = []
private var searchCompletion: ((Int) -> Void)? private var searchCompletion: ((Int) -> Void)?
private var searchDimmingView: UIView?
private let matchColor = UIColor(rgb: 0xd4d4d, alpha: 0.2) private let matchColor = UIColor(rgb: 0xd4d4d, alpha: 0.2)
private let selectedColor = UIColor(rgb: 0xffe438) private let selectedColor = UIColor(rgb: 0xffe438)
@ -299,9 +298,6 @@ final class BrowserPdfContent: UIView, BrowserContent, UIScrollViewDelegate, PDF
let pdfViewFrame = CGRect(origin: CGPoint(x: insets.left, y: insets.top), size: CGSize(width: size.width - insets.left - insets.right, height: size.height - insets.top - insets.bottom)) let pdfViewFrame = CGRect(origin: CGPoint(x: insets.left, y: insets.top), size: CGSize(width: size.width - insets.left - insets.right, height: size.height - insets.top - insets.bottom))
transition.setFrame(view: self.pdfView, frame: pdfViewFrame) transition.setFrame(view: self.pdfView, frame: pdfViewFrame)
if let searchDimmingView = self.searchDimmingView {
transition.setFrame(view: searchDimmingView, frame: CGRect(origin: .zero, size: self.pdfView.bounds.size))
}
if isFirstTime { if isFirstTime {
self.pdfView.setNeedsLayout() self.pdfView.setNeedsLayout()

View File

@ -84,10 +84,6 @@ final class SearchBarContentComponent: Component {
private var params: Params? private var params: Params?
private var component: SearchBarContentComponent? private var component: SearchBarContentComponent?
public var wantsDisplayBelowKeyboard: Bool {
return self.textField != nil
}
init() { init() {
self.backgroundLayer = SimpleLayer() self.backgroundLayer = SimpleLayer()
@ -177,9 +173,10 @@ final class SearchBarContentComponent: Component {
private func activateTextInput() { private func activateTextInput() {
if self.textField == nil, let textFrame = self.textFrame { if self.textField == nil, let textFrame = self.textFrame {
let backgroundFrame = self.backgroundLayer.frame let backgroundFrame = self.backgroundLayer.frame
let textFieldFrame = CGRect(origin: CGPoint(x: textFrame.minX, y: backgroundFrame.minY), size: CGSize(width: backgroundFrame.maxX - textFrame.minX, height: backgroundFrame.height)) let textFieldFrame = CGRect(origin: CGPoint(x: textFrame.minX, y: backgroundFrame.minY), size: CGSize(width: backgroundFrame.maxX - textFrame.minX - 32.0, height: backgroundFrame.height))
let textField = SearchTextField(frame: textFieldFrame) let textField = SearchTextField(frame: textFieldFrame)
textField.clipsToBounds = true
textField.autocorrectionType = .no textField.autocorrectionType = .no
textField.returnKeyType = .search textField.returnKeyType = .search
self.textField = textField self.textField = textField

View File

@ -32,6 +32,7 @@ swift_library(
"//submodules/AvatarNode", "//submodules/AvatarNode",
"//submodules/Components/BundleIconComponent", "//submodules/Components/BundleIconComponent",
"//submodules/CheckNode", "//submodules/CheckNode",
"//submodules/TextFormat",
], ],
visibility = [ visibility = [
"//visibility:public", "//visibility:public",

View File

@ -19,6 +19,7 @@ import RoundedRectWithTailPath
import AvatarNode import AvatarNode
import BundleIconComponent import BundleIconComponent
import CheckNode import CheckNode
import TextFormat
private final class BalanceComponent: CombinedComponent { private final class BalanceComponent: CombinedComponent {
let context: AccountContext let context: AccountContext
@ -1808,12 +1809,26 @@ private final class ChatSendStarsScreenComponent: Component {
body: MarkdownAttributeSet(font: Font.regular(13.0), textColor: environment.theme.list.itemSecondaryTextColor), body: MarkdownAttributeSet(font: Font.regular(13.0), textColor: environment.theme.list.itemSecondaryTextColor),
bold: MarkdownAttributeSet(font: Font.semibold(13.0), textColor: environment.theme.list.itemSecondaryTextColor), bold: MarkdownAttributeSet(font: Font.semibold(13.0), textColor: environment.theme.list.itemSecondaryTextColor),
link: MarkdownAttributeSet(font: Font.regular(13.0), textColor: environment.theme.list.itemAccentColor), link: MarkdownAttributeSet(font: Font.regular(13.0), textColor: environment.theme.list.itemAccentColor),
linkAttribute: { url in linkAttribute: { contents in
return ("URL", url) return (TelegramTextAttributes.URL, contents)
} }
)), )),
horizontalAlignment: .center, horizontalAlignment: .center,
maximumNumberOfLines: 0 maximumNumberOfLines: 0,
highlightColor: environment.theme.list.itemAccentColor.withAlphaComponent(0.2),
highlightAction: { attributes in
if let _ = attributes[NSAttributedString.Key(rawValue: TelegramTextAttributes.URL)] {
return NSAttributedString.Key(rawValue: TelegramTextAttributes.URL)
} else {
return nil
}
},
tapAction: { [weak self] attributes, _ in
if let controller = self?.environment?.controller(), let navigationController = controller.navigationController as? NavigationController, let url = attributes[NSAttributedString.Key(rawValue: TelegramTextAttributes.URL)] as? String {
let presentationData = component.context.sharedContext.currentPresentationData.with { $0 }
component.context.sharedContext.openExternalUrl(context: component.context, urlContext: .generic, url: url, forceExternal: false, presentationData: presentationData, navigationController: navigationController, dismissInput: {})
}
}
)), )),
environment: {}, environment: {},
containerSize: CGSize(width: availableSize.width - sideInset, height: 1000.0) containerSize: CGSize(width: availableSize.width - sideInset, height: 1000.0)