From 95b074de14b3b6a992eb4eb239ce1b23614347b9 Mon Sep 17 00:00:00 2001 From: Ilya Laktyushin Date: Mon, 8 Dec 2025 19:08:32 +0400 Subject: [PATCH] Various fixes --- .../Sources/SheetComponent.swift | 4 +- .../Sources/GiftViewScreen.swift | 78 ++++++++++--------- .../Sources/TableComponent.swift | 11 ++- .../Sources/StarsWithdrawalScreen.swift | 9 ++- 4 files changed, 62 insertions(+), 40 deletions(-) diff --git a/submodules/Components/SheetComponent/Sources/SheetComponent.swift b/submodules/Components/SheetComponent/Sources/SheetComponent.swift index 32d5c33a4a..ccca83dc4c 100644 --- a/submodules/Components/SheetComponent/Sources/SheetComponent.swift +++ b/submodules/Components/SheetComponent/Sources/SheetComponent.swift @@ -468,7 +468,7 @@ public final class SheetComponent: C switch component.style { case .glass: let clipFrame = CGRect(origin: CGPoint(x: glassInset, y: -glassInset), size: CGSize(width: contentSize.width, height: contentSize.height)) - self.clipView.update(size: clipFrame.size, color: .clear, topCornerRadius: topCornerRadius, bottomCornerRadius: bottomCornerRadius, transition: transition) + self.clipView.update(size: clipFrame.size, color: .clear, topCornerRadius: topCornerRadius - 1.5, bottomCornerRadius: bottomCornerRadius, transition: transition) transition.setFrame(view: self.clipView, frame: clipFrame) transition.setFrame(view: contentView, frame: CGRect(origin: .zero, size: CGSize(width: contentSize.width, height: contentSize.height)), completion: nil) transition.setFrame(view: self.backgroundView, frame: CGRect(origin: CGPoint(x: glassInset, y: -glassInset), size: CGSize(width: contentSize.width, height: contentSize.height)), completion: nil) @@ -482,7 +482,7 @@ public final class SheetComponent: C transition.setFrame(view: effectView, frame: CGRect(origin: .zero, size: CGSize(width: contentSize.width, height: contentSize.height + 1000.0)), completion: nil) } } - self.backgroundView.update(size: contentSize, color: backgroundColor, topCornerRadius: topCornerRadius, bottomCornerRadius: bottomCornerRadius, transition: transition) + self.backgroundView.update(size: contentSize, color: backgroundColor, topCornerRadius: topCornerRadius + 1.5, bottomCornerRadius: bottomCornerRadius, transition: transition) } } transition.setFrame(view: self.scrollView, frame: CGRect(origin: CGPoint(), size: availableSize), completion: nil) diff --git a/submodules/TelegramUI/Components/Gifts/GiftViewScreen/Sources/GiftViewScreen.swift b/submodules/TelegramUI/Components/Gifts/GiftViewScreen/Sources/GiftViewScreen.swift index 514b601653..20ee27ed5a 100644 --- a/submodules/TelegramUI/Components/Gifts/GiftViewScreen/Sources/GiftViewScreen.swift +++ b/submodules/TelegramUI/Components/Gifts/GiftViewScreen/Sources/GiftViewScreen.swift @@ -5164,42 +5164,50 @@ final class GiftViewSheetComponent: CombinedComponent { var headerContent: AnyComponent? if let arguments = context.component.subject.arguments, case .unique = arguments.gift, let fromPeerId = arguments.fromPeerId, var fromPeerName = arguments.fromPeerName, arguments.fromPeerId != context.component.context.account.peerId && !(arguments.fromPeerId?.isTelegramNotifications ?? false) { - let dateString = stringForMediumDate(timestamp: arguments.date, strings: environment.strings, dateTimeFormat: environment.dateTimeFormat, withTime: false) - - if fromPeerName.count > 25 { - fromPeerName = "\(fromPeerName.prefix(25))…" + var showSenderInfo = false + if arguments.incoming { + showSenderInfo = true + } else if arguments.peerId == context.component.context.account.peerId { + showSenderInfo = true + } + if showSenderInfo { + let dateString = stringForMediumDate(timestamp: arguments.date, strings: environment.strings, dateTimeFormat: environment.dateTimeFormat, withTime: false) + + if fromPeerName.count > 25 { + fromPeerName = "\(fromPeerName.prefix(25))…" + } + let rawString = environment.strings.Gift_View_SenderInfo(fromPeerName, dateString).string + let attributedString = parseMarkdownIntoAttributedString(rawString, attributes: MarkdownAttributes(body: MarkdownAttributeSet(font: Font.regular(13.0), textColor: .white), bold: MarkdownAttributeSet(font: Font.semibold(13.0), textColor: .white), link: MarkdownAttributeSet(font: Font.regular(13.0), textColor: .white), linkAttribute: { _ in return nil })) + + let context = context.component.context + headerContent = AnyComponent( + PlainButtonComponent(content: AnyComponent(HeaderContentComponent(attributedText: attributedString)), action: { + if let controller = controller(), let navigationController = controller.navigationController as? NavigationController { + let _ = (context.engine.data.get(TelegramEngine.EngineData.Item.Peer.Peer(id: fromPeerId)) + |> deliverOnMainQueue).start(next: { [weak navigationController] peer in + guard let peer, let navigationController else { + return + } + context.sharedContext.navigateToChatController(NavigateToChatControllerParams( + navigationController: navigationController, + chatController: nil, + context: context, + chatLocation: .peer(peer), + subject: nil, + botStart: nil, + updateTextInputState: nil, + keepStack: .always, + useExisting: true, + purposefulAction: nil, + scrollToEndIfExists: false, + activateMessageSearch: nil, + animated: true + )) + }) + } + }) + ) } - let rawString = environment.strings.Gift_View_SenderInfo(fromPeerName, dateString).string - let attributedString = parseMarkdownIntoAttributedString(rawString, attributes: MarkdownAttributes(body: MarkdownAttributeSet(font: Font.regular(13.0), textColor: .white), bold: MarkdownAttributeSet(font: Font.semibold(13.0), textColor: .white), link: MarkdownAttributeSet(font: Font.regular(13.0), textColor: .white), linkAttribute: { _ in return nil })) - - let context = context.component.context - headerContent = AnyComponent( - PlainButtonComponent(content: AnyComponent(HeaderContentComponent(attributedText: attributedString)), action: { - if let controller = controller(), let navigationController = controller.navigationController as? NavigationController { - let _ = (context.engine.data.get(TelegramEngine.EngineData.Item.Peer.Peer(id: fromPeerId)) - |> deliverOnMainQueue).start(next: { [weak navigationController] peer in - guard let peer, let navigationController else { - return - } - context.sharedContext.navigateToChatController(NavigateToChatControllerParams( - navigationController: navigationController, - chatController: nil, - context: context, - chatLocation: .peer(peer), - subject: nil, - botStart: nil, - updateTextInputState: nil, - keepStack: .always, - useExisting: true, - purposefulAction: nil, - scrollToEndIfExists: false, - activateMessageSearch: nil, - animated: true - )) - }) - } - }) - ) } let sheet = sheet.update( diff --git a/submodules/TelegramUI/Components/Gifts/GiftViewScreen/Sources/TableComponent.swift b/submodules/TelegramUI/Components/Gifts/GiftViewScreen/Sources/TableComponent.swift index 8d128e4a0a..d696aef50f 100644 --- a/submodules/TelegramUI/Components/Gifts/GiftViewScreen/Sources/TableComponent.swift +++ b/submodules/TelegramUI/Components/Gifts/GiftViewScreen/Sources/TableComponent.swift @@ -142,6 +142,7 @@ final class TableComponent: CombinedComponent { var innerTotalOffset: CGFloat = 0.0 var hasRowBackground = false var rowBackgroundIsLast = false + var hasStraightSide = false for item in context.component.items { let insets: UIEdgeInsets @@ -194,6 +195,12 @@ final class TableComponent: CombinedComponent { } hasRowBackground = true } + if item.title == nil { + if i != 0 { + rowBackgroundIsLast = true + } + hasStraightSide = true + } i += 1 } @@ -247,8 +254,8 @@ final class TableComponent: CombinedComponent { context.clear(bounds) var offset: CGFloat = 0.0 - if hasRowBackground { - offset = rowBackgroundIsLast ? borderRadius : -borderRadius + if hasStraightSide { + offset = rowBackgroundIsLast ? 0.0 : -borderRadius bounds.origin.y += offset bounds.size.height += borderRadius diff --git a/submodules/TelegramUI/Components/Stars/StarsWithdrawalScreen/Sources/StarsWithdrawalScreen.swift b/submodules/TelegramUI/Components/Stars/StarsWithdrawalScreen/Sources/StarsWithdrawalScreen.swift index 3bc8f11858..b56ee4f8be 100644 --- a/submodules/TelegramUI/Components/Stars/StarsWithdrawalScreen/Sources/StarsWithdrawalScreen.swift +++ b/submodules/TelegramUI/Components/Stars/StarsWithdrawalScreen/Sources/StarsWithdrawalScreen.swift @@ -1769,7 +1769,14 @@ public final class AmountFieldComponent: Component { guard let component = self.component, let value = component.value else { return } - self.textField.text = "\(value)" + var text = "" + switch component.currency { + case .stars: + text = "\(value)" + case .ton: + text = "\(formatTonAmountText(value, dateTimeFormat: PresentationDateTimeFormat(timeFormat: component.dateTimeFormat.timeFormat, dateFormat: component.dateTimeFormat.dateFormat, dateSeparator: "", dateSuffix: "", requiresFullYear: false, decimalSeparator: ".", groupingSeparator: ""), maxDecimalPositions: nil))" + } + self.textField.text = text self.placeholderView.view?.isHidden = !(self.textField.text ?? "").isEmpty }