Various improvements

This commit is contained in:
Ilya Laktyushin
2024-07-16 20:49:33 +04:00
parent a4e0b271bb
commit 8961a10144
5 changed files with 57 additions and 12 deletions

View File

@@ -282,7 +282,7 @@ final class NavigationModalContainer: ASDisplayNode, ASScrollViewDelegate, ASGes
let transition: ContainedViewLayoutTransition
let dismissProgress: CGFloat
if (velocity.y < -0.5 || progress >= 0.5) && self.checkInteractiveDismissWithControllers() {
if self.isDraggingHeader, let controller = self.container.controllers.last as? MinimizableController {
if let controller = self.container.controllers.last as? MinimizableController, self.isDraggingHeader || "".isEmpty {
dismissProgress = 0.0
targetOffset = 0.0
transition = .immediate

View File

@@ -815,12 +815,14 @@ public final class StarsTransactionsScreen: ViewControllerComponentContainer {
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
let resultController = UndoOverlayController(
presentationData: presentationData,
content: .image(
image: UIImage(bundleImageName: "Premium/Stars/StarLarge")!,
title: presentationData.strings.Stars_Intro_PurchasedTitle,
content: .universal(
animation: "StarsBuy",
scale: 0.066,
colors: [:],
title: presentationData.strings.Stars_Intro_PurchasedTitle,
text: presentationData.strings.Stars_Intro_PurchasedText(presentationData.strings.Stars_Intro_PurchasedText_Stars(Int32(stars))).string,
round: false,
undoText: nil
customUndoText: nil,
timeout: nil
),
elevatedLayout: false,
action: { _ in return true})
@@ -850,8 +852,42 @@ public final class StarsTransactionsScreen: ViewControllerComponentContainer {
starsContext: starsContext,
options: options,
purpose: .gift(peerId: peerId),
completion: { stars in
completion: { [weak self] stars in
guard let self else {
return
}
Queue.mainQueue().after(2.0) {
//TODO:localize
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
let resultController = UndoOverlayController(
presentationData: presentationData,
content: .universal(
animation: "StarsSend",
scale: 0.066,
colors: [:],
title: nil,
text: "\(stars) Stars sent.",
customUndoText: "View Chat",
timeout: nil
),
elevatedLayout: false,
action: { [weak self] action in
if case .undo = action, let navigationController = self?.navigationController as? NavigationController {
let _ = (context.engine.data.get(
TelegramEngine.EngineData.Item.Peer.Peer(id: peerId)
)
|> deliverOnMainQueue).start(next: { peer in
guard let peer else {
return
}
context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: navigationController, chatController: nil, context: context, chatLocation: .peer(peer), subject: nil, botStart: nil, updateTextInputState: nil, keepStack: .always, useExisting: true, purposefulAction: nil, scrollToEndIfExists: false, activateMessageSearch: nil, animated: true))
})
}
return true
})
self.present(resultController, in: .window(.root))
}
}
)
self.push(purchaseController)

View File

@@ -518,12 +518,21 @@ private final class SheetContent: CombinedComponent {
if let lastController = navigationController.viewControllers.last as? ViewController {
let resultController = UndoOverlayController(
presentationData: presentationData,
content: .image(
image: UIImage(bundleImageName: "Premium/Stars/StarLarge")!,
// content: .image(
// image: UIImage(bundleImageName: "Premium/Stars/StarLarge")!,
// title: presentationData.strings.Stars_Transfer_PurchasedTitle,
// text: text,
// round: false,
// undoText: nil
// ),
content: .universal(
animation: "StarsSend",
scale: 0.066,
colors: [:],
title: presentationData.strings.Stars_Transfer_PurchasedTitle,
text: text,
round: false,
undoText: nil
customUndoText: nil,
timeout: nil
),
elevatedLayout: lastController is ChatController,
action: { _ in return true}