From f7901af416277d2e31ba76fb5e91db2ee09fe6cf Mon Sep 17 00:00:00 2001 From: Ilya Laktyushin Date: Thu, 11 Sep 2025 02:29:29 +0400 Subject: [PATCH] Fix ton balance update on gift purchase --- .../GiftViewScreen/Sources/GiftViewScreen.swift | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/submodules/TelegramUI/Components/Gifts/GiftViewScreen/Sources/GiftViewScreen.swift b/submodules/TelegramUI/Components/Gifts/GiftViewScreen/Sources/GiftViewScreen.swift index 4303252cba..8d479d0f2e 100644 --- a/submodules/TelegramUI/Components/Gifts/GiftViewScreen/Sources/GiftViewScreen.swift +++ b/submodules/TelegramUI/Components/Gifts/GiftViewScreen/Sources/GiftViewScreen.swift @@ -1549,19 +1549,14 @@ private final class GiftViewSheetContent: CombinedComponent { if let buyGift = controller.buyGift { buyGiftImpl = { slug, peerId, price in return buyGift(slug, peerId, price) - |> afterCompleted { - context.starsContext?.load(force: true) - } } } else { buyGiftImpl = { slug, peerId, price in return self.context.engine.payments.buyStarGift(slug: slug, peerId: peerId, price: price) - |> afterCompleted { - context.starsContext?.load(force: true) - } } } + let finalPrice = acceptedPrice ?? resellAmount self.buyDisposable = (buyGiftImpl(uniqueGift.slug, recipientPeerId, acceptedPrice ?? resellAmount) |> deliverOnMainQueue).start( error: { [weak self] error in @@ -1683,7 +1678,12 @@ private final class GiftViewSheetContent: CombinedComponent { self.updated(transition: .spring(duration: 0.4)) Queue.mainQueue().after(0.5) { - context.starsContext?.load(force: true) + switch finalPrice.currency { + case .stars: + context.starsContext?.load(force: true) + case .ton: + context.tonContext?.load(force: true) + } } } )