From 086af29cbbdaf97300b6f771b3f7325f04d62e58 Mon Sep 17 00:00:00 2001 From: Ryan Nystrom Date: Mon, 20 Nov 2017 17:22:19 -0500 Subject: [PATCH] allow double-tap like when reaction not visible (#1009) --- .../Comments/IssueCommentSectionController.swift | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/Classes/Issues/Comments/IssueCommentSectionController.swift b/Classes/Issues/Comments/IssueCommentSectionController.swift index 17611655..1a3eb5cb 100644 --- a/Classes/Issues/Comments/IssueCommentSectionController.swift +++ b/Classes/Issues/Comments/IssueCommentSectionController.swift @@ -139,7 +139,7 @@ DoubleTappableCellDelegate { return true } - private func react(cell: IssueCommentReactionCell, content: ReactionContent, isAdd: Bool) { + private func react(cell: IssueCommentReactionCell?, content: ReactionContent, isAdd: Bool) { guard let object = self.object else { return } let previousReaction = reactionMutation @@ -150,7 +150,9 @@ DoubleTappableCellDelegate { add: isAdd ) reactionMutation = result.viewModel - cell.perform(operation: result.operation, content: content) + + cell?.perform(operation: result.operation, content: content) + update(animated: true) generator.impactOccurred() client.react(subjectID: object.id, content: content, isAdd: isAdd) { [weak self] result in @@ -318,16 +320,16 @@ DoubleTappableCellDelegate { // MARK: DoubleTappableCellDelegate func didDoubleTap(cell: DoubleTappableCell) { - guard let reactionCell = collectionContext?.cellForItem(at: numberOfItems() - 1, sectionController: self) as? IssueCommentReactionCell else { - return - } - let reaction = ReactionContent.thumbsUp guard let reactions = reactionMutation ?? self.object?.reactions, !reactions.viewerDidReact(reaction: reaction) else { return } - react(cell: reactionCell, content: reaction, isAdd: true) + react( + cell: collectionContext?.cellForItem(at: numberOfItems() - 1, sectionController: self) as? IssueCommentReactionCell, + content: reaction, + isAdd: true + ) } // MARK: IssueCommentDetailCellDelegate