mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 22:55:00 +00:00
Various fixes
This commit is contained in:
@@ -180,6 +180,10 @@ final class ComposeTodoScreenComponent: Component {
|
||||
}
|
||||
|
||||
private func item(at point: CGPoint) -> (AnyHashable, ComponentView<Empty>)? {
|
||||
if self.scrollView.isTracking || self.scrollView.isDecelerating {
|
||||
return nil
|
||||
}
|
||||
|
||||
let localPoint = self.todoItemsSectionContainer.convert(point, from: self)
|
||||
for (id, itemView) in self.todoItemsSectionContainer.itemViews {
|
||||
if let view = itemView.contents.view as? ListComposePollOptionComponent.View, !view.isRevealed && !view.currentText.isEmpty {
|
||||
@@ -371,6 +375,10 @@ final class ComposeTodoScreenComponent: Component {
|
||||
}
|
||||
}
|
||||
|
||||
func scrollViewWillBeginDragging(_ scrollView: UIScrollView) {
|
||||
self.endEditing(true)
|
||||
}
|
||||
|
||||
private func updateScrolling(transition: ComponentTransition) {
|
||||
let navigationAlphaDistance: CGFloat = 16.0
|
||||
let navigationAlpha: CGFloat = max(0.0, min(1.0, self.scrollView.contentOffset.y / navigationAlphaDistance))
|
||||
@@ -928,17 +936,24 @@ final class ComposeTodoScreenComponent: Component {
|
||||
if case let .text(text) = data {
|
||||
let lines = text.string.components(separatedBy: "\n")
|
||||
if !lines.isEmpty {
|
||||
self.endEditing(true)
|
||||
var i = 0
|
||||
for line in lines {
|
||||
if line.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty {
|
||||
continue
|
||||
}
|
||||
let line = String(line.prefix(component.initialData.maxTodoItemLength))
|
||||
if i < self.todoItems.count {
|
||||
self.todoItems[i].resetText = NSAttributedString(string: line)
|
||||
} else {
|
||||
let todoItem = ComposeTodoScreenComponent.TodoItem(
|
||||
id: self.nextTodoItemId
|
||||
)
|
||||
todoItem.resetText = NSAttributedString(string: line)
|
||||
self.todoItems.append(todoItem)
|
||||
self.nextTodoItemId += 1
|
||||
if self.todoItems.count < component.initialData.maxTodoItemsCount {
|
||||
let todoItem = ComposeTodoScreenComponent.TodoItem(
|
||||
id: self.nextTodoItemId
|
||||
)
|
||||
todoItem.resetText = NSAttributedString(string: line)
|
||||
self.todoItems.append(todoItem)
|
||||
self.nextTodoItemId += 1
|
||||
}
|
||||
}
|
||||
i += 1
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user