mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 22:55:00 +00:00
Refactoring
This commit is contained in:
@@ -29,9 +29,9 @@ public final class ListSectionContentView: UIView {
|
||||
public let id: AnyHashable
|
||||
public let itemView: ItemView
|
||||
public let size: CGSize
|
||||
public let transition: Transition
|
||||
public let transition: ComponentTransition
|
||||
|
||||
public init(id: AnyHashable, itemView: ItemView, size: CGSize, transition: Transition) {
|
||||
public init(id: AnyHashable, itemView: ItemView, size: CGSize, transition: ComponentTransition) {
|
||||
self.id = id
|
||||
self.itemView = itemView
|
||||
self.size = size
|
||||
@@ -109,7 +109,7 @@ public final class ListSectionContentView: UIView {
|
||||
self.highlightedItemId = itemId
|
||||
|
||||
if configuration.extendsItemHighlightToSection {
|
||||
let transition: Transition
|
||||
let transition: ComponentTransition
|
||||
let backgroundColor: UIColor
|
||||
if itemId != nil {
|
||||
transition = .immediate
|
||||
@@ -122,15 +122,15 @@ public final class ListSectionContentView: UIView {
|
||||
self.externalContentBackgroundView.updateColor(color: backgroundColor, transition: transition)
|
||||
} else {
|
||||
if let previousHighlightedItemId, let previousItemView = self.itemViews[previousHighlightedItemId] {
|
||||
Transition.easeInOut(duration: 0.2).setBackgroundColor(layer: previousItemView.highlightLayer, color: .clear)
|
||||
ComponentTransition.easeInOut(duration: 0.2).setBackgroundColor(layer: previousItemView.highlightLayer, color: .clear)
|
||||
}
|
||||
if let itemId, let itemView = self.itemViews[itemId] {
|
||||
Transition.immediate.setBackgroundColor(layer: itemView.highlightLayer, color: configuration.theme.list.itemHighlightedBackgroundColor)
|
||||
ComponentTransition.immediate.setBackgroundColor(layer: itemView.highlightLayer, color: configuration.theme.list.itemHighlightedBackgroundColor)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public func update(configuration: Configuration, width: CGFloat, leftInset: CGFloat, readyItems: [ReadyItem], transition: Transition) -> UpdateResult {
|
||||
public func update(configuration: Configuration, width: CGFloat, leftInset: CGFloat, readyItems: [ReadyItem], transition: ComponentTransition) -> UpdateResult {
|
||||
self.configuration = configuration
|
||||
|
||||
switch configuration.background {
|
||||
@@ -376,7 +376,7 @@ public final class ListSectionComponent: Component {
|
||||
return self.contentView.itemViews[id]?.contents.view
|
||||
}
|
||||
|
||||
func update(component: ListSectionComponent, availableSize: CGSize, state: EmptyComponentState, environment: Environment<Empty>, transition: Transition) -> CGSize {
|
||||
func update(component: ListSectionComponent, availableSize: CGSize, state: EmptyComponentState, environment: Environment<Empty>, transition: ComponentTransition) -> CGSize {
|
||||
self.component = component
|
||||
|
||||
let headerSideInset: CGFloat = 16.0
|
||||
@@ -511,7 +511,7 @@ public final class ListSectionComponent: Component {
|
||||
return View(frame: CGRect())
|
||||
}
|
||||
|
||||
public func update(view: View, availableSize: CGSize, state: EmptyComponentState, environment: Environment<Empty>, transition: Transition) -> CGSize {
|
||||
public func update(view: View, availableSize: CGSize, state: EmptyComponentState, environment: Environment<Empty>, transition: ComponentTransition) -> CGSize {
|
||||
return view.update(component: self, availableSize: availableSize, state: state, environment: environment, transition: transition)
|
||||
}
|
||||
}
|
||||
@@ -576,7 +576,7 @@ public final class ListSubSectionComponent: Component {
|
||||
return self.contentView.itemViews[id]?.contents.view
|
||||
}
|
||||
|
||||
func update(component: ListSubSectionComponent, availableSize: CGSize, state: EmptyComponentState, environment: Environment<Empty>, transition: Transition) -> CGSize {
|
||||
func update(component: ListSubSectionComponent, availableSize: CGSize, state: EmptyComponentState, environment: Environment<Empty>, transition: ComponentTransition) -> CGSize {
|
||||
self.component = component
|
||||
|
||||
var contentHeight: CGFloat = 0.0
|
||||
@@ -642,7 +642,7 @@ public final class ListSubSectionComponent: Component {
|
||||
return View(frame: CGRect())
|
||||
}
|
||||
|
||||
public func update(view: View, availableSize: CGSize, state: EmptyComponentState, environment: Environment<Empty>, transition: Transition) -> CGSize {
|
||||
public func update(view: View, availableSize: CGSize, state: EmptyComponentState, environment: Environment<Empty>, transition: ComponentTransition) -> CGSize {
|
||||
return view.update(component: self, availableSize: availableSize, state: state, environment: environment, transition: transition)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user