Various improvements

This commit is contained in:
Ilya Laktyushin 2025-01-28 01:51:45 +04:00
parent d980d11551
commit 004ebd58ad
2 changed files with 70 additions and 54 deletions

View File

@ -1743,9 +1743,11 @@ private final class GiftViewSheetContent: CombinedComponent {
canConvert = false
}
}
let valueComponent: AnyComponent<Empty>
if let convertStars, incoming && !converted && canConvert {
valueComponent = AnyComponent(
tableItems.append(.init(
id: "value_convert",
title: strings.Gift_View_Value,
component: AnyComponent(
HStack([
AnyComponentWithIdentity(
id: AnyHashable(0),
@ -1772,24 +1774,24 @@ private final class GiftViewSheetContent: CombinedComponent {
))
)
], spacing: 4.0)
)
),
insets: UIEdgeInsets(top: 0.0, left: 10.0, bottom: 0.0, right: 12.0)
))
} else {
valueComponent = AnyComponent(MultilineTextWithEntitiesComponent(
tableItems.append(.init(
id: "value",
title: strings.Gift_View_Value,
component: AnyComponent(MultilineTextWithEntitiesComponent(
context: component.context,
animationCache: component.context.animationCache,
animationRenderer: component.context.animationRenderer,
placeholderColor: theme.list.mediaPlaceholderColor,
text: .plain(valueAttributedString),
maximumNumberOfLines: 0
))
}
tableItems.append(.init(
id: "value",
title: strings.Gift_View_Value,
component: valueComponent,
)),
insets: UIEdgeInsets(top: 0.0, left: 10.0, bottom: 0.0, right: 12.0)
))
}
if let limitTotal {
var remains: Int32 = 0

View File

@ -2659,6 +2659,19 @@ public final class SharedAccountContextImpl: SharedAccountContext {
controllers = controllers.filter { !($0 is ContactSelectionController) }
if !isChannelGift {
if peer.id.namespace == Namespaces.Peer.CloudChannel {
if let controller = context.sharedContext.makePeerInfoController(
context: context,
updatedPresentationData: nil,
peer: peer._asPeer(),
mode: .gifts,
avatarInitiallyExpanded: false,
fromChat: false,
requestsContext: nil
) {
controllers.append(controller)
}
} else {
var foundController = false
for controller in controllers.reversed() {
if let chatController = controller as? ChatController, case .peer(id: peer.id) = chatController.chatLocation {
@ -2672,8 +2685,9 @@ public final class SharedAccountContextImpl: SharedAccountContext {
chatController.hintPlayNextOutgoingGift()
controllers.append(chatController)
}
navigationController.setViewControllers(controllers, animated: true)
}
}
navigationController.setViewControllers(controllers, animated: true)
Queue.mainQueue().after(0.3) {
let tooltipController = UndoOverlayController(