Various improvements

This commit is contained in:
Ilya Laktyushin 2025-11-17 21:49:36 +04:00
parent 8f33585114
commit 8a46bdffce
4 changed files with 33 additions and 5 deletions

View file

@ -347,3 +347,7 @@ public struct AccountFreezeConfiguration {
public protocol GiftOptionsScreenProtocol {
}
public protocol GiftSetupScreenProtocol {
}

View file

@ -212,6 +212,7 @@ public func loginEmailSetupController(context: AccountContext, blocking: Bool, e
}
dismissEmailControllerImpl = { [weak emailController] in
dismiss()
emailController?.dismiss()
}
return emailController

View file

@ -584,7 +584,6 @@ private final class GiftSetupScreenComponent: Component {
}
navigationController.setViewControllers(controllers, animated: true)
if case let .starGift(starGift, _) = component.subject, let perUserLimit = starGift.perUserLimit {
Queue.mainQueue().after(0.5) {
let remains = max(0, perUserLimit.remains - 1)
@ -2019,7 +2018,7 @@ private final class GiftSetupScreenComponent: Component {
}
}
public class GiftSetupScreen: ViewControllerComponentContainer {
public class GiftSetupScreen: ViewControllerComponentContainer, GiftSetupScreenProtocol {
public enum Subject: Equatable {
case premium(PremiumGiftProduct)
case starGift(StarGift.Gift, Bool?)

View file

@ -1635,7 +1635,9 @@ private final class GiftAuctionBidScreenComponent: Component {
customUndoText: nil
),
position: .bottom,
action: { _ in return true }
action: { _ in
return true
}
),
in: .current
)
@ -2018,8 +2020,30 @@ private final class GiftAuctionBidScreenComponent: Component {
self.loadAcquiredGifts()
}
if !isFirstTime {
self.resetSliderValue()
self.addSubview(ConfettiView(frame: self.bounds))
if let bidPeerId = previousState?.myState.bidPeerId, let controller = self.environment?.controller() {
if let navigationController = controller.navigationController as? NavigationController {
var controllers = navigationController.viewControllers
controllers = controllers.filter { !($0 is GiftAuctionBidScreen) && !($0 is GiftSetupScreenProtocol) && !($0 is GiftOptionsScreenProtocol) && !($0 is PeerInfoScreen) && !($0 is ContactSelectionController) }
var foundController = false
for controller in controllers.reversed() {
if let chatController = controller as? ChatController, case .peer(id: bidPeerId) = chatController.chatLocation {
chatController.hintPlayNextOutgoingGift()
foundController = true
break
}
}
if !foundController {
let chatController = component.context.sharedContext.makeChatController(context: component.context, chatLocation: .peer(id: bidPeerId), subject: nil, botStart: nil, mode: .standard(.default), params: nil)
chatController.hintPlayNextOutgoingGift()
controllers.append(chatController)
}
navigationController.setViewControllers(controllers, animated: true)
}
} else {
self.resetSliderValue()
self.addSubview(ConfettiView(frame: self.bounds))
}
}
}