mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Various fixes
This commit is contained in:
parent
79eb359587
commit
3865e253ff
@ -295,10 +295,6 @@ public func canAddMessageReactions(message: Message) -> Bool {
|
||||
return true
|
||||
}
|
||||
}
|
||||
} else if let story = media as? TelegramMediaStory {
|
||||
if story.isMention {
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
return true
|
||||
|
@ -559,7 +559,7 @@ public final class GiftItemComponent: Component {
|
||||
let price: String
|
||||
switch component.subject {
|
||||
case let .premium(_, priceValue), let .starGift(_, priceValue):
|
||||
if priceValue.containsEmoji {
|
||||
if priceValue.contains("#") {
|
||||
buttonColor = component.theme.overallDarkAppearance ? UIColor(rgb: 0xffc337) : UIColor(rgb: 0xd3720a)
|
||||
if !component.isSoldOut {
|
||||
starsColor = UIColor(rgb: 0xffbe27)
|
||||
@ -868,9 +868,11 @@ public final class GiftItemComponent: Component {
|
||||
)
|
||||
let dateTimeFormat = component.context.sharedContext.currentPresentationData.with { $0 }.dateTimeFormat
|
||||
let labelText = NSMutableAttributedString(attributedString: parseMarkdownIntoAttributedString("# \(presentationStringsFormattedNumber(Int32(resellPrice), dateTimeFormat.groupingSeparator))", attributes: attributes))
|
||||
if let range = labelText.string.range(of: "#") {
|
||||
labelText.addAttribute(NSAttributedString.Key.font, value: Font.semibold(10.0), range: NSRange(range, in: labelText.string))
|
||||
labelText.addAttribute(ChatTextInputAttributes.customEmoji, value: ChatTextInputTextCustomEmojiAttribute(interactivelySelectedFromPackId: nil, fileId: 0, file: nil, custom: .stars(tinted: true)), range: NSRange(range, in: labelText.string))
|
||||
let range = (labelText.string as NSString).range(of: "#")
|
||||
if range.location != NSNotFound {
|
||||
labelText.addAttribute(NSAttributedString.Key.font, value: Font.semibold(10.0), range: range)
|
||||
labelText.addAttribute(ChatTextInputAttributes.customEmoji, value: ChatTextInputTextCustomEmojiAttribute(interactivelySelectedFromPackId: nil, fileId: 0, file: nil, custom: .stars(tinted: true)), range: range)
|
||||
labelText.addAttribute(.kern, value: -2.0, range: NSRange(location: range.lowerBound, length: 1))
|
||||
}
|
||||
|
||||
let resellSize = self.reselLabel.update(
|
||||
@ -1048,11 +1050,13 @@ private final class ButtonContentComponent: Component {
|
||||
self.componentState = state
|
||||
|
||||
let attributedText = NSMutableAttributedString(string: component.text, font: Font.semibold(11.0), textColor: component.color)
|
||||
let range = (attributedText.string as NSString).range(of: "⭐️")
|
||||
let range = (attributedText.string as NSString).range(of: "#")
|
||||
if range.location != NSNotFound {
|
||||
attributedText.addAttribute(ChatTextInputAttributes.customEmoji, value: ChatTextInputTextCustomEmojiAttribute(interactivelySelectedFromPackId: nil, fileId: 0, file: nil, custom: .stars(tinted: component.tinted)), range: range)
|
||||
attributedText.addAttribute(.font, value: Font.semibold(15.0), range: range)
|
||||
attributedText.addAttribute(.baselineOffset, value: 2.0, range: NSRange(location: range.upperBound, length: attributedText.length - range.upperBound))
|
||||
attributedText.addAttribute(.font, value: Font.semibold(component.tinted ? 14.0 : 15.0), range: range)
|
||||
attributedText.addAttribute(.baselineOffset, value: -3.0, range: range)
|
||||
attributedText.addAttribute(.baselineOffset, value: 1.5, range: NSRange(location: range.upperBound + 1, length: attributedText.length - range.upperBound - 1))
|
||||
attributedText.addAttribute(.kern, value: -1.5, range: NSRange(location: range.upperBound, length: 1))
|
||||
}
|
||||
|
||||
let titleSize = self.title.update(
|
||||
|
@ -412,12 +412,12 @@ final class GiftOptionsScreenComponent: Component {
|
||||
if let availability = gift.availability, availability.remains == 0, let minResaleStars = availability.minResaleStars {
|
||||
let priceString = presentationStringsFormattedNumber(Int32(minResaleStars), environment.dateTimeFormat.groupingSeparator)
|
||||
if let resaleConfiguration = self.resaleConfiguration, minResaleStars == resaleConfiguration.starGiftResaleMaxAmount || availability.resale == 1 {
|
||||
subject = .starGift(gift: gift, price: "⭐️ \(priceString)")
|
||||
subject = .starGift(gift: gift, price: "# \(priceString)")
|
||||
} else {
|
||||
subject = .starGift(gift: gift, price: "⭐️ \(priceString)+")
|
||||
subject = .starGift(gift: gift, price: "# \(priceString)+")
|
||||
}
|
||||
} else {
|
||||
subject = .starGift(gift: gift, price: "⭐️ \(presentationStringsFormattedNumber(Int32(gift.price), environment.dateTimeFormat.groupingSeparator))")
|
||||
subject = .starGift(gift: gift, price: "# \(presentationStringsFormattedNumber(Int32(gift.price), environment.dateTimeFormat.groupingSeparator))")
|
||||
}
|
||||
case let .unique(gift):
|
||||
subject = .uniqueGift(gift: gift, price: nil)
|
||||
|
@ -230,7 +230,7 @@ final class GiftStoreScreenComponent: Component {
|
||||
color: ribbonColor
|
||||
)
|
||||
|
||||
let subject: GiftItemComponent.Subject = .uniqueGift(gift: uniqueGift, price: "⭐️\(presentationStringsFormattedNumber(Int32(uniqueGift.resellStars ?? 0), environment.dateTimeFormat.groupingSeparator))")
|
||||
let subject: GiftItemComponent.Subject = .uniqueGift(gift: uniqueGift, price: "# \(presentationStringsFormattedNumber(Int32(uniqueGift.resellStars ?? 0), environment.dateTimeFormat.groupingSeparator))")
|
||||
let _ = visibleItem.update(
|
||||
transition: itemTransition,
|
||||
component: AnyComponent(
|
||||
|
@ -309,6 +309,16 @@ private final class GiftViewSheetContent: CombinedComponent {
|
||||
let context = self.context
|
||||
let action = {
|
||||
if gifts {
|
||||
let profileGifts = ProfileGiftsContext(account: context.account, peerId: peer.id)
|
||||
let _ = (profileGifts.state
|
||||
|> filter { state in
|
||||
if case .ready = state.dataState {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|> take(1)
|
||||
|> deliverOnMainQueue).start(next: { [weak navigationController] _ in
|
||||
if let profileController = context.sharedContext.makePeerInfoController(
|
||||
context: context,
|
||||
updatedPresentationData: nil,
|
||||
@ -318,8 +328,10 @@ private final class GiftViewSheetContent: CombinedComponent {
|
||||
fromChat: false,
|
||||
requestsContext: nil
|
||||
) {
|
||||
navigationController.pushViewController(profileController)
|
||||
navigationController?.pushViewController(profileController)
|
||||
}
|
||||
let _ = profileGifts
|
||||
})
|
||||
} else {
|
||||
context.sharedContext.navigateToChatController(NavigateToChatControllerParams(
|
||||
navigationController: navigationController,
|
||||
|
@ -488,7 +488,7 @@ public final class PeerInfoGiftsPaneNode: ASDisplayNode, PeerInfoPaneNode, UIScr
|
||||
|
||||
switch product.gift {
|
||||
case let .generic(gift):
|
||||
subject = .starGift(gift: gift, price: "⭐️ \(gift.price)")
|
||||
subject = .starGift(gift: gift, price: "# \(gift.price)")
|
||||
peer = product.fromPeer.flatMap { .peer($0) } ?? .anonymous
|
||||
|
||||
if let availability = gift.availability {
|
||||
|
@ -117,6 +117,8 @@ public final class TabSelectorComponent: Component {
|
||||
private let selectionView: UIImageView
|
||||
private var visibleItems: [AnyHashable: VisibleItem] = [:]
|
||||
|
||||
private var didInitiallyScroll = false
|
||||
|
||||
override init(frame: CGRect) {
|
||||
self.selectionView = UIImageView()
|
||||
|
||||
@ -238,11 +240,15 @@ public final class TabSelectorComponent: Component {
|
||||
)),
|
||||
effectAlignment: .center,
|
||||
minSize: nil,
|
||||
action: { [weak self] in
|
||||
action: { [weak self, weak itemView] in
|
||||
guard let self, let component = self.component else {
|
||||
return
|
||||
}
|
||||
component.setSelectedId(itemId)
|
||||
|
||||
if let view = itemView?.title.view, allowScroll && self.contentSize.width > self.bounds.width {
|
||||
self.scrollRectToVisible(view.frame.insetBy(dx: -64.0, dy: 0.0), animated: true)
|
||||
}
|
||||
},
|
||||
animateScale: !isLineSelection
|
||||
)),
|
||||
@ -336,11 +342,15 @@ public final class TabSelectorComponent: Component {
|
||||
self.selectionView.alpha = 0.0
|
||||
}
|
||||
|
||||
self.contentSize = CGSize(width: contentWidth, height: baseHeight + verticalInset * 2.0)
|
||||
let contentSize = CGSize(width: contentWidth, height: baseHeight + verticalInset * 2.0)
|
||||
if self.contentSize != contentSize {
|
||||
self.contentSize = contentSize
|
||||
}
|
||||
self.disablesInteractiveTransitionGestureRecognizer = contentWidth > availableSize.width
|
||||
|
||||
if let selectedBackgroundRect, self.bounds.width > 0.0 {
|
||||
if let selectedBackgroundRect, self.bounds.width > 0.0 && !self.didInitiallyScroll {
|
||||
self.scrollRectToVisible(selectedBackgroundRect.insetBy(dx: -spacing, dy: 0.0), animated: false)
|
||||
self.didInitiallyScroll = true
|
||||
}
|
||||
|
||||
return CGSize(width: min(contentWidth, availableSize.width), height: baseHeight + verticalInset * 2.0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user