mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Various improvements
This commit is contained in:
parent
d980d11551
commit
004ebd58ad
@ -1743,54 +1743,56 @@ private final class GiftViewSheetContent: CombinedComponent {
|
|||||||
canConvert = false
|
canConvert = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let valueComponent: AnyComponent<Empty>
|
|
||||||
if let convertStars, incoming && !converted && canConvert {
|
if let convertStars, incoming && !converted && canConvert {
|
||||||
valueComponent = AnyComponent(
|
tableItems.append(.init(
|
||||||
HStack([
|
id: "value_convert",
|
||||||
AnyComponentWithIdentity(
|
title: strings.Gift_View_Value,
|
||||||
id: AnyHashable(0),
|
component: AnyComponent(
|
||||||
component: AnyComponent(MultilineTextWithEntitiesComponent(
|
HStack([
|
||||||
context: component.context,
|
AnyComponentWithIdentity(
|
||||||
animationCache: component.context.animationCache,
|
id: AnyHashable(0),
|
||||||
animationRenderer: component.context.animationRenderer,
|
component: AnyComponent(MultilineTextWithEntitiesComponent(
|
||||||
placeholderColor: theme.list.mediaPlaceholderColor,
|
|
||||||
text: .plain(valueAttributedString),
|
|
||||||
maximumNumberOfLines: 0
|
|
||||||
))
|
|
||||||
),
|
|
||||||
AnyComponentWithIdentity(
|
|
||||||
id: AnyHashable(1),
|
|
||||||
component: AnyComponent(Button(
|
|
||||||
content: AnyComponent(ButtonContentComponent(
|
|
||||||
context: component.context,
|
context: component.context,
|
||||||
text: strings.Gift_View_Sale(strings.Gift_View_Sale_Stars(Int32(convertStars))).string,
|
animationCache: component.context.animationCache,
|
||||||
color: theme.list.itemAccentColor
|
animationRenderer: component.context.animationRenderer,
|
||||||
)),
|
placeholderColor: theme.list.mediaPlaceholderColor,
|
||||||
action: {
|
text: .plain(valueAttributedString),
|
||||||
component.convertToStars()
|
maximumNumberOfLines: 0
|
||||||
}
|
))
|
||||||
))
|
),
|
||||||
)
|
AnyComponentWithIdentity(
|
||||||
], spacing: 4.0)
|
id: AnyHashable(1),
|
||||||
)
|
component: AnyComponent(Button(
|
||||||
|
content: AnyComponent(ButtonContentComponent(
|
||||||
|
context: component.context,
|
||||||
|
text: strings.Gift_View_Sale(strings.Gift_View_Sale_Stars(Int32(convertStars))).string,
|
||||||
|
color: theme.list.itemAccentColor
|
||||||
|
)),
|
||||||
|
action: {
|
||||||
|
component.convertToStars()
|
||||||
|
}
|
||||||
|
))
|
||||||
|
)
|
||||||
|
], spacing: 4.0)
|
||||||
|
),
|
||||||
|
insets: UIEdgeInsets(top: 0.0, left: 10.0, bottom: 0.0, right: 12.0)
|
||||||
|
))
|
||||||
} else {
|
} else {
|
||||||
valueComponent = AnyComponent(MultilineTextWithEntitiesComponent(
|
tableItems.append(.init(
|
||||||
context: component.context,
|
id: "value",
|
||||||
animationCache: component.context.animationCache,
|
title: strings.Gift_View_Value,
|
||||||
animationRenderer: component.context.animationRenderer,
|
component: AnyComponent(MultilineTextWithEntitiesComponent(
|
||||||
placeholderColor: theme.list.mediaPlaceholderColor,
|
context: component.context,
|
||||||
text: .plain(valueAttributedString),
|
animationCache: component.context.animationCache,
|
||||||
maximumNumberOfLines: 0
|
animationRenderer: component.context.animationRenderer,
|
||||||
|
placeholderColor: theme.list.mediaPlaceholderColor,
|
||||||
|
text: .plain(valueAttributedString),
|
||||||
|
maximumNumberOfLines: 0
|
||||||
|
)),
|
||||||
|
insets: UIEdgeInsets(top: 0.0, left: 10.0, bottom: 0.0, right: 12.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 {
|
if let limitTotal {
|
||||||
var remains: Int32 = 0
|
var remains: Int32 = 0
|
||||||
if let gift = state.starGiftsMap[giftId], let availability = gift.availability {
|
if let gift = state.starGiftsMap[giftId], let availability = gift.availability {
|
||||||
|
@ -2659,21 +2659,35 @@ public final class SharedAccountContextImpl: SharedAccountContext {
|
|||||||
controllers = controllers.filter { !($0 is ContactSelectionController) }
|
controllers = controllers.filter { !($0 is ContactSelectionController) }
|
||||||
|
|
||||||
if !isChannelGift {
|
if !isChannelGift {
|
||||||
var foundController = false
|
if peer.id.namespace == Namespaces.Peer.CloudChannel {
|
||||||
for controller in controllers.reversed() {
|
if let controller = context.sharedContext.makePeerInfoController(
|
||||||
if let chatController = controller as? ChatController, case .peer(id: peer.id) = chatController.chatLocation {
|
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 {
|
||||||
|
chatController.hintPlayNextOutgoingGift()
|
||||||
|
foundController = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !foundController {
|
||||||
|
let chatController = context.sharedContext.makeChatController(context: context, chatLocation: .peer(id: peer.id), subject: nil, botStart: nil, mode: .standard(.default), params: nil)
|
||||||
chatController.hintPlayNextOutgoingGift()
|
chatController.hintPlayNextOutgoingGift()
|
||||||
foundController = true
|
controllers.append(chatController)
|
||||||
break
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !foundController {
|
|
||||||
let chatController = context.sharedContext.makeChatController(context: context, chatLocation: .peer(id: peer.id), subject: nil, botStart: nil, mode: .standard(.default), params: nil)
|
|
||||||
chatController.hintPlayNextOutgoingGift()
|
|
||||||
controllers.append(chatController)
|
|
||||||
}
|
|
||||||
navigationController.setViewControllers(controllers, animated: true)
|
|
||||||
}
|
}
|
||||||
|
navigationController.setViewControllers(controllers, animated: true)
|
||||||
|
|
||||||
Queue.mainQueue().after(0.3) {
|
Queue.mainQueue().after(0.3) {
|
||||||
let tooltipController = UndoOverlayController(
|
let tooltipController = UndoOverlayController(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user