From 9a4d915e0b455a2ffd74ed1caf3d3abb1cf6b15d Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Thu, 3 Oct 2019 15:55:16 -0500 Subject: [PATCH] Move read toggle to be swipe-right on timeline --- .../MasterTimelineViewController.swift | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/iOS/MasterTimeline/MasterTimelineViewController.swift b/iOS/MasterTimeline/MasterTimelineViewController.swift index ccc773a17..36c61034c 100644 --- a/iOS/MasterTimeline/MasterTimelineViewController.swift +++ b/iOS/MasterTimeline/MasterTimelineViewController.swift @@ -179,8 +179,7 @@ class MasterTimelineViewController: UITableViewController, UndoableCommandRunner // MARK: - Table view - override func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? { - + override func tableView(_ tableView: UITableView, leadingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? { guard let article = dataSource.itemIdentifier(for: indexPath) else { return nil } // Set up the read action @@ -196,6 +195,13 @@ class MasterTimelineViewController: UITableViewController, UndoableCommandRunner readAction.image = article.status.read ? AppAssets.circleClosedImage : AppAssets.circleOpenImage readAction.backgroundColor = AppAssets.primaryAccentColor + return UISwipeActionsConfiguration(actions: [readAction]) + } + + override func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? { + + guard let article = dataSource.itemIdentifier(for: indexPath) else { return nil } + // Set up the star action let starTitle = article.status.starred ? NSLocalizedString("Unstar", comment: "Unstar") : @@ -253,8 +259,7 @@ class MasterTimelineViewController: UITableViewController, UndoableCommandRunner moreAction.image = AppAssets.moreImage moreAction.backgroundColor = UIColor.systemGray - let configuration = UISwipeActionsConfiguration(actions: [readAction, starAction, moreAction]) - return configuration + return UISwipeActionsConfiguration(actions: [starAction, moreAction]) }