From b1ebdab0dc3ae29dfda266f4bba0780bc842e73d Mon Sep 17 00:00:00 2001 From: Ilya Laktyushin Date: Fri, 22 Aug 2025 22:55:59 +0400 Subject: [PATCH] Various fixes --- .../Sources/ChatSendStarsScreen.swift | 4 ++-- .../Sources/GiftCompositionComponent.swift | 14 ++------------ .../Sources/PeerMessagesMediaPlaylist.swift | 10 ++++++++++ versions.json | 2 +- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/submodules/TelegramUI/Components/Chat/ChatSendStarsScreen/Sources/ChatSendStarsScreen.swift b/submodules/TelegramUI/Components/Chat/ChatSendStarsScreen/Sources/ChatSendStarsScreen.swift index efb36b911a..46503735dc 100644 --- a/submodules/TelegramUI/Components/Chat/ChatSendStarsScreen/Sources/ChatSendStarsScreen.swift +++ b/submodules/TelegramUI/Components/Chat/ChatSendStarsScreen/Sources/ChatSendStarsScreen.swift @@ -1426,8 +1426,8 @@ private final class ChatSendStarsScreenComponent: Component { self.environment?.controller()?.dismiss() let _ = (context.engine.payments.starsTopUpOptions() - |> take(1) - |> deliverOnMainQueue).startStandalone(next: { options in + |> take(1) + |> deliverOnMainQueue).startStandalone(next: { options in let controller = context.sharedContext.makeStarsPurchaseScreen( context: context, starsContext: starsContext, diff --git a/submodules/TelegramUI/Components/Gifts/GiftAnimationComponent/Sources/GiftCompositionComponent.swift b/submodules/TelegramUI/Components/Gifts/GiftAnimationComponent/Sources/GiftCompositionComponent.swift index e3da866d82..8d6260f685 100644 --- a/submodules/TelegramUI/Components/Gifts/GiftAnimationComponent/Sources/GiftCompositionComponent.swift +++ b/submodules/TelegramUI/Components/Gifts/GiftAnimationComponent/Sources/GiftCompositionComponent.swift @@ -307,7 +307,6 @@ public final class GiftCompositionComponent: Component { ) { guard let geom = self.spinGeom, !tail.isEmpty else { return } - // Build container let visualSize = CGSize(width: iconSize.width * scale, height: iconSize.height * scale) let pitch = visualSize.width + self.spacingX let count = tail.count @@ -318,18 +317,15 @@ public final class GiftCompositionComponent: Component { container.isUserInteractionEnabled = false container.clipsToBounds = false - // Y is fixed; we’ll animate X only let containerY = geom.centerY - containerHeight / 2.0 container.frame.origin.y = containerY self.addSubview(container) self.decelContainer = container self.decelItemHosts.removeAll() - - // Fill container with hosts at fixed pitch + for (i, attribute) in tail.reversed().enumerated() { guard case let .model(_, file, _) = attribute else { continue } - // Node let node = DefaultAnimatedStickerNodeImpl() node.isUserInteractionEnabled = false let pathPrefix = self.component!.context.account.postbox.mediaBox.shortLivedResourceCachePathPrefix(file.resource.id) @@ -408,27 +404,22 @@ public final class GiftCompositionComponent: Component { let isFinalIndex = self.decelItemHosts.count - 1 guard isFinalIndex >= 0, let finalHostView = self.decelItemHosts.last else { return } - // Prepare final node guard let node = self.animationNode as? DefaultAnimatedStickerNodeImpl else { return } node.playbackMode = .once node.visibility = true - // Convert final host center into self coords let finalCenterInSelf = container.convert(finalHostView.center, to: self) - // Place node directly in self, exactly where the final host is let host = node.view if host.superview !== self { self.addSubview(host) } node.updateLayout(size: iconSize) host.bounds = CGRect(origin: .zero, size: iconSize) host.layer.position = finalCenterInSelf - // Remove container container.removeFromSuperview() self.decelContainer = nil self.decelItemHosts.removeAll() - - // Bounce scale (same values you already used) + let factors: [CGFloat] = [1.0, 1.3, 0.92, 1.18, 0.98, 1.0] let values = factors.map { NSNumber(value: Double($0)) } let scaleAnim = CAKeyframeAnimation(keyPath: "transform.scale") @@ -445,7 +436,6 @@ public final class GiftCompositionComponent: Component { scaleAnim.isRemovedOnCompletion = true host.layer.add(scaleAnim, forKey: "bounce") - // Play the “once” sticker & finish node.playOnce() self.finishSettled() } diff --git a/submodules/TelegramUI/Components/MediaManager/PeerMessagesMediaPlaylist/Sources/PeerMessagesMediaPlaylist.swift b/submodules/TelegramUI/Components/MediaManager/PeerMessagesMediaPlaylist/Sources/PeerMessagesMediaPlaylist.swift index 7cf71779a5..6565bf17c5 100644 --- a/submodules/TelegramUI/Components/MediaManager/PeerMessagesMediaPlaylist/Sources/PeerMessagesMediaPlaylist.swift +++ b/submodules/TelegramUI/Components/MediaManager/PeerMessagesMediaPlaylist/Sources/PeerMessagesMediaPlaylist.swift @@ -840,6 +840,16 @@ public final class PeerMessagesMediaPlaylist: SharedMediaPlaylist { } if case .all = looping { + if let first = messages.first { + if let (message, aroundMessages, _) = navigatedMessageFromMessages(messages, anchorIndex: first.index, position: .exact) { + switch navigation { + case .random: + return .single(((message, []), messages.count, false)) + default: + return .single(((message, aroundMessages), messages.count, false)) + } + } + } return .single((nil, messages.count, false)) } else { if hasMore { diff --git a/versions.json b/versions.json index 7816fd08cd..6c85ab5077 100644 --- a/versions.json +++ b/versions.json @@ -1,5 +1,5 @@ { - "app": "11.14.1", + "app": "11.15", "xcode": "16.2", "bazel": "8.3.1:0cac3a67dc5429c68272dc6944104952e9e4cf84b29d126a5ff3fbaa59045217", "macos": "15"