Skip to content

Commit 02097cc

Browse files
committed
Add icon
1 parent 5dd0a03 commit 02097cc

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

submodules/TelegramUI/Components/PeerInfo/PeerInfoVisualMediaPaneNode/Sources/PeerInfoGiftsPaneNode.swift

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -775,17 +775,31 @@ public final class PeerInfoGiftsPaneNode: ASDisplayNode, PeerInfoPaneNode, UIScr
775775
let buttonSideInset = sideInset + 16.0
776776

777777
let buttonTitle: String
778+
var buttonIconName: String?
778779
if self.peerId == self.context.account.peerId {
779780
if case .all = self.currentCollection {
780781
buttonTitle = params.presentationData.strings.PeerInfo_Gifts_Send
781782
} else {
782783
buttonTitle = params.presentationData.strings.PeerInfo_Gifts_AddGiftsButton
784+
buttonIconName = "Item List/AddItemIcon"
783785
}
784786
} else {
785787
buttonTitle = params.presentationData.strings.PeerInfo_Gifts_SendGift
786788
}
787789

788790
let buttonAttributedString = NSAttributedString(string: buttonTitle, font: Font.semibold(17.0), textColor: .white, paragraphAlignment: .center)
791+
var buttonTitleContent: AnyComponent<Empty> = AnyComponent(MultilineTextComponent(text: .plain(buttonAttributedString)))
792+
if let buttonIconName {
793+
buttonTitleContent = AnyComponent(HStack([
794+
AnyComponentWithIdentity(id: "_icon", component: AnyComponent(BundleIconComponent(
795+
name: buttonIconName,
796+
tintColor: presentationData.theme.list.itemCheckColors.foregroundColor,
797+
maxSize: CGSize(width: 18.0, height: 18.0)
798+
))),
799+
AnyComponentWithIdentity(id: "_title", component: buttonTitleContent)
800+
], spacing: 7.0))
801+
}
802+
789803
let panelButtonSize = panelButton.update(
790804
transition: transition,
791805
component: AnyComponent(
@@ -796,8 +810,8 @@ public final class PeerInfoGiftsPaneNode: ASDisplayNode, PeerInfoPaneNode, UIScr
796810
pressedColor: presentationData.theme.list.itemCheckColors.fillColor.withMultipliedAlpha(0.8)
797811
),
798812
content: AnyComponentWithIdentity(
799-
id: AnyHashable(buttonAttributedString.string),
800-
component: AnyComponent(MultilineTextComponent(text: .plain(buttonAttributedString)))
813+
id: AnyHashable(buttonTitle),
814+
component: buttonTitleContent
801815
),
802816
isEnabled: true,
803817
action: { [weak self] in

0 commit comments

Comments
 (0)