Merge commit 'c3ed819d01cf89fa072cf5da4183542f12053ec6'

# Conflicts:
#	submodules/TelegramUI/Components/ChatListHeaderComponent/Sources/ChatListNavigationBar.swift
#	submodules/TelegramUI/Components/Stories/StoryPeerListComponent/Sources/StoryPeerListItemComponent.swift
This commit is contained in:
Ali
2023-06-06 01:05:54 +04:00
65 changed files with 3438 additions and 803 deletions

View File

@@ -21,6 +21,7 @@ public final class ChatListNavigationBar: Component {
public let secondaryContent: ChatListHeaderComponent.Content?
public let secondaryTransition: CGFloat
public let storySubscriptions: EngineStorySubscriptions?
public let uploadProgress: Float?
public let tabsNode: ASDisplayNode?
public let tabsNodeIsSearch: Bool
public let activateSearch: (NavigationBarSearchContentNode) -> Void
@@ -38,6 +39,7 @@ public final class ChatListNavigationBar: Component {
secondaryContent: ChatListHeaderComponent.Content?,
secondaryTransition: CGFloat,
storySubscriptions: EngineStorySubscriptions?,
uploadProgress: Float?,
tabsNode: ASDisplayNode?,
tabsNodeIsSearch: Bool,
activateSearch: @escaping (NavigationBarSearchContentNode) -> Void,
@@ -54,6 +56,7 @@ public final class ChatListNavigationBar: Component {
self.secondaryContent = secondaryContent
self.secondaryTransition = secondaryTransition
self.storySubscriptions = storySubscriptions
self.uploadProgress = uploadProgress
self.tabsNode = tabsNode
self.tabsNodeIsSearch = tabsNodeIsSearch
self.activateSearch = activateSearch
@@ -94,6 +97,9 @@ public final class ChatListNavigationBar: Component {
if lhs.storySubscriptions != rhs.storySubscriptions {
return false
}
if lhs.uploadProgress != rhs.uploadProgress {
return false
}
if lhs.tabsNode !== rhs.tabsNode {
return false
}
@@ -176,12 +182,12 @@ public final class ChatListNavigationBar: Component {
}
}
public func applyScroll(offset: CGFloat, transition: Transition) {
public func applyScroll(offset: CGFloat, forceUpdate: Bool = false, transition: Transition) {
let transition = transition
self.rawScrollOffset = offset
if self.deferScrollApplication {
if self.deferScrollApplication && !forceUpdate {
self.hasDeferredScrollOffset = true
return
}
@@ -208,7 +214,7 @@ public final class ChatListNavigationBar: Component {
}
let clippedScrollOffset = min(minContentOffset, offset)
if self.clippedScrollOffset == clippedScrollOffset && !self.hasDeferredScrollOffset {
if self.clippedScrollOffset == clippedScrollOffset && !self.hasDeferredScrollOffset && !forceUpdate {
return
}
self.hasDeferredScrollOffset = false
@@ -304,6 +310,7 @@ public final class ChatListNavigationBar: Component {
networkStatus: nil,
storySubscriptions: component.storySubscriptions,
storiesFraction: 1.0 - storiesOffsetFraction,
uploadProgress: component.uploadProgress,
context: component.context,
theme: component.theme,
strings: component.strings,
@@ -402,8 +409,14 @@ public final class ChatListNavigationBar: Component {
let themeUpdated = self.component?.theme !== component.theme
var storiesUnlockedUpdated = false
if let previousComponent = self.component, previousComponent.storiesUnlocked != component.storiesUnlocked {
storiesUnlockedUpdated = true
var uploadProgressUpdated = false
if let previousComponent = self.component {
if previousComponent.storiesUnlocked != component.storiesUnlocked {
storiesUnlockedUpdated = true
}
if previousComponent.uploadProgress != component.uploadProgress {
uploadProgressUpdated = true
}
}
self.component = component
@@ -447,6 +460,12 @@ public final class ChatListNavigationBar: Component {
self.hasDeferredScrollOffset = true
if uploadProgressUpdated {
if let rawScrollOffset = self.rawScrollOffset {
self.applyScroll(offset: rawScrollOffset, forceUpdate: true, transition: transition)
}
}
if storiesUnlockedUpdated && component.storiesUnlocked {
self.applyScrollFraction = 0.0
self.applyScrollStartFraction = 0.0