mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-05 05:51:42 +00:00
Various fixes
This commit is contained in:
parent
cbf23d0df5
commit
f91fbff773
@ -15423,3 +15423,6 @@ Error: %8$@";
|
|||||||
"ChatList.AlertResumeLiveStreamTitle" = "Resume Live Stream";
|
"ChatList.AlertResumeLiveStreamTitle" = "Resume Live Stream";
|
||||||
"ChatList.AlertResumeLiveStreamText" = "Do you want to resume an existing Live Stream?";
|
"ChatList.AlertResumeLiveStreamText" = "Do you want to resume an existing Live Stream?";
|
||||||
"ChatList.AlertResumeLiveStreamAction" = "Resume";
|
"ChatList.AlertResumeLiveStreamAction" = "Resume";
|
||||||
|
|
||||||
|
"Gift.Options.Gift.JoinAuction" = "Join";
|
||||||
|
"Gift.Options.Gift.ViewAuction" = "View";
|
||||||
|
|||||||
@ -400,6 +400,10 @@ public final class SheetComponent<ChildEnvironmentType: Sendable & Equatable>: C
|
|||||||
self.component = component
|
self.component = component
|
||||||
self.currentHasInputHeight = sheetEnvironment.hasInputHeight
|
self.currentHasInputHeight = sheetEnvironment.hasInputHeight
|
||||||
|
|
||||||
|
if self.isAnimatingOut {
|
||||||
|
return availableSize
|
||||||
|
}
|
||||||
|
|
||||||
var glassInset: CGFloat = 0.0
|
var glassInset: CGFloat = 0.0
|
||||||
var topCornerRadius: CGFloat
|
var topCornerRadius: CGFloat
|
||||||
var bottomCornerRadius: CGFloat
|
var bottomCornerRadius: CGFloat
|
||||||
|
|||||||
@ -106,22 +106,6 @@ final class GiftAuctionAccessoryPanel: ASDisplayNode {
|
|||||||
let titleText: String = self.strings.ChatList_Auctions_ActiveAuction(Int32(self.states.count))
|
let titleText: String = self.strings.ChatList_Auctions_ActiveAuction(Int32(self.states.count))
|
||||||
titleItems.append(AnyComponentWithIdentity(id: "label", component: AnyComponent(MultilineTextComponent(text: .plain(NSAttributedString(string: titleText, font: titleFont, textColor: self.theme.rootController.navigationBar.primaryTextColor))))))
|
titleItems.append(AnyComponentWithIdentity(id: "label", component: AnyComponent(MultilineTextComponent(text: .plain(NSAttributedString(string: titleText, font: titleFont, textColor: self.theme.rootController.navigationBar.primaryTextColor))))))
|
||||||
|
|
||||||
let titleSize = self.title.update(
|
|
||||||
transition: .immediate,
|
|
||||||
component: AnyComponent(
|
|
||||||
HStack(titleItems, spacing: 3.0, alignment: .left)
|
|
||||||
),
|
|
||||||
environment: {},
|
|
||||||
containerSize: size
|
|
||||||
)
|
|
||||||
let titleFrame = CGRect(origin: CGPoint(x: 16.0, y: 9.0), size: titleSize)
|
|
||||||
if let titleView = self.title.view {
|
|
||||||
if titleView.superview == nil {
|
|
||||||
self.contentNode.view.addSubview(titleView)
|
|
||||||
}
|
|
||||||
titleView.frame = titleFrame
|
|
||||||
}
|
|
||||||
|
|
||||||
let subtitleText: String
|
let subtitleText: String
|
||||||
var subtitleTextColor = self.theme.rootController.navigationBar.secondaryTextColor
|
var subtitleTextColor = self.theme.rootController.navigationBar.secondaryTextColor
|
||||||
var isOutbid = false
|
var isOutbid = false
|
||||||
@ -195,20 +179,6 @@ final class GiftAuctionAccessoryPanel: ASDisplayNode {
|
|||||||
buttonAnimatedTitleItems.append(AnimatedTextComponent.Item(id: "view", content: .text(self.strings.ChatList_Auctions_View)))
|
buttonAnimatedTitleItems.append(AnimatedTextComponent.Item(id: "view", content: .text(self.strings.ChatList_Auctions_View)))
|
||||||
}
|
}
|
||||||
|
|
||||||
let subtitleSize = self.subtitle.update(
|
|
||||||
transition: .immediate,
|
|
||||||
component: AnyComponent(MultilineTextComponent(text: .plain(NSAttributedString(string: subtitleText, font: subtitleFont, textColor: subtitleTextColor)))),
|
|
||||||
environment: {},
|
|
||||||
containerSize: size
|
|
||||||
)
|
|
||||||
let subtitleFrame = CGRect(origin: CGPoint(x: 16.0, y: 29.0), size: subtitleSize)
|
|
||||||
if let subtitleView = self.subtitle.view {
|
|
||||||
if subtitleView.superview == nil {
|
|
||||||
self.contentNode.view.addSubview(subtitleView)
|
|
||||||
}
|
|
||||||
subtitleView.frame = subtitleFrame
|
|
||||||
}
|
|
||||||
|
|
||||||
let buttonSize = self.button.update(
|
let buttonSize = self.button.update(
|
||||||
transition: .spring(duration: 0.2),
|
transition: .spring(duration: 0.2),
|
||||||
component: AnyComponent(
|
component: AnyComponent(
|
||||||
@ -254,6 +224,36 @@ final class GiftAuctionAccessoryPanel: ASDisplayNode {
|
|||||||
buttonView.frame = buttonFrame
|
buttonView.frame = buttonFrame
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let titleSize = self.title.update(
|
||||||
|
transition: .immediate,
|
||||||
|
component: AnyComponent(
|
||||||
|
HStack(titleItems, spacing: 3.0, alignment: .left)
|
||||||
|
),
|
||||||
|
environment: {},
|
||||||
|
containerSize: CGSize(width: size.width - buttonSize.width - 48.0, height: size.height)
|
||||||
|
)
|
||||||
|
let titleFrame = CGRect(origin: CGPoint(x: 16.0, y: 9.0), size: titleSize)
|
||||||
|
if let titleView = self.title.view {
|
||||||
|
if titleView.superview == nil {
|
||||||
|
self.contentNode.view.addSubview(titleView)
|
||||||
|
}
|
||||||
|
titleView.frame = titleFrame
|
||||||
|
}
|
||||||
|
|
||||||
|
let subtitleSize = self.subtitle.update(
|
||||||
|
transition: .immediate,
|
||||||
|
component: AnyComponent(MultilineTextComponent(text: .plain(NSAttributedString(string: subtitleText, font: subtitleFont, textColor: subtitleTextColor)))),
|
||||||
|
environment: {},
|
||||||
|
containerSize: CGSize(width: size.width - buttonSize.width - 40.0, height: size.height)
|
||||||
|
)
|
||||||
|
let subtitleFrame = CGRect(origin: CGPoint(x: 16.0, y: 29.0), size: subtitleSize)
|
||||||
|
if let subtitleView = self.subtitle.view {
|
||||||
|
if subtitleView.superview == nil {
|
||||||
|
self.contentNode.view.addSubview(subtitleView)
|
||||||
|
}
|
||||||
|
subtitleView.frame = subtitleFrame
|
||||||
|
}
|
||||||
|
|
||||||
transition.updateFrame(node: self.separatorNode, frame: CGRect(origin: CGPoint(x: 0.0, y: 0.0), size: CGSize(width: size.width, height: UIScreenPixel)))
|
transition.updateFrame(node: self.separatorNode, frame: CGRect(origin: CGPoint(x: 0.0, y: 0.0), size: CGSize(width: size.width, height: UIScreenPixel)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -658,7 +658,11 @@ final class GiftOptionsScreenComponent: Component {
|
|||||||
switch gift {
|
switch gift {
|
||||||
case let .generic(gift):
|
case let .generic(gift):
|
||||||
if gift.flags.contains(.isAuction) {
|
if gift.flags.contains(.isAuction) {
|
||||||
subject = .starGift(gift: gift, price: "Join")
|
var action = environment.strings.Gift_Options_Gift_JoinAuction
|
||||||
|
if gift.availability?.remains == 0 {
|
||||||
|
action = environment.strings.Gift_Options_Gift_ViewAuction
|
||||||
|
}
|
||||||
|
subject = .starGift(gift: gift, price: action)
|
||||||
} else if let availability = gift.availability, availability.remains == 0, let minResaleStars = availability.minResaleStars {
|
} else if let availability = gift.availability, availability.remains == 0, let minResaleStars = availability.minResaleStars {
|
||||||
let priceString = presentationStringsFormattedNumber(Int32(minResaleStars), environment.dateTimeFormat.groupingSeparator)
|
let priceString = presentationStringsFormattedNumber(Int32(minResaleStars), environment.dateTimeFormat.groupingSeparator)
|
||||||
if let resaleConfiguration = self.resaleConfiguration, minResaleStars == resaleConfiguration.starGiftResaleMaxStarsAmount || availability.resale == 1 {
|
if let resaleConfiguration = self.resaleConfiguration, minResaleStars == resaleConfiguration.starGiftResaleMaxStarsAmount || availability.resale == 1 {
|
||||||
@ -1823,6 +1827,14 @@ final class GiftOptionsScreenComponent: Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var filteredStarGifts = starGifts
|
var filteredStarGifts = starGifts
|
||||||
|
if peerId.namespace == Namespaces.Peer.CloudChannel {
|
||||||
|
filteredStarGifts = filteredStarGifts?.filter { gift in
|
||||||
|
if case let .generic(gift) = gift, gift.availability != nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
if let disallowedGifts = self.disallowedGifts, !disallowedGifts.isEmpty {
|
if let disallowedGifts = self.disallowedGifts, !disallowedGifts.isEmpty {
|
||||||
filteredStarGifts = filteredStarGifts?.filter { gift in
|
filteredStarGifts = filteredStarGifts?.filter { gift in
|
||||||
if case let .generic(gift) = gift {
|
if case let .generic(gift) = gift {
|
||||||
|
|||||||
@ -889,9 +889,10 @@ private final class GiftSetupScreenComponent: Component {
|
|||||||
if case .regular = environment.metrics.widthClass {
|
if case .regular = environment.metrics.widthClass {
|
||||||
fillingSize = min(availableSize.width, 414.0) - environment.safeInsets.left * 2.0
|
fillingSize = min(availableSize.width, 414.0) - environment.safeInsets.left * 2.0
|
||||||
} else {
|
} else {
|
||||||
fillingSize = min(availableSize.width, 428.0) - environment.safeInsets.left * 2.0
|
fillingSize = min(availableSize.width, environment.deviceMetrics.screenSize.width) - environment.safeInsets.left * 2.0
|
||||||
}
|
}
|
||||||
let sideInset: CGFloat = floor((availableSize.width - fillingSize) * 0.5) + 24.0
|
let rawSideInset: CGFloat = floor((availableSize.width - fillingSize) * 0.5)
|
||||||
|
let sideInset: CGFloat = rawSideInset + 24.0
|
||||||
|
|
||||||
let peerName = self.peerMap[component.peerId]?.compactDisplayTitle ?? ""
|
let peerName = self.peerMap[component.peerId]?.compactDisplayTitle ?? ""
|
||||||
let isSelfGift = component.peerId == component.context.account.peerId
|
let isSelfGift = component.peerId == component.context.account.peerId
|
||||||
@ -1130,7 +1131,7 @@ private final class GiftSetupScreenComponent: Component {
|
|||||||
environment: {},
|
environment: {},
|
||||||
containerSize: CGSize(width: 40.0, height: 40.0)
|
containerSize: CGSize(width: 40.0, height: 40.0)
|
||||||
)
|
)
|
||||||
let closeButtonFrame = CGRect(origin: CGPoint(x: 16.0, y: 16.0), size: closeButtonSize)
|
let closeButtonFrame = CGRect(origin: CGPoint(x: rawSideInset + 16.0, y: 16.0), size: closeButtonSize)
|
||||||
if let closeButtonView = self.closeButton.view {
|
if let closeButtonView = self.closeButton.view {
|
||||||
if closeButtonView.superview == nil {
|
if closeButtonView.superview == nil {
|
||||||
self.navigationBarContainer.addSubview(closeButtonView)
|
self.navigationBarContainer.addSubview(closeButtonView)
|
||||||
@ -1143,64 +1144,6 @@ private final class GiftSetupScreenComponent: Component {
|
|||||||
var initialContentHeight = contentHeight
|
var initialContentHeight = contentHeight
|
||||||
let clippingY: CGFloat
|
let clippingY: CGFloat
|
||||||
|
|
||||||
if case let .starGift(starGift, forceUnique) = component.subject, let availability = starGift.availability, availability.resale > 0 {
|
|
||||||
if let forceUnique, !forceUnique {
|
|
||||||
} else {
|
|
||||||
let resaleSectionSize = self.resaleSection.update(
|
|
||||||
transition: transition,
|
|
||||||
component: AnyComponent(ListSectionComponent(
|
|
||||||
theme: environment.theme,
|
|
||||||
style: .glass,
|
|
||||||
header: nil,
|
|
||||||
footer: nil,
|
|
||||||
items: [
|
|
||||||
AnyComponentWithIdentity(id: 0, component: AnyComponent(ListActionItemComponent(
|
|
||||||
theme: environment.theme,
|
|
||||||
style: .glass,
|
|
||||||
title: AnyComponent(VStack([
|
|
||||||
AnyComponentWithIdentity(id: AnyHashable(0), component: AnyComponent(
|
|
||||||
MultilineTextComponent(
|
|
||||||
text: .plain(NSAttributedString(string: environment.strings.Gift_Send_AvailableForResale, font: Font.regular(presentationData.listsFontSize.baseDisplaySize), textColor: environment.theme.list.itemPrimaryTextColor))
|
|
||||||
)
|
|
||||||
)),
|
|
||||||
], alignment: .left, spacing: 2.0)),
|
|
||||||
accessory: .custom(ListActionItemComponent.CustomAccessory(component: AnyComponentWithIdentity(id: 0, component: AnyComponent(MultilineTextComponent(
|
|
||||||
text: .plain(NSAttributedString(
|
|
||||||
string: presentationStringsFormattedNumber(Int32(availability.resale), environment.dateTimeFormat.groupingSeparator),
|
|
||||||
font: Font.regular(presentationData.listsFontSize.baseDisplaySize),
|
|
||||||
textColor: environment.theme.list.itemSecondaryTextColor
|
|
||||||
)),
|
|
||||||
maximumNumberOfLines: 0
|
|
||||||
))), insets: UIEdgeInsets(top: 0.0, left: 0.0, bottom: 0.0, right: 16.0))),
|
|
||||||
action: { [weak self] _ in
|
|
||||||
guard let self, let component = self.component, let controller = environment.controller() else {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
let storeController = component.context.sharedContext.makeGiftStoreController(
|
|
||||||
context: component.context,
|
|
||||||
peerId: component.peerId,
|
|
||||||
gift: starGift
|
|
||||||
)
|
|
||||||
controller.push(storeController)
|
|
||||||
}
|
|
||||||
)))
|
|
||||||
]
|
|
||||||
)),
|
|
||||||
environment: {},
|
|
||||||
containerSize: CGSize(width: availableSize.width - sideInset * 2.0, height: 10000.0)
|
|
||||||
)
|
|
||||||
let resaleSectionFrame = CGRect(origin: CGPoint(x: sideInset, y: contentHeight), size: resaleSectionSize)
|
|
||||||
if let resaleSectionView = self.resaleSection.view {
|
|
||||||
if resaleSectionView.superview == nil {
|
|
||||||
self.scrollContentView.addSubview(resaleSectionView)
|
|
||||||
}
|
|
||||||
transition.setFrame(view: resaleSectionView, frame: resaleSectionFrame)
|
|
||||||
}
|
|
||||||
contentHeight += resaleSectionSize.height
|
|
||||||
contentHeight += sectionSpacing
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let giftConfiguration = GiftConfiguration.with(appConfiguration: component.context.currentAppConfiguration.with { $0 })
|
let giftConfiguration = GiftConfiguration.with(appConfiguration: component.context.currentAppConfiguration.with { $0 })
|
||||||
|
|
||||||
let footerAttributes = MarkdownAttributes(
|
let footerAttributes = MarkdownAttributes(
|
||||||
@ -1211,45 +1154,7 @@ private final class GiftSetupScreenComponent: Component {
|
|||||||
return (TelegramTextAttributes.URL, contents)
|
return (TelegramTextAttributes.URL, contents)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
// let introFooter: AnyComponent<Empty>?
|
|
||||||
// switch component.subject {
|
|
||||||
// case .premium:
|
|
||||||
// introFooter = AnyComponent(MultilineTextComponent(
|
|
||||||
// text: .plain(NSAttributedString(
|
|
||||||
// string: environment.strings.Gift_Send_Customize_Info(peerName).string,
|
|
||||||
// font: Font.regular(presentationData.listsFontSize.itemListBaseHeaderFontSize),
|
|
||||||
// textColor: environment.theme.list.freeTextColor
|
|
||||||
// )),
|
|
||||||
// maximumNumberOfLines: 0
|
|
||||||
// ))
|
|
||||||
// case .starGift:
|
|
||||||
// introFooter = nil
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// let introSectionSize = self.introSection.update(
|
|
||||||
// transition: transition,
|
|
||||||
// component: AnyComponent(ListSectionComponent(
|
|
||||||
// theme: environment.theme,
|
|
||||||
// style: .glass,
|
|
||||||
// header: nil,
|
|
||||||
// footer: introFooter,
|
|
||||||
// items: introSectionItems
|
|
||||||
// )),
|
|
||||||
// environment: {},
|
|
||||||
// containerSize: CGSize(width: availableSize.width - sideInset * 2.0, height: 10000.0)
|
|
||||||
// )
|
|
||||||
// let introSectionFrame = CGRect(origin: CGPoint(x: sideInset, y: contentHeight), size: introSectionSize)
|
|
||||||
// if let introSectionView = self.introSection.view {
|
|
||||||
// if introSectionView.superview == nil {
|
|
||||||
// self.scrollContentView.addSubview(introSectionView)
|
|
||||||
// self.introSection.parentState = state
|
|
||||||
// }
|
|
||||||
// transition.setFrame(view: introSectionView, frame: introSectionFrame)
|
|
||||||
// }
|
|
||||||
// contentHeight += introSectionSize.height
|
|
||||||
// contentHeight += sectionSpacing
|
|
||||||
|
|
||||||
var inputHeight: CGFloat = 0.0
|
var inputHeight: CGFloat = 0.0
|
||||||
inputHeight += self.updateInputMediaNode(
|
inputHeight += self.updateInputMediaNode(
|
||||||
component: component,
|
component: component,
|
||||||
@ -1270,7 +1175,7 @@ private final class GiftSetupScreenComponent: Component {
|
|||||||
}
|
}
|
||||||
self.previousInputHeight = inputHeight
|
self.previousInputHeight = inputHeight
|
||||||
|
|
||||||
let listItemParams = ListViewItemLayoutParams(width: availableSize.width, leftInset: 0.0, rightInset: 0.0, availableHeight: 10000.0, isStandalone: true)
|
let listItemParams = ListViewItemLayoutParams(width: fillingSize, leftInset: 0.0, rightInset: 0.0, availableHeight: 10000.0, isStandalone: true)
|
||||||
var introContentSize = CGSize()
|
var introContentSize = CGSize()
|
||||||
if let accountPeer = self.peerMap[component.context.account.peerId] {
|
if let accountPeer = self.peerMap[component.context.account.peerId] {
|
||||||
var inputPanelSize = CGSize()
|
var inputPanelSize = CGSize()
|
||||||
@ -1377,7 +1282,7 @@ private final class GiftSetupScreenComponent: Component {
|
|||||||
chatLocation: nil
|
chatLocation: nil
|
||||||
)),
|
)),
|
||||||
environment: {},
|
environment: {},
|
||||||
containerSize: CGSize(width: availableSize.width - inputPanelInset * 2.0, height: 160.0)
|
containerSize: CGSize(width: fillingSize - inputPanelInset * 2.0, height: 160.0)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1410,6 +1315,10 @@ private final class GiftSetupScreenComponent: Component {
|
|||||||
if let inputPanelView = self.inputPanel.view as? MessageInputPanelComponent.View, case let .text(text) = inputPanelView.getSendMessageInput(applyAutocorrection: false) {
|
if let inputPanelView = self.inputPanel.view as? MessageInputPanelComponent.View, case let .text(text) = inputPanelView.getSendMessageInput(applyAutocorrection: false) {
|
||||||
textInputText = text
|
textInputText = text
|
||||||
}
|
}
|
||||||
|
var inputBottomInset: CGFloat = inputPanelSize.height - 26.0
|
||||||
|
if component.peerId == component.context.account.peerId {
|
||||||
|
inputBottomInset += 8.0
|
||||||
|
}
|
||||||
introContentSize = self.introContent.update(
|
introContentSize = self.introContent.update(
|
||||||
transition: transition,
|
transition: transition,
|
||||||
component: AnyComponent(
|
component: AnyComponent(
|
||||||
@ -1432,13 +1341,13 @@ private final class GiftSetupScreenComponent: Component {
|
|||||||
entities: generateChatInputTextEntities(textInputText),
|
entities: generateChatInputTextEntities(textInputText),
|
||||||
upgradeStars: self.includeUpgrade ? upgradeStars : nil,
|
upgradeStars: self.includeUpgrade ? upgradeStars : nil,
|
||||||
chargeStars: nil,
|
chargeStars: nil,
|
||||||
bottomInset: max(0.0, inputPanelSize.height - 26.0)
|
bottomInset: max(0.0, inputBottomInset)
|
||||||
),
|
),
|
||||||
params: listItemParams
|
params: listItemParams
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
environment: {},
|
environment: {},
|
||||||
containerSize: CGSize(width: availableSize.width, height: 10000.0)
|
containerSize: CGSize(width: fillingSize, height: 10000.0)
|
||||||
)
|
)
|
||||||
if let introContentView = self.introContent.view {
|
if let introContentView = self.introContent.view {
|
||||||
if introContentView.superview == nil {
|
if introContentView.superview == nil {
|
||||||
@ -1449,10 +1358,10 @@ private final class GiftSetupScreenComponent: Component {
|
|||||||
self.scrollContentView.addSubview(introContentView)
|
self.scrollContentView.addSubview(introContentView)
|
||||||
introContentView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(self.previewTap)))
|
introContentView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(self.previewTap)))
|
||||||
}
|
}
|
||||||
transition.setFrame(view: introContentView, frame: CGRect(origin: CGPoint(), size: introContentSize))
|
transition.setFrame(view: introContentView, frame: CGRect(origin: CGPoint(x: rawSideInset, y: 0.0), size: introContentSize))
|
||||||
}
|
}
|
||||||
|
|
||||||
let inputPanelFrame = CGRect(origin: CGPoint(x: inputPanelInset, y: contentHeight + introContentSize.height - inputPanelInset - inputPanelSize.height + 6.0), size: inputPanelSize)
|
let inputPanelFrame = CGRect(origin: CGPoint(x: rawSideInset + inputPanelInset, y: contentHeight + introContentSize.height - inputPanelInset - inputPanelSize.height + 6.0), size: inputPanelSize)
|
||||||
if let inputPanelView = self.inputPanel.view {
|
if let inputPanelView = self.inputPanel.view {
|
||||||
if inputPanelView.superview == nil {
|
if inputPanelView.superview == nil {
|
||||||
self.scrollContentView.addSubview(inputPanelView)
|
self.scrollContentView.addSubview(inputPanelView)
|
||||||
@ -1463,6 +1372,64 @@ private final class GiftSetupScreenComponent: Component {
|
|||||||
contentHeight += introContentSize.height
|
contentHeight += introContentSize.height
|
||||||
contentHeight += sectionSpacing
|
contentHeight += sectionSpacing
|
||||||
|
|
||||||
|
if case let .starGift(starGift, forceUnique) = component.subject, let availability = starGift.availability, availability.resale > 0 {
|
||||||
|
if let forceUnique, !forceUnique {
|
||||||
|
} else {
|
||||||
|
let resaleSectionSize = self.resaleSection.update(
|
||||||
|
transition: transition,
|
||||||
|
component: AnyComponent(ListSectionComponent(
|
||||||
|
theme: environment.theme,
|
||||||
|
style: .glass,
|
||||||
|
header: nil,
|
||||||
|
footer: nil,
|
||||||
|
items: [
|
||||||
|
AnyComponentWithIdentity(id: 0, component: AnyComponent(ListActionItemComponent(
|
||||||
|
theme: environment.theme,
|
||||||
|
style: .glass,
|
||||||
|
title: AnyComponent(VStack([
|
||||||
|
AnyComponentWithIdentity(id: AnyHashable(0), component: AnyComponent(
|
||||||
|
MultilineTextComponent(
|
||||||
|
text: .plain(NSAttributedString(string: environment.strings.Gift_Send_AvailableForResale, font: Font.regular(presentationData.listsFontSize.baseDisplaySize), textColor: environment.theme.list.itemPrimaryTextColor))
|
||||||
|
)
|
||||||
|
)),
|
||||||
|
], alignment: .left, spacing: 2.0)),
|
||||||
|
accessory: .custom(ListActionItemComponent.CustomAccessory(component: AnyComponentWithIdentity(id: 0, component: AnyComponent(MultilineTextComponent(
|
||||||
|
text: .plain(NSAttributedString(
|
||||||
|
string: presentationStringsFormattedNumber(Int32(availability.resale), environment.dateTimeFormat.groupingSeparator),
|
||||||
|
font: Font.regular(presentationData.listsFontSize.baseDisplaySize),
|
||||||
|
textColor: environment.theme.list.itemSecondaryTextColor
|
||||||
|
)),
|
||||||
|
maximumNumberOfLines: 0
|
||||||
|
))), insets: UIEdgeInsets(top: 0.0, left: 0.0, bottom: 0.0, right: 16.0))),
|
||||||
|
action: { [weak self] _ in
|
||||||
|
guard let self, let component = self.component, let controller = environment.controller() else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
let storeController = component.context.sharedContext.makeGiftStoreController(
|
||||||
|
context: component.context,
|
||||||
|
peerId: component.peerId,
|
||||||
|
gift: starGift
|
||||||
|
)
|
||||||
|
controller.push(storeController)
|
||||||
|
}
|
||||||
|
)))
|
||||||
|
]
|
||||||
|
)),
|
||||||
|
environment: {},
|
||||||
|
containerSize: CGSize(width: availableSize.width - sideInset * 2.0, height: 10000.0)
|
||||||
|
)
|
||||||
|
let resaleSectionFrame = CGRect(origin: CGPoint(x: sideInset, y: contentHeight), size: resaleSectionSize)
|
||||||
|
if let resaleSectionView = self.resaleSection.view {
|
||||||
|
if resaleSectionView.superview == nil {
|
||||||
|
self.scrollContentView.addSubview(resaleSectionView)
|
||||||
|
}
|
||||||
|
transition.setFrame(view: resaleSectionView, frame: resaleSectionFrame)
|
||||||
|
}
|
||||||
|
contentHeight += resaleSectionSize.height
|
||||||
|
contentHeight += sectionSpacing
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch component.subject {
|
switch component.subject {
|
||||||
case let .premium(product):
|
case let .premium(product):
|
||||||
let balance = component.context.starsContext?.currentState?.balance.value ?? 0
|
let balance = component.context.starsContext?.currentState?.balance.value ?? 0
|
||||||
@ -1945,19 +1912,19 @@ private final class GiftSetupScreenComponent: Component {
|
|||||||
}
|
}
|
||||||
)),
|
)),
|
||||||
environment: {},
|
environment: {},
|
||||||
containerSize: CGSize(width: availableSize.width - buttonInsets.left - buttonInsets.right, height: buttonHeight)
|
containerSize: CGSize(width: fillingSize - buttonInsets.left - buttonInsets.right, height: buttonHeight)
|
||||||
)
|
)
|
||||||
var bottomPanelHeight = 13.0 + buttonInsets.bottom + actionButtonSize.height
|
var bottomPanelHeight = 13.0 + buttonInsets.bottom + actionButtonSize.height
|
||||||
|
|
||||||
let bottomEdgeEffectHeight: CGFloat = bottomPanelHeight
|
let bottomEdgeEffectHeight: CGFloat = bottomPanelHeight
|
||||||
let bottomEdgeEffectFrame = CGRect(origin: CGPoint(x: 0.0, y: availableSize.height - bottomEdgeEffectHeight), size: CGSize(width: availableSize.width, height: bottomEdgeEffectHeight))
|
let bottomEdgeEffectFrame = CGRect(origin: CGPoint(x: rawSideInset, y: availableSize.height - bottomEdgeEffectHeight), size: CGSize(width: fillingSize, height: bottomEdgeEffectHeight))
|
||||||
transition.setFrame(view: self.bottomEdgeEffectView, frame: bottomEdgeEffectFrame)
|
transition.setFrame(view: self.bottomEdgeEffectView, frame: bottomEdgeEffectFrame)
|
||||||
self.bottomEdgeEffectView.update(content: environment.theme.actionSheet.opaqueItemBackgroundColor, blur: true, alpha: 1.0, rect: bottomEdgeEffectFrame, edge: .bottom, edgeSize: bottomEdgeEffectFrame.height, transition: transition)
|
self.bottomEdgeEffectView.update(content: environment.theme.actionSheet.opaqueItemBackgroundColor, blur: true, alpha: 1.0, rect: bottomEdgeEffectFrame, edge: .bottom, edgeSize: bottomEdgeEffectFrame.height, transition: transition)
|
||||||
if self.bottomEdgeEffectView.superview == nil {
|
if self.bottomEdgeEffectView.superview == nil {
|
||||||
self.containerView.addSubview(self.bottomEdgeEffectView)
|
self.containerView.addSubview(self.bottomEdgeEffectView)
|
||||||
}
|
}
|
||||||
|
|
||||||
let actionButtonFrame = CGRect(origin: CGPoint(x: buttonInsets.left, y: availableSize.height - buttonInsets.bottom - actionButtonSize.height), size: actionButtonSize)
|
let actionButtonFrame = CGRect(origin: CGPoint(x: rawSideInset + buttonInsets.left, y: availableSize.height - buttonInsets.bottom - actionButtonSize.height), size: actionButtonSize)
|
||||||
if let buttonView = self.actionButton.view {
|
if let buttonView = self.actionButton.view {
|
||||||
if buttonView.superview == nil {
|
if buttonView.superview == nil {
|
||||||
self.containerView.addSubview(buttonView)
|
self.containerView.addSubview(buttonView)
|
||||||
@ -2086,7 +2053,11 @@ public class GiftSetupScreen: ViewControllerComponentContainer {
|
|||||||
self.didPlayAppearAnimation = true
|
self.didPlayAppearAnimation = true
|
||||||
|
|
||||||
if let componentView = self.node.hostView.componentView as? GiftSetupScreenComponent.View {
|
if let componentView = self.node.hostView.componentView as? GiftSetupScreenComponent.View {
|
||||||
componentView.animateIn()
|
componentView.alpha = 0.0
|
||||||
|
Queue.mainQueue().after(0.01, {
|
||||||
|
componentView.alpha = 1.0
|
||||||
|
componentView.animateIn()
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -291,7 +291,7 @@ private final class GiftAuctionAcquiredScreenComponent: Component {
|
|||||||
if case .regular = environment.metrics.widthClass {
|
if case .regular = environment.metrics.widthClass {
|
||||||
fillingSize = min(availableSize.width, 414.0) - environment.safeInsets.left * 2.0
|
fillingSize = min(availableSize.width, 414.0) - environment.safeInsets.left * 2.0
|
||||||
} else {
|
} else {
|
||||||
fillingSize = min(availableSize.width, 428.0) - environment.safeInsets.left * 2.0
|
fillingSize = min(availableSize.width, environment.deviceMetrics.screenSize.width) - environment.safeInsets.left * 2.0
|
||||||
}
|
}
|
||||||
let rawSideInset = floor((availableSize.width - fillingSize) * 0.5)
|
let rawSideInset = floor((availableSize.width - fillingSize) * 0.5)
|
||||||
let sideInset: CGFloat = floor((availableSize.width - fillingSize) * 0.5) + 24.0
|
let sideInset: CGFloat = floor((availableSize.width - fillingSize) * 0.5) + 24.0
|
||||||
|
|||||||
@ -250,9 +250,10 @@ private final class GiftAuctionActiveBidsScreenComponent: Component {
|
|||||||
if case .regular = environment.metrics.widthClass {
|
if case .regular = environment.metrics.widthClass {
|
||||||
fillingSize = min(availableSize.width, 414.0) - environment.safeInsets.left * 2.0
|
fillingSize = min(availableSize.width, 414.0) - environment.safeInsets.left * 2.0
|
||||||
} else {
|
} else {
|
||||||
fillingSize = min(availableSize.width, 428.0) - environment.safeInsets.left * 2.0
|
fillingSize = min(availableSize.width, environment.deviceMetrics.screenSize.width) - environment.safeInsets.left * 2.0
|
||||||
}
|
}
|
||||||
let sideInset: CGFloat = floor((availableSize.width - fillingSize) * 0.5) + 16.0
|
let rawSideInset: CGFloat = floor((availableSize.width - fillingSize) * 0.5)
|
||||||
|
let sideInset: CGFloat = rawSideInset + 16.0
|
||||||
|
|
||||||
if self.component == nil, let giftAuctionsManager = component.context.giftAuctionsManager {
|
if self.component == nil, let giftAuctionsManager = component.context.giftAuctionsManager {
|
||||||
self.auctionStatesDisposable = (giftAuctionsManager.state
|
self.auctionStatesDisposable = (giftAuctionsManager.state
|
||||||
@ -403,7 +404,7 @@ private final class GiftAuctionActiveBidsScreenComponent: Component {
|
|||||||
environment: {},
|
environment: {},
|
||||||
containerSize: CGSize(width: 40.0, height: 40.0)
|
containerSize: CGSize(width: 40.0, height: 40.0)
|
||||||
)
|
)
|
||||||
let closeButtonFrame = CGRect(origin: CGPoint(x: 16.0, y: 16.0), size: closeButtonSize)
|
let closeButtonFrame = CGRect(origin: CGPoint(x: rawSideInset + 16.0, y: 16.0), size: closeButtonSize)
|
||||||
if let closeButtonView = self.closeButton.view {
|
if let closeButtonView = self.closeButton.view {
|
||||||
if closeButtonView.superview == nil {
|
if closeButtonView.superview == nil {
|
||||||
self.navigationBarContainer.addSubview(closeButtonView)
|
self.navigationBarContainer.addSubview(closeButtonView)
|
||||||
@ -438,7 +439,7 @@ private final class GiftAuctionActiveBidsScreenComponent: Component {
|
|||||||
initialContentHeight = contentHeight
|
initialContentHeight = contentHeight
|
||||||
|
|
||||||
let edgeEffectHeight: CGFloat = 80.0
|
let edgeEffectHeight: CGFloat = 80.0
|
||||||
let edgeEffectFrame = CGRect(origin: CGPoint(x: 0.0, y: 0.0), size: CGSize(width: availableSize.width, height: edgeEffectHeight))
|
let edgeEffectFrame = CGRect(origin: CGPoint(x: rawSideInset, y: 0.0), size: CGSize(width: fillingSize, height: edgeEffectHeight))
|
||||||
transition.setFrame(view: self.topEdgeEffectView, frame: edgeEffectFrame)
|
transition.setFrame(view: self.topEdgeEffectView, frame: edgeEffectFrame)
|
||||||
self.topEdgeEffectView.update(content: environment.theme.actionSheet.opaqueItemBackgroundColor, blur: true, alpha: 1.0, rect: edgeEffectFrame, edge: .top, edgeSize: edgeEffectFrame.height, transition: transition)
|
self.topEdgeEffectView.update(content: environment.theme.actionSheet.opaqueItemBackgroundColor, blur: true, alpha: 1.0, rect: edgeEffectFrame, edge: .top, edgeSize: edgeEffectFrame.height, transition: transition)
|
||||||
if self.topEdgeEffectView.superview == nil {
|
if self.topEdgeEffectView.superview == nil {
|
||||||
|
|||||||
@ -912,7 +912,7 @@ private final class SliderBackgroundComponent: Component {
|
|||||||
topBackgroundTextView.layer.animateSpring(from: NSValue(cgPoint: CGPoint(x: animateTopTextAdditionalX, y: 0.0)), to: NSValue(cgPoint: CGPoint()), keyPath: "position", duration: 0.3, damping: 100.0, additive: true)
|
topBackgroundTextView.layer.animateSpring(from: NSValue(cgPoint: CGPoint(x: animateTopTextAdditionalX, y: 0.0)), to: NSValue(cgPoint: CGPoint()), keyPath: "position", duration: 0.3, damping: 100.0, additive: true)
|
||||||
}
|
}
|
||||||
|
|
||||||
topForegroundTextView.isHidden = component.topCutoff == nil || topLineFrame.maxX + topTextSize.width + 20.0 > availableSize.width
|
topForegroundTextView.isHidden = component.topCutoff == nil || topTextFrame.maxX > availableSize.width - 28.0
|
||||||
topBackgroundTextView.isHidden = topForegroundTextView.isHidden
|
topBackgroundTextView.isHidden = topForegroundTextView.isHidden
|
||||||
self.topBackgroundLine.isHidden = topX < 10.0
|
self.topBackgroundLine.isHidden = topX < 10.0
|
||||||
self.topForegroundLine.isHidden = self.topBackgroundLine.isHidden
|
self.topForegroundLine.isHidden = self.topBackgroundLine.isHidden
|
||||||
@ -1438,7 +1438,7 @@ private final class GiftAuctionBidScreenComponent: Component {
|
|||||||
|
|
||||||
private var isLoading = false
|
private var isLoading = false
|
||||||
private func commitBid(value: Int64) {
|
private func commitBid(value: Int64) {
|
||||||
guard let component = self.component, case let .generic(gift) = component.gift, let controller = self.environment?.controller() else {
|
guard let component = self.component, let environment = self.environment, let controller = self.environment?.controller(), let balance = self.balance, case let .generic(gift) = component.gift else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1447,7 +1447,9 @@ private final class GiftAuctionBidScreenComponent: Component {
|
|||||||
if let peerId = self.giftAuctionState?.myState.bidPeerId {
|
if let peerId = self.giftAuctionState?.myState.bidPeerId {
|
||||||
myBidPeerId = peerId
|
myBidPeerId = peerId
|
||||||
}
|
}
|
||||||
|
var requiredStars = value
|
||||||
if let myBidAmount = self.giftAuctionState?.myState.bidAmount {
|
if let myBidAmount = self.giftAuctionState?.myState.bidAmount {
|
||||||
|
requiredStars = requiredStars - myBidAmount
|
||||||
isUpdate = true
|
isUpdate = true
|
||||||
if value == myBidAmount {
|
if value == myBidAmount {
|
||||||
controller.dismiss()
|
controller.dismiss()
|
||||||
@ -1455,6 +1457,29 @@ private final class GiftAuctionBidScreenComponent: Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if balance < StarsAmount(value: requiredStars, nanos: 0) {
|
||||||
|
let _ = (component.context.engine.payments.starsTopUpOptions()
|
||||||
|
|> take(1)
|
||||||
|
|> deliverOnMainQueue).startStandalone(next: { [weak self] options in
|
||||||
|
guard let self, let component = self.component else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
guard let starsContext = component.context.starsContext else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
let purchasePurpose: StarsPurchasePurpose = .generic
|
||||||
|
let purchaseScreen = component.context.sharedContext.makeStarsPurchaseScreen(context: component.context, starsContext: starsContext, options: options, purpose: purchasePurpose, targetPeerId: nil, customTheme: environment.theme, completion: { result in
|
||||||
|
let _ = result
|
||||||
|
//TODO:release
|
||||||
|
})
|
||||||
|
self.environment?.controller()?.push(purchaseScreen)
|
||||||
|
self.environment?.controller()?.dismiss()
|
||||||
|
})
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
let giftsPerRounds = gift.auctionGiftsPerRound ?? 50
|
let giftsPerRounds = gift.auctionGiftsPerRound ?? 50
|
||||||
|
|
||||||
let presentationData = component.context.sharedContext.currentPresentationData.with { $0 }
|
let presentationData = component.context.sharedContext.currentPresentationData.with { $0 }
|
||||||
@ -1795,7 +1820,7 @@ private final class GiftAuctionBidScreenComponent: Component {
|
|||||||
if case .regular = environment.metrics.widthClass {
|
if case .regular = environment.metrics.widthClass {
|
||||||
fillingSize = min(availableSize.width, 414.0) - environment.safeInsets.left * 2.0
|
fillingSize = min(availableSize.width, 414.0) - environment.safeInsets.left * 2.0
|
||||||
} else {
|
} else {
|
||||||
fillingSize = min(availableSize.width, 428.0) - environment.safeInsets.left * 2.0
|
fillingSize = min(availableSize.width, environment.deviceMetrics.screenSize.width) - environment.safeInsets.left * 2.0
|
||||||
}
|
}
|
||||||
let rawSideInset = floor((availableSize.width - fillingSize) * 0.5)
|
let rawSideInset = floor((availableSize.width - fillingSize) * 0.5)
|
||||||
let sideInset: CGFloat = floor((availableSize.width - fillingSize) * 0.5) + 24.0
|
let sideInset: CGFloat = floor((availableSize.width - fillingSize) * 0.5) + 24.0
|
||||||
@ -2019,7 +2044,7 @@ private final class GiftAuctionBidScreenComponent: Component {
|
|||||||
var sliderColor: UIColor = UIColor(rgb: 0xFFB10D)
|
var sliderColor: UIColor = UIColor(rgb: 0xFFB10D)
|
||||||
|
|
||||||
let liveStreamParams = LiveChatMessageParams(appConfig: component.context.currentAppConfiguration.with({ $0 }))
|
let liveStreamParams = LiveChatMessageParams(appConfig: component.context.currentAppConfiguration.with({ $0 }))
|
||||||
let color = GroupCallMessagesContext.getStarAmountParamMapping(params: liveStreamParams, value: Int64(self.amount.realValue)).color ?? GroupCallMessagesContext.Message.Color(rawValue: 0x985FDC)
|
let color = GroupCallMessagesContext.getStarAmountParamMapping(params: liveStreamParams, value: Int64(self.amount.realValue / 5)).color ?? GroupCallMessagesContext.Message.Color(rawValue: 0x985FDC)
|
||||||
sliderColor = StoryLiveChatMessageComponent.getMessageColor(color: color)
|
sliderColor = StoryLiveChatMessageComponent.getMessageColor(color: color)
|
||||||
|
|
||||||
var giftsPerRound: Int32 = 50
|
var giftsPerRound: Int32 = 50
|
||||||
@ -2546,6 +2571,7 @@ private final class GiftAuctionBidScreenComponent: Component {
|
|||||||
if let topPeerItemView = topPeerItem.view {
|
if let topPeerItemView = topPeerItem.view {
|
||||||
if topPeerItemView.superview == nil {
|
if topPeerItemView.superview == nil {
|
||||||
self.scrollContentView.addSubview(topPeerItemView)
|
self.scrollContentView.addSubview(topPeerItemView)
|
||||||
|
transition.animateAlpha(view: topPeerItemView, from: 0.0, to: 1.0)
|
||||||
}
|
}
|
||||||
topPeerItemView.frame = topPeerItemFrame
|
topPeerItemView.frame = topPeerItemFrame
|
||||||
}
|
}
|
||||||
@ -2635,33 +2661,7 @@ private final class GiftAuctionBidScreenComponent: Component {
|
|||||||
isEnabled: true,
|
isEnabled: true,
|
||||||
displaysProgress: self.isLoading,
|
displaysProgress: self.isLoading,
|
||||||
action: { [weak self] in
|
action: { [weak self] in
|
||||||
guard let self, let component = self.component else {
|
guard let self else {
|
||||||
return
|
|
||||||
}
|
|
||||||
guard let balance = self.balance else {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if balance < StarsAmount(value: Int64(self.amount.realValue), nanos: 0) {
|
|
||||||
let _ = (component.context.engine.payments.starsTopUpOptions()
|
|
||||||
|> take(1)
|
|
||||||
|> deliverOnMainQueue).startStandalone(next: { [weak self] options in
|
|
||||||
guard let self, let component = self.component else {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
guard let starsContext = component.context.starsContext else {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
let purchasePurpose: StarsPurchasePurpose = .generic
|
|
||||||
let purchaseScreen = component.context.sharedContext.makeStarsPurchaseScreen(context: component.context, starsContext: starsContext, options: options, purpose: purchasePurpose, targetPeerId: nil, customTheme: environment.theme, completion: { result in
|
|
||||||
let _ = result
|
|
||||||
//TODO:release
|
|
||||||
})
|
|
||||||
self.environment?.controller()?.push(purchaseScreen)
|
|
||||||
self.environment?.controller()?.dismiss()
|
|
||||||
})
|
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
self.commitBid(value: Int64(self.amount.realValue))
|
self.commitBid(value: Int64(self.amount.realValue))
|
||||||
|
|||||||
@ -208,15 +208,17 @@ private final class GiftAuctionCustomBidAlertContentNode: AlertContentNode {
|
|||||||
environment: {},
|
environment: {},
|
||||||
containerSize: CGSize(width: fieldWidth, height: 44.0)
|
containerSize: CGSize(width: fieldWidth, height: 44.0)
|
||||||
)
|
)
|
||||||
let amountFieldFrame = CGRect(origin: CGPoint(x: floor((resultWidth - fieldWidth) / 2.0), y: origin.y - 2.0), size: amountFieldSize)
|
var amountFieldFrame = CGRect(origin: CGPoint(x: floor((resultWidth - fieldWidth) / 2.0), y: origin.y - 2.0), size: amountFieldSize)
|
||||||
if let amountFieldView = self.amountField.view {
|
if let amountFieldView = self.amountField.view {
|
||||||
if amountFieldView.superview == nil {
|
if amountFieldView.superview == nil {
|
||||||
|
amountFieldView.clipsToBounds = true
|
||||||
self.backgroundView.image = generateStretchableFilledCircleImage(diameter: 12.0, color: self.theme.actionSheet.inputHollowBackgroundColor, strokeColor: self.theme.actionSheet.inputBorderColor, strokeWidth: 1.0)
|
self.backgroundView.image = generateStretchableFilledCircleImage(diameter: 12.0, color: self.theme.actionSheet.inputHollowBackgroundColor, strokeColor: self.theme.actionSheet.inputBorderColor, strokeWidth: 1.0)
|
||||||
|
|
||||||
self.view.addSubview(self.backgroundView)
|
self.view.addSubview(self.backgroundView)
|
||||||
self.view.addSubview(amountFieldView)
|
self.view.addSubview(amountFieldView)
|
||||||
}
|
}
|
||||||
self.backgroundView.frame = amountFieldFrame.insetBy(dx: 7.0, dy: 9.0)
|
self.backgroundView.frame = amountFieldFrame.insetBy(dx: 7.0, dy: 9.0)
|
||||||
|
amountFieldFrame.size.width -= 14.0
|
||||||
amountFieldView.frame = amountFieldFrame
|
amountFieldView.frame = amountFieldFrame
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -5640,10 +5640,13 @@ final class PeerCellComponent: Component {
|
|||||||
let avatarSize = CGSize(width: 22.0, height: 22.0)
|
let avatarSize = CGSize(width: 22.0, height: 22.0)
|
||||||
let spacing: CGFloat = 6.0
|
let spacing: CGFloat = 6.0
|
||||||
|
|
||||||
let peerName: String
|
var peerName: String
|
||||||
let avatarOverride: AvatarNodeImageOverride?
|
let avatarOverride: AvatarNodeImageOverride?
|
||||||
if let peerValue = component.peer {
|
if let peerValue = component.peer {
|
||||||
peerName = peerValue.compactDisplayTitle
|
peerName = peerValue.compactDisplayTitle
|
||||||
|
if peerName.count > 40 {
|
||||||
|
peerName = "\(peerName.prefix(40))…"
|
||||||
|
}
|
||||||
avatarOverride = nil
|
avatarOverride = nil
|
||||||
} else {
|
} else {
|
||||||
peerName = component.strings.Gift_View_HiddenName
|
peerName = component.strings.Gift_View_HiddenName
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user