Hide context menus and swipe actions on instance public timelines

This commit is contained in:
Shadowfacts 2020-01-25 10:44:31 -05:00
parent 7c207efa07
commit 6757031dcb
Signed by: shadowfacts
GPG Key ID: 94A5AB95422746E5
1 changed files with 21 additions and 0 deletions

View File

@ -77,6 +77,27 @@ class InstanceTimelineViewController: TimelineTableViewController {
// no-op, we don't currently support viewing whole conversations from other instances
}
override func tableView(_ tableView: UITableView, contextMenuConfigurationForRowAt indexPath: IndexPath, point: CGPoint) -> UIContextMenuConfiguration? {
// don't show other screens or actions for other instances
return nil
}
override func tableView(_ tableView: UITableView, leadingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {
// don't show swipe actions for other instances
return nil
}
override func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {
// only show more actions for other instances
let more = UIContextualAction(style: .normal, title: "More") { (action, view, completion) in
completion(true)
self.showMoreOptions(forStatus: self.timelineSegments[indexPath.section][indexPath.row].id, sourceView: tableView.cellForRow(at: indexPath))
}
more.image = UIImage(systemName: "ellipsis.circle.fill")
more.backgroundColor = .lightGray
return UISwipeActionsConfiguration(actions: [more])
}
// MARK: - Interaction
@objc func toggleSaveButtonPressed() {
if SavedDataManager.shared.isSaved(instance: instanceURL, for: parentMastodonController!.accountInfo!) {