mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-10 16:29:55 +00:00
Added haptic feedback on collection index scroll
This commit is contained in:
parent
0d65c31ae1
commit
c1b0117bf5
@ -10,6 +10,7 @@ public final class CollectionIndexNode: ASDisplayNode {
|
|||||||
private var currentSections: [String] = []
|
private var currentSections: [String] = []
|
||||||
private var currentColor: UIColor?
|
private var currentColor: UIColor?
|
||||||
private var titleNodes: [String: (node: ImmediateTextNode, size: CGSize)] = [:]
|
private var titleNodes: [String: (node: ImmediateTextNode, size: CGSize)] = [:]
|
||||||
|
private var scrollFeedback: HapticFeedback?
|
||||||
|
|
||||||
private var currentSelectedIndex: String?
|
private var currentSelectedIndex: String?
|
||||||
public var indexSelected: ((String) -> Void)?
|
public var indexSelected: ((String) -> Void)?
|
||||||
@ -148,6 +149,11 @@ public final class CollectionIndexNode: ASDisplayNode {
|
|||||||
self.currentSelectedIndex = locationTitle
|
self.currentSelectedIndex = locationTitle
|
||||||
if let locationTitle = locationTitle {
|
if let locationTitle = locationTitle {
|
||||||
self.indexSelected?(locationTitle)
|
self.indexSelected?(locationTitle)
|
||||||
|
|
||||||
|
if self.scrollFeedback == nil {
|
||||||
|
self.scrollFeedback = HapticFeedback()
|
||||||
|
}
|
||||||
|
self.scrollFeedback?.tap()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case .cancelled, .ended:
|
case .cancelled, .ended:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user