mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
Various fixes
This commit is contained in:
@@ -417,10 +417,23 @@ final class GiftSetupScreenComponent: Component {
|
||||
options: options ?? [],
|
||||
purpose: .starGift(peerId: component.peerId, requiredStars: starGift.price),
|
||||
completion: { [weak starsContext] stars in
|
||||
starsContext?.add(balance: StarsAmount(value: stars, nanos: 0))
|
||||
Queue.mainQueue().after(2.0) {
|
||||
proceed()
|
||||
guard let starsContext else {
|
||||
return
|
||||
}
|
||||
starsContext.add(balance: StarsAmount(value: stars, nanos: 0))
|
||||
|
||||
let _ = (starsContext.state
|
||||
|> take(until: { value in
|
||||
if let value {
|
||||
if !value.flags.contains(.isPendingBalance) {
|
||||
return SignalTakeAction(passthrough: true, complete: true)
|
||||
}
|
||||
}
|
||||
return SignalTakeAction(passthrough: false, complete: false)
|
||||
})
|
||||
|> deliverOnMainQueue).start(next: { _ in
|
||||
proceed()
|
||||
})
|
||||
}
|
||||
)
|
||||
controller.push(purchaseController)
|
||||
@@ -464,8 +477,13 @@ final class GiftSetupScreenComponent: Component {
|
||||
}
|
||||
|
||||
let peerName = self.peerMap[component.peerId]?.compactDisplayTitle ?? ""
|
||||
let isSelfGift = component.peerId == component.context.account.peerId
|
||||
|
||||
if self.component == nil {
|
||||
if isSelfGift {
|
||||
self.hideName = true
|
||||
}
|
||||
|
||||
let _ = (component.context.engine.data.get(
|
||||
TelegramEngine.EngineData.Item.Peer.Peer(id: component.peerId),
|
||||
TelegramEngine.EngineData.Item.Peer.Peer(id: component.context.account.peerId)
|
||||
@@ -615,9 +633,7 @@ final class GiftSetupScreenComponent: Component {
|
||||
}
|
||||
|
||||
let presentationData = component.context.sharedContext.currentPresentationData.with { $0 }
|
||||
|
||||
let isSelfGift = component.peerId == component.context.account.peerId
|
||||
|
||||
|
||||
let navigationTitleSize = self.navigationTitle.update(
|
||||
transition: transition,
|
||||
component: AnyComponent(MultilineTextComponent(
|
||||
@@ -1037,7 +1053,8 @@ final class GiftSetupScreenComponent: Component {
|
||||
finalPrice += upgradePrice
|
||||
}
|
||||
let amountString = presentationStringsFormattedNumber(Int32(finalPrice), presentationData.dateTimeFormat.groupingSeparator)
|
||||
buttonString = "\(environment.strings.Gift_Send_Send) # \(amountString)"
|
||||
let buttonTitle = isSelfGift ? environment.strings.Gift_Send_Buy : environment.strings.Gift_Send_Send
|
||||
buttonString = "\(buttonTitle) # \(amountString)"
|
||||
if let availability = starGift.availability, availability.remains == 0 {
|
||||
buttonIsEnabled = false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user