mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
Update API
This commit is contained in:
@@ -65,6 +65,7 @@ public final class SheetComponent<ChildEnvironmentType: Equatable>: Component {
|
||||
public let clipsContent: Bool
|
||||
public let externalState: ExternalState?
|
||||
public let animateOut: ActionSlot<Action<()>>
|
||||
public let onPan: () -> Void
|
||||
|
||||
public init(
|
||||
content: AnyComponent<ChildEnvironmentType>,
|
||||
@@ -72,7 +73,8 @@ public final class SheetComponent<ChildEnvironmentType: Equatable>: Component {
|
||||
followContentSizeChanges: Bool = false,
|
||||
clipsContent: Bool = false,
|
||||
externalState: ExternalState? = nil,
|
||||
animateOut: ActionSlot<Action<()>>
|
||||
animateOut: ActionSlot<Action<()>>,
|
||||
onPan: @escaping () -> Void = {}
|
||||
) {
|
||||
self.content = content
|
||||
self.backgroundColor = backgroundColor
|
||||
@@ -80,6 +82,7 @@ public final class SheetComponent<ChildEnvironmentType: Equatable>: Component {
|
||||
self.clipsContent = clipsContent
|
||||
self.externalState = externalState
|
||||
self.animateOut = animateOut
|
||||
self.onPan = onPan
|
||||
}
|
||||
|
||||
public static func ==(lhs: SheetComponent, rhs: SheetComponent) -> Bool {
|
||||
@@ -128,6 +131,8 @@ public final class SheetComponent<ChildEnvironmentType: Equatable>: Component {
|
||||
return false
|
||||
}
|
||||
|
||||
private var component: SheetComponent<ChildEnvironmentType>?
|
||||
|
||||
private let dimView: UIView
|
||||
private let scrollView: ScrollView
|
||||
private let backgroundView: UIView
|
||||
@@ -199,6 +204,10 @@ public final class SheetComponent<ChildEnvironmentType: Equatable>: Component {
|
||||
self.dismiss?(true)
|
||||
}
|
||||
|
||||
public func scrollViewWillBeginDragging(_ scrollView: UIScrollView) {
|
||||
self.component?.onPan()
|
||||
}
|
||||
|
||||
private var scrollingOut = false
|
||||
public func scrollViewWillEndDragging(_ scrollView: UIScrollView, withVelocity velocity: CGPoint, targetContentOffset: UnsafeMutablePointer<CGPoint>) {
|
||||
let contentOffset = (scrollView.contentOffset.y + scrollView.contentInset.top - scrollView.contentSize.height) * -1.0
|
||||
@@ -302,6 +311,7 @@ public final class SheetComponent<ChildEnvironmentType: Equatable>: Component {
|
||||
}
|
||||
}
|
||||
|
||||
self.component = component
|
||||
self.currentHasInputHeight = sheetEnvironment.hasInputHeight
|
||||
|
||||
switch component.backgroundColor {
|
||||
|
||||
Reference in New Issue
Block a user