fix: hide empty story composer in compact rail

This commit is contained in:
Aleksei Savin 2026-06-14 01:54:26 +03:00
parent ce2d5cf0d5
commit 47bf0ba1b9
2 changed files with 5 additions and 15 deletions

View file

@ -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)
}

View file

@ -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