From 47bf0ba1b97ffc129c2f5bb6020cf52133e082e2 Mon Sep 17 00:00:00 2001 From: Aleksei Savin Date: Sun, 14 Jun 2026 01:54:26 +0300 Subject: [PATCH] fix: hide empty story composer in compact rail --- .../Sources/StoryPeerListComponent.swift | 11 ++--------- .../Sources/StoryPeerListItemComponent.swift | 9 +++------ 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/submodules/TelegramUI/Components/Stories/StoryPeerListComponent/Sources/StoryPeerListComponent.swift b/submodules/TelegramUI/Components/Stories/StoryPeerListComponent/Sources/StoryPeerListComponent.swift index 93e6daefaa..47b82777ae 100644 --- a/submodules/TelegramUI/Components/Stories/StoryPeerListComponent/Sources/StoryPeerListComponent.swift +++ b/submodules/TelegramUI/Components/Stories/StoryPeerListComponent/Sources/StoryPeerListComponent.swift @@ -1093,7 +1093,6 @@ public final class StoryPeerListComponent: Component { } else if peer.id == self.loadingItemId { itemRingAnimation = .loading } - let isOwnEmptyStoryItem = peer.id == component.context.account.peerId && !hasItems && itemRingAnimation == nil let measuredItem = calculateItem(i) @@ -1127,9 +1126,6 @@ public final class StoryPeerListComponent: Component { itemAlpha = collapsedState.sideAlphaFraction } } - if isOwnEmptyStoryItem { - itemAlpha = 1.0 - } var leftNeighborDistance: CGPoint? var rightNeighborDistance: CGPoint? @@ -1255,7 +1251,6 @@ public final class StoryPeerListComponent: Component { } else if let uploadProgress = component.uploadProgress[peer.id] { itemRingAnimation = .progress(uploadProgress) } - let isOwnEmptyStoryItem = peer.id == component.context.account.peerId && !hasItems && itemRingAnimation == nil let collapseIndex = i + effectiveFirstVisibleIndex let measuredItem = calculateItem(collapseIndex) @@ -1281,9 +1276,6 @@ public final class StoryPeerListComponent: Component { } else { itemAlpha = collapsedState.sideAlphaFraction } - if isOwnEmptyStoryItem { - itemAlpha = 1.0 - } var leftNeighborDistance: CGPoint? var rightNeighborDistance: CGPoint? @@ -1731,7 +1723,8 @@ public final class StoryPeerListComponent: Component { self.sortedItems.removeAll(keepingCapacity: true) if let storySubscriptions = component.storySubscriptions { - if !component.useHiddenList, let accountItem = storySubscriptions.accountItem { + let isCompactAvatarRail = availableSize.width <= 120.0 + if !component.useHiddenList, let accountItem = storySubscriptions.accountItem, !isCompactAvatarRail || accountItem.storyCount != 0 || accountItem.hasPending { self.sortedItems.append(accountItem) } diff --git a/submodules/TelegramUI/Components/Stories/StoryPeerListComponent/Sources/StoryPeerListItemComponent.swift b/submodules/TelegramUI/Components/Stories/StoryPeerListComponent/Sources/StoryPeerListItemComponent.swift index 6e693801a6..99d913e031 100644 --- a/submodules/TelegramUI/Components/Stories/StoryPeerListComponent/Sources/StoryPeerListItemComponent.swift +++ b/submodules/TelegramUI/Components/Stories/StoryPeerListComponent/Sources/StoryPeerListItemComponent.swift @@ -1063,15 +1063,12 @@ public final class StoryPeerListItemComponent: Component { } let titleContainerSize = CGSize(width: totalTitleWidth, height: titleSize.height) - let isOwnEmptyStoryItem = component.peer.id == component.context.account.peerId && !component.hasItems && component.ringAnimation == nil - let titleScale: CGFloat = isOwnEmptyStoryItem ? 1.0 : effectiveScale - let titleOffsetX: CGFloat = isOwnEmptyStoryItem ? 0.0 : (effectiveWidth - availableSize.width) * 0.5 - let titleContainerFrame = CGRect(origin: CGPoint(x: floor((availableSize.width - titleContainerSize.width) * 0.5) + titleOffsetX, y: indicatorFrame.midY + (indicatorFrame.height * 0.5 + 2.0) * titleScale), size: titleContainerSize) + let titleContainerFrame = CGRect(origin: CGPoint(x: floor((availableSize.width - titleContainerSize.width) * 0.5) + (effectiveWidth - availableSize.width) * 0.5, y: indicatorFrame.midY + (indicatorFrame.height * 0.5 + 2.0) * effectiveScale), size: titleContainerSize) titleTransition.setPosition(view: self.titleContainer, position: titleContainerFrame.center) self.titleContainer.bounds = CGRect(origin: CGPoint(), size: titleContainerFrame.size) - titleTransition.setScale(view: self.titleContainer, scale: titleScale) - titleTransition.setAlpha(view: self.titleContainer, alpha: isOwnEmptyStoryItem ? 1.0 : component.expandedAlphaFraction) + titleTransition.setScale(view: self.titleContainer, scale: effectiveScale) + titleTransition.setAlpha(view: self.titleContainer, alpha: component.expandedAlphaFraction) if let ringAnimation = component.ringAnimation { var progressTransition = transition