Change explore swipe action titles

This commit is contained in:
Shadowfacts 2022-05-10 22:44:23 -04:00
parent 1e2947ceba
commit ed0643c4ad
1 changed files with 5 additions and 1 deletions

View File

@ -259,20 +259,24 @@ class ExploreViewController: UIViewController, UICollectionViewDelegate {
}
private func trailingSwipeActionsForCell(at indexPath: IndexPath) -> UISwipeActionsConfiguration? {
let title: String
let handler: UIContextualAction.Handler
switch dataSource.itemIdentifier(for: indexPath) {
case let .list(list):
title = NSLocalizedString("Delete", comment: "delete swipe action title")
handler = { (_, _, completion) in
self.deleteList(list, completion: completion)
}
case let .savedHashtag(hashtag):
title = NSLocalizedString("Unsave", comment: "unsave swipe action title")
handler = { (_, _, completion) in
self.removeSavedHashtag(hashtag)
completion(true)
}
case let .savedInstance(url):
title = NSLocalizedString("Unsave", comment: "unsave swipe action title")
handler = { (_, _, completion) in
self.removeSavedInstance(url)
completion(true)
@ -283,7 +287,7 @@ class ExploreViewController: UIViewController, UICollectionViewDelegate {
}
return UISwipeActionsConfiguration(actions: [
UIContextualAction(style: .destructive, title: NSLocalizedString("Delete", comment: "delete swipe action title"), handler: handler)
UIContextualAction(style: .destructive, title: title, handler: handler)
])
}