Skip to content

Commit fa46338

Browse files
committed
Various fixes
1 parent c04e8f3 commit fa46338

File tree

2 files changed

+38
-49
lines changed

2 files changed

+38
-49
lines changed

submodules/TelegramCore/Sources/TelegramEngine/Payments/StarGifts.swift

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1542,24 +1542,7 @@ private final class ProfileGiftsContextImpl {
15421542
return EmptyDisposable
15431543
}
15441544

1545-
var saveToProfile = false
1546-
if let gift = self.gifts.first(where: { $0.reference == reference }) {
1547-
if !gift.savedToProfile {
1548-
saveToProfile = true
1549-
}
1550-
} else if let gift = self.filteredGifts.first(where: { $0.reference == reference }) {
1551-
if !gift.savedToProfile {
1552-
saveToProfile = true
1553-
}
1554-
}
1555-
1556-
var signal = _internal_updateStarGiftResalePrice(account: self.account, reference: reference, price: price)
1557-
if saveToProfile {
1558-
signal = _internal_updateStarGiftAddedToProfile(account: self.account, reference: reference, added: true)
1559-
|> castError(UpdateStarGiftPriceError.self)
1560-
|> then(signal)
1561-
}
1562-
1545+
let signal = _internal_updateStarGiftResalePrice(account: self.account, reference: reference, price: price)
15631546
let disposable = MetaDisposable()
15641547
disposable.set(
15651548
(signal
@@ -1584,7 +1567,7 @@ private final class ProfileGiftsContextImpl {
15841567
}) {
15851568
if case let .unique(uniqueGift) = self.gifts[index].gift {
15861569
let updatedUniqueGift = uniqueGift.withResellStars(price)
1587-
let updatedGift = self.gifts[index].withGift(.unique(updatedUniqueGift)).withSavedToProfile(true)
1570+
let updatedGift = self.gifts[index].withGift(.unique(updatedUniqueGift))
15881571
self.gifts[index] = updatedGift
15891572
}
15901573
}
@@ -1607,7 +1590,7 @@ private final class ProfileGiftsContextImpl {
16071590
}) {
16081591
if case let .unique(uniqueGift) = self.filteredGifts[index].gift {
16091592
let updatedUniqueGift = uniqueGift.withResellStars(price)
1610-
let updatedGift = self.filteredGifts[index].withGift(.unique(updatedUniqueGift)).withSavedToProfile(true)
1593+
let updatedGift = self.filteredGifts[index].withGift(.unique(updatedUniqueGift))
16111594
self.filteredGifts[index] = updatedGift
16121595
}
16131596
}

submodules/TelegramUI/Components/Gifts/GiftViewScreen/Sources/GiftViewScreen.swift

Lines changed: 35 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -306,40 +306,46 @@ private final class GiftViewSheetContent: CombinedComponent {
306306

307307
controller.dismissAllTooltips()
308308

309-
if gifts {
310-
if let profileController = self.context.sharedContext.makePeerInfoController(
311-
context: self.context,
312-
updatedPresentationData: nil,
313-
peer: peer._asPeer(),
314-
mode: peer.id == self.context.account.peerId ? .myProfileGifts : .gifts,
315-
avatarInitiallyExpanded: false,
316-
fromChat: false,
317-
requestsContext: nil
318-
) {
319-
controller.push(profileController)
309+
let context = self.context
310+
let action = {
311+
if gifts {
312+
if let profileController = context.sharedContext.makePeerInfoController(
313+
context: context,
314+
updatedPresentationData: nil,
315+
peer: peer._asPeer(),
316+
mode: peer.id == context.account.peerId ? .myProfileGifts : .gifts,
317+
avatarInitiallyExpanded: false,
318+
fromChat: false,
319+
requestsContext: nil
320+
) {
321+
navigationController.pushViewController(profileController)
322+
}
323+
} else {
324+
context.sharedContext.navigateToChatController(NavigateToChatControllerParams(
325+
navigationController: navigationController,
326+
chatController: nil,
327+
context: context,
328+
chatLocation: .peer(peer),
329+
subject: nil,
330+
botStart: nil,
331+
updateTextInputState: nil,
332+
keepStack: .always,
333+
useExisting: true,
334+
purposefulAction: nil,
335+
scrollToEndIfExists: false,
336+
activateMessageSearch: nil,
337+
animated: true
338+
))
320339
}
321-
} else {
322-
self.context.sharedContext.navigateToChatController(NavigateToChatControllerParams(
323-
navigationController: navigationController,
324-
chatController: nil,
325-
context: self.context,
326-
chatLocation: .peer(peer),
327-
subject: nil,
328-
botStart: nil,
329-
updateTextInputState: nil,
330-
keepStack: .always,
331-
useExisting: true,
332-
purposefulAction: nil,
333-
scrollToEndIfExists: false,
334-
activateMessageSearch: nil,
335-
animated: true
336-
))
337340
}
338341

339342
if dismiss {
340-
Queue.mainQueue().after(0.6, {
341-
self.dismiss(animated: false)
343+
self.dismiss(animated: true)
344+
Queue.mainQueue().after(0.4, {
345+
action()
342346
})
347+
} else {
348+
action()
343349
}
344350
}
345351

0 commit comments

Comments
 (0)