diff --git a/View Controllers/TableViewController.swift b/View Controllers/TableViewController.swift index 05848a5..5f57614 100644 --- a/View Controllers/TableViewController.swift +++ b/View Controllers/TableViewController.swift @@ -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) { diff --git a/Views/UIKit/Content Views/LoadMoreView.swift b/Views/UIKit/Content Views/LoadMoreView.swift index cf203e5..46b4823 100644 --- a/Views/UIKit/Content Views/LoadMoreView.swift +++ b/Views/UIKit/Content Views/LoadMoreView.swift @@ -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 }