forked from shadowfacts/Tusker
VoiceOver: Indicate filtered posts, make double tapping expand them
This commit is contained in:
parent
e1886509d3
commit
fabe339215
|
@ -207,6 +207,10 @@ extension TrendingStatusesViewController: StatusCollectionViewCellDelegate {
|
||||||
dataSource.apply(snapshot, animatingDifferences: animated, completion: completion)
|
dataSource.apply(snapshot, animatingDifferences: animated, completion: completion)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func statusCellShowFiltered(_ cell: StatusCollectionViewCell) {
|
||||||
|
fatalError()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension TrendingStatusesViewController: StatusBarTappableViewController {
|
extension TrendingStatusesViewController: StatusBarTappableViewController {
|
||||||
|
|
|
@ -499,6 +499,17 @@ extension ProfileStatusesViewController: StatusCollectionViewCellDelegate {
|
||||||
dataSource.apply(snapshot, animatingDifferences: animated, completion: completion)
|
dataSource.apply(snapshot, animatingDifferences: animated, completion: completion)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func statusCellShowFiltered(_ cell: StatusCollectionViewCell) {
|
||||||
|
if let indexPath = collectionView.indexPath(for: cell),
|
||||||
|
let item = dataSource.itemIdentifier(for: indexPath),
|
||||||
|
case .status(id: _, collapseState: _, filterState: let filterState, pinned: _) = item {
|
||||||
|
filterState.setResult(.allow)
|
||||||
|
var snapshot = dataSource.snapshot()
|
||||||
|
snapshot.reconfigureItems([item])
|
||||||
|
dataSource.apply(snapshot, animatingDifferences: true)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension ProfileStatusesViewController: TabBarScrollableViewController {
|
extension ProfileStatusesViewController: TabBarScrollableViewController {
|
||||||
|
|
|
@ -260,6 +260,10 @@ extension StatusActionAccountListViewController: StatusCollectionViewCellDelegat
|
||||||
dataSource.apply(snapshot, animatingDifferences: animated, completion: completion)
|
dataSource.apply(snapshot, animatingDifferences: animated, completion: completion)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func statusCellShowFiltered(_ cell: StatusCollectionViewCell) {
|
||||||
|
fatalError()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension StatusActionAccountListViewController: StatusBarTappableViewController {
|
extension StatusActionAccountListViewController: StatusBarTappableViewController {
|
||||||
|
|
|
@ -848,6 +848,17 @@ extension TimelineViewController: StatusCollectionViewCellDelegate {
|
||||||
dataSource.apply(snapshot, animatingDifferences: animated, completion: completion)
|
dataSource.apply(snapshot, animatingDifferences: animated, completion: completion)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func statusCellShowFiltered(_ cell: StatusCollectionViewCell) {
|
||||||
|
if let indexPath = collectionView.indexPath(for: cell),
|
||||||
|
let item = dataSource.itemIdentifier(for: indexPath),
|
||||||
|
case .status(id: _, collapseState: _, filterState: let filterState) = item {
|
||||||
|
filterState.setResult(.allow)
|
||||||
|
var snapshot = dataSource.snapshot()
|
||||||
|
snapshot.reconfigureItems([item])
|
||||||
|
dataSource.apply(snapshot, animatingDifferences: true)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension TimelineViewController: TabBarScrollableViewController {
|
extension TimelineViewController: TabBarScrollableViewController {
|
||||||
|
|
|
@ -13,6 +13,7 @@ import Combine
|
||||||
@MainActor
|
@MainActor
|
||||||
protocol StatusCollectionViewCellDelegate: AnyObject, TuskerNavigationDelegate, MenuActionProvider {
|
protocol StatusCollectionViewCellDelegate: AnyObject, TuskerNavigationDelegate, MenuActionProvider {
|
||||||
func statusCellNeedsReconfigure(_ cell: StatusCollectionViewCell, animated: Bool, completion: (() -> Void)?)
|
func statusCellNeedsReconfigure(_ cell: StatusCollectionViewCell, animated: Bool, completion: (() -> Void)?)
|
||||||
|
func statusCellShowFiltered(_ cell: StatusCollectionViewCell)
|
||||||
}
|
}
|
||||||
|
|
||||||
@MainActor
|
@MainActor
|
||||||
|
|
|
@ -281,6 +281,7 @@ class TimelineStatusCollectionViewCell: UICollectionViewListCell, StatusCollecti
|
||||||
var accountID: String!
|
var accountID: String!
|
||||||
private var reblogStatusID: String?
|
private var reblogStatusID: String?
|
||||||
private var rebloggerID: String?
|
private var rebloggerID: String?
|
||||||
|
private var filterReason: String?
|
||||||
|
|
||||||
private var firstLayout = true
|
private var firstLayout = true
|
||||||
var isGrayscale = false
|
var isGrayscale = false
|
||||||
|
@ -356,6 +357,11 @@ class TimelineStatusCollectionViewCell: UICollectionViewListCell, StatusCollecti
|
||||||
|
|
||||||
override var accessibilityAttributedLabel: NSAttributedString? {
|
override var accessibilityAttributedLabel: NSAttributedString? {
|
||||||
get {
|
get {
|
||||||
|
if contentViewMode == .filtered,
|
||||||
|
let filterReason {
|
||||||
|
return NSAttributedString(string: "Filtered: \(filterReason)")
|
||||||
|
}
|
||||||
|
|
||||||
guard let status = mastodonController.persistentContainer.status(for: statusID) else {
|
guard let status = mastodonController.persistentContainer.status(for: statusID) else {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -395,7 +401,9 @@ class TimelineStatusCollectionViewCell: UICollectionViewListCell, StatusCollecti
|
||||||
|
|
||||||
override var accessibilityHint: String? {
|
override var accessibilityHint: String? {
|
||||||
get {
|
get {
|
||||||
if statusState.collapsed ?? false {
|
if contentViewMode == .filtered {
|
||||||
|
return "Double tap to show the post."
|
||||||
|
} else if statusState.collapsed ?? false {
|
||||||
return "Double tap to expand the post."
|
return "Double tap to expand the post."
|
||||||
} else {
|
} else {
|
||||||
return nil
|
return nil
|
||||||
|
@ -405,7 +413,9 @@ class TimelineStatusCollectionViewCell: UICollectionViewListCell, StatusCollecti
|
||||||
}
|
}
|
||||||
|
|
||||||
override func accessibilityActivate() -> Bool {
|
override func accessibilityActivate() -> Bool {
|
||||||
if statusState.collapsed ?? false {
|
if contentViewMode == .filtered {
|
||||||
|
delegate?.statusCellShowFiltered(self)
|
||||||
|
} else if statusState.collapsed ?? false {
|
||||||
toggleCollapse()
|
toggleCollapse()
|
||||||
} else {
|
} else {
|
||||||
delegate?.selected(status: statusID, state: statusState.copy())
|
delegate?.selected(status: statusID, state: statusState.copy())
|
||||||
|
@ -478,6 +488,7 @@ class TimelineStatusCollectionViewCell: UICollectionViewListCell, StatusCollecti
|
||||||
case .allow:
|
case .allow:
|
||||||
setContentViewMode(.status)
|
setContentViewMode(.status)
|
||||||
case .warn(let filterTitle):
|
case .warn(let filterTitle):
|
||||||
|
filterReason = filterTitle
|
||||||
let attrStr = NSMutableAttributedString(string: "Filtered: \(filterTitle) ")
|
let attrStr = NSMutableAttributedString(string: "Filtered: \(filterTitle) ")
|
||||||
let showStr = NSAttributedString(string: "Show", attributes: [.foregroundColor: UIColor.tintColor])
|
let showStr = NSAttributedString(string: "Show", attributes: [.foregroundColor: UIColor.tintColor])
|
||||||
attrStr.append(showStr)
|
attrStr.append(showStr)
|
||||||
|
|
Loading…
Reference in New Issue