Fix crash if TimelineGapCollectionViewCell is somehow accessibility-activated

This commit is contained in:
Shadowfacts 2023-05-15 22:03:51 -04:00
parent 126e8c8858
commit f004c82302
1 changed files with 5 additions and 4 deletions

View File

@ -135,11 +135,12 @@ class TimelineGapCollectionViewCell: UICollectionViewCell {
override var accessibilityCustomActions: [UIAccessibilityCustomAction]? {
get {
[TimelineGapDirection.below, .above].map { dir in
UIAccessibilityCustomAction(name: "Load \(dir.accessibilityLabel)") { [unowned self] _ in
UIAccessibilityCustomAction(name: "Load \(dir.accessibilityLabel)") { [weak self] _ in
guard let self else { return false }
Task {
showsIndicator = true
await fillGap?(dir)
showsIndicator = false
self.showsIndicator = true
await self.fillGap?(dir)
self.showsIndicator = false
}
return true
}