mirror of
https://github.com/metabolist/metatext.git
synced 2024-11-14 20:41:00 +00:00
Fix load more accessibility custom actions
This commit is contained in:
parent
dcc22bf260
commit
8e1a654479
2 changed files with 17 additions and 2 deletions
|
@ -383,6 +383,18 @@ private extension TableViewController {
|
|||
.merge(with: NotificationCenter.default.publisher(for: NewStatusViewController.newStatusPostedNotification))
|
||||
.sink { [weak self] _ in self?.refreshIfAble() }
|
||||
.store(in: &cancellables)
|
||||
|
||||
NotificationCenter.default.publisher(for: LoadMoreView.accessibilityCustomAction)
|
||||
.sink { [weak self] notification in
|
||||
guard let self = self,
|
||||
let loadMoreView = notification.object as? LoadMoreView,
|
||||
let cell = self.tableView.visibleCells.first(where: { $0.contentView === loadMoreView }),
|
||||
let indexPath = self.tableView.indexPath(for: cell)
|
||||
else { return }
|
||||
|
||||
self.tableView(self.tableView, didSelectRowAt: indexPath)
|
||||
}
|
||||
.store(in: &cancellables)
|
||||
}
|
||||
|
||||
func update(_ update: CollectionUpdate) {
|
||||
|
|
|
@ -28,6 +28,9 @@ final class LoadMoreView: UIView {
|
|||
}
|
||||
|
||||
extension LoadMoreView {
|
||||
static let accessibilityCustomAction =
|
||||
Notification.Name("com.metabolist.metatext.load-more-view.accessibility-custom-action")
|
||||
|
||||
static var estimatedHeight: CGFloat {
|
||||
.defaultSpacing * 2 + UIFont.preferredFont(forTextStyle: .title2).lineHeight
|
||||
}
|
||||
|
@ -128,7 +131,7 @@ private extension LoadMoreView {
|
|||
name: aboveAccessibilityActionName) { [weak self] _ in
|
||||
self?.directionChange = -Self.directionChangeMax
|
||||
self?.updateDirectionChange(animated: false)
|
||||
self?.loadMoreConfiguration.viewModel.loadMore()
|
||||
NotificationCenter.default.post(name: Self.accessibilityCustomAction, object: self)
|
||||
|
||||
return true
|
||||
},
|
||||
|
@ -136,7 +139,7 @@ private extension LoadMoreView {
|
|||
name: belowAccessibilityActionName) { [weak self] _ in
|
||||
self?.directionChange = Self.directionChangeMax
|
||||
self?.updateDirectionChange(animated: false)
|
||||
self?.loadMoreConfiguration.viewModel.loadMore()
|
||||
NotificationCenter.default.post(name: Self.accessibilityCustomAction, object: self)
|
||||
|
||||
return true
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue