From 4f2f8d517f72a631fdaa9fa90876e2ba98b57805 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Sat, 12 Jun 2021 19:22:51 -0400 Subject: [PATCH] Don't initiate table view cell drag while user is selecting poll options --- Tusker/Views/Poll/StatusPollView.swift | 4 ++++ Tusker/Views/Status/TimelineStatusTableViewCell.swift | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Tusker/Views/Poll/StatusPollView.swift b/Tusker/Views/Poll/StatusPollView.swift index 62a1a38e..04c49d2d 100644 --- a/Tusker/Views/Poll/StatusPollView.swift +++ b/Tusker/Views/Poll/StatusPollView.swift @@ -33,6 +33,10 @@ class StatusPollView: UIView { private var animator: UIViewPropertyAnimator! private var currentSelectedOptionIndex: Int! + var isTracking: Bool { + optionsView.isTracking + } + override func awakeFromNib() { super.awakeFromNib() diff --git a/Tusker/Views/Status/TimelineStatusTableViewCell.swift b/Tusker/Views/Status/TimelineStatusTableViewCell.swift index 6027a412..5e6c3508 100644 --- a/Tusker/Views/Status/TimelineStatusTableViewCell.swift +++ b/Tusker/Views/Status/TimelineStatusTableViewCell.swift @@ -326,8 +326,11 @@ extension TimelineStatusTableViewCell: TableViewSwipeActionProvider { extension TimelineStatusTableViewCell: DraggableTableViewCell { func dragItemsForBeginning(session: UIDragSession) -> [UIDragItem] { + // the poll options view is tracking while the user is dragging between options + // while that's happening, don't initiate a drag guard let status = mastodonController.persistentContainer.status(for: statusID), - let accountID = mastodonController.accountInfo?.id else { + let accountID = mastodonController.accountInfo?.id, + !pollView.isTracking else { return [] } let provider = NSItemProvider(object: status.url! as NSURL)