diff --git a/Tusker/Screens/Conversation/ConversationTableViewController.swift b/Tusker/Screens/Conversation/ConversationTableViewController.swift index 4f014238d3..6e9c2edc1a 100644 --- a/Tusker/Screens/Conversation/ConversationTableViewController.swift +++ b/Tusker/Screens/Conversation/ConversationTableViewController.swift @@ -133,18 +133,15 @@ class ConversationTableViewController: EnhancedTableViewController { } override func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool { -// return tableView.cellForRow(at: indexPath) is TableViewSwipeActionProvider - return false + return true } override func tableView(_ tableView: UITableView, leadingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? { -// return (tableView.cellForRow(at: indexPath) as? TableViewSwipeActionProvider)?.leadingSwipeActionsConfiguration() - return nil + return (tableView.cellForRow(at: indexPath) as? TableViewSwipeActionProvider)?.leadingSwipeActionsConfiguration() } override func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? { -// return (tableView.cellForRow(at: indexPath) as? TableViewSwipeActionProvider)?.trailingSwipeActionsConfiguration() - return nil + return (tableView.cellForRow(at: indexPath) as? TableViewSwipeActionProvider)?.trailingSwipeActionsConfiguration() } } diff --git a/Tusker/Screens/Notifications/NotificationsTableViewController.swift b/Tusker/Screens/Notifications/NotificationsTableViewController.swift index 416c671ad5..461f7fe6b3 100644 --- a/Tusker/Screens/Notifications/NotificationsTableViewController.swift +++ b/Tusker/Screens/Notifications/NotificationsTableViewController.swift @@ -120,18 +120,15 @@ class NotificationsTableViewController: EnhancedTableViewController { } override func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool { -// return tableView.cellForRow(at: indexPath) is TableViewSwipeActionProvider - return false + return true } override func tableView(_ tableView: UITableView, leadingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? { -// return (tableView.cellForRow(at: indexPath) as? TableViewSwipeActionProvider)?.leadingSwipeActionsConfiguration() - return nil + return (tableView.cellForRow(at: indexPath) as? TableViewSwipeActionProvider)?.leadingSwipeActionsConfiguration() } override func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? { -// return (tableView.cellForRow(at: indexPath) as? TableViewSwipeActionProvider)?.trailingSwipeActionsConfiguration() - return nil + return (tableView.cellForRow(at: indexPath) as? TableViewSwipeActionProvider)?.trailingSwipeActionsConfiguration() } @objc func refreshNotifications(_ sender: Any) { diff --git a/Tusker/Screens/Profile/ProfileTableViewController.swift b/Tusker/Screens/Profile/ProfileTableViewController.swift index 862c380803..efd47b2881 100644 --- a/Tusker/Screens/Profile/ProfileTableViewController.swift +++ b/Tusker/Screens/Profile/ProfileTableViewController.swift @@ -206,18 +206,15 @@ class ProfileTableViewController: EnhancedTableViewController, PreferencesAdapti } override func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool { -// return tableView.cellForRow(at: indexPath) is TableViewSwipeActionProvider - return false + return true } override func tableView(_ tableView: UITableView, leadingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? { -// return (tableView.cellForRow(at: indexPath) as? TableViewSwipeActionProvider)?.leadingSwipeActionsConfiguration() - return nil + return (tableView.cellForRow(at: indexPath) as? TableViewSwipeActionProvider)?.leadingSwipeActionsConfiguration() } override func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? { -// return (tableView.cellForRow(at: indexPath) as? TableViewSwipeActionProvider)?.trailingSwipeActionsConfiguration() - return nil + return (tableView.cellForRow(at: indexPath) as? TableViewSwipeActionProvider)?.trailingSwipeActionsConfiguration() } @objc func refreshStatuses(_ sender: Any) { diff --git a/Tusker/Screens/Timeline/TimelineTableViewController.swift b/Tusker/Screens/Timeline/TimelineTableViewController.swift index b6854fd4b5..5be78ae1d9 100644 --- a/Tusker/Screens/Timeline/TimelineTableViewController.swift +++ b/Tusker/Screens/Timeline/TimelineTableViewController.swift @@ -124,18 +124,15 @@ class TimelineTableViewController: EnhancedTableViewController { } override func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool { -// return tableView.cellForRow(at: indexPath) is TableViewSwipeActionProvider - return false + return true } override func tableView(_ tableView: UITableView, leadingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? { -// return (tableView.cellForRow(at: indexPath) as? TableViewSwipeActionProvider)?.leadingSwipeActionsConfiguration() - return nil + return (tableView.cellForRow(at: indexPath) as? TableViewSwipeActionProvider)?.leadingSwipeActionsConfiguration() } override func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? { -// return (tableView.cellForRow(at: indexPath) as? TableViewSwipeActionProvider)?.trailingSwipeActionsConfiguration() - return nil + return (tableView.cellForRow(at: indexPath) as? TableViewSwipeActionProvider)?.trailingSwipeActionsConfiguration() } @objc func refreshStatuses(_ sender: Any) { diff --git a/Tusker/Views/Status/StatusTableViewCell.swift b/Tusker/Views/Status/StatusTableViewCell.swift index abd7048a78..59357f34fb 100644 --- a/Tusker/Views/Status/StatusTableViewCell.swift +++ b/Tusker/Views/Status/StatusTableViewCell.swift @@ -257,19 +257,6 @@ class StatusTableViewCell: UITableViewCell, PreferencesAdaptive { extension StatusTableViewCell: TableViewSwipeActionProvider { - static var favoriteActionImage: UIImage = UIGraphicsImageRenderer(size: CGSize(width: 30 * 137/131, height: 30)).image { _ in - UIImage(named: "Favorite")!.draw(in: CGRect(x: 0, y: 0, width: 30 * 137/131, height: 30)) - } - static var reblogActionImage: UIImage = UIGraphicsImageRenderer(size: CGSize(width: 30 * 927/558, height: 30)).image { _ in - UIImage(named: "Reblog")!.draw(in: CGRect(x: 0, y: 0, width: 30 * 927/558, height: 30)) - } - static var replyActionImage: UIImage = UIGraphicsImageRenderer(size: CGSize(width: 30 * 205/151, height: 30)).image { _ in - UIImage(named: "Reply")!.draw(in: CGRect(x: 0, y: 0, width: 30 * 205/151, height: 30)) - } - static var moreActionImage: UIImage = UIGraphicsImageRenderer(size: CGSize(width: 30 * 2/1, height: 30)).image { _ in - UIImage(named: "More")!.draw(in: CGRect(x: 0, y: 0, width: 30 * 2/1, height: 30)) - } - func leadingSwipeActionsConfiguration() -> UISwipeActionsConfiguration? { guard let status = MastodonCache.status(for: statusID) else { fatalError("Missing cached status \(statusID!)") } @@ -299,7 +286,7 @@ extension StatusTableViewCell: TableViewSwipeActionProvider { } }) } - favorite.image = StatusTableViewCell.favoriteActionImage + favorite.image = UIImage(systemName: "star.fill") favorite.backgroundColor = favoriteColor let reblogTitle: String @@ -327,7 +314,7 @@ extension StatusTableViewCell: TableViewSwipeActionProvider { } }) } - reblog.image = StatusTableViewCell.reblogActionImage + reblog.image = UIImage(systemName: "repeat") reblog.backgroundColor = reblogColor return UISwipeActionsConfiguration(actions: [favorite, reblog]) @@ -338,13 +325,13 @@ extension StatusTableViewCell: TableViewSwipeActionProvider { completion(true) self.delegate?.reply(to: self.statusID) } - reply.image = StatusTableViewCell.replyActionImage + reply.image = UIImage(systemName: "arrowshape.turn.up.left.fill") reply.backgroundColor = tintColor let more = UIContextualAction(style: .normal, title: "More") { (action, view, completion) in completion(true) self.delegate?.showMoreOptions(forStatus: self.statusID) } - more.image = StatusTableViewCell.moreActionImage + more.image = UIImage(systemName: "ellipsis") more.backgroundColor = .gray return UISwipeActionsConfiguration(actions: [reply, more]) }