From 6757031dcb511e8e92a597b84414f79427b9d606 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Sat, 25 Jan 2020 10:44:31 -0500 Subject: [PATCH] Hide context menus and swipe actions on instance public timelines --- .../InstanceTimelineViewController.swift | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/Tusker/Screens/Timeline/InstanceTimelineViewController.swift b/Tusker/Screens/Timeline/InstanceTimelineViewController.swift index 9284df250e..83b4541192 100644 --- a/Tusker/Screens/Timeline/InstanceTimelineViewController.swift +++ b/Tusker/Screens/Timeline/InstanceTimelineViewController.swift @@ -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!) {