Skip to content
This repository was archived by the owner on Sep 20, 2023. It is now read-only.

Commit 90cc726

Browse files
Natalia Haratehjdisho
authored andcommitted
Fix pushing Issues VC when user taps on username in referenced issues (#2766)
* mark issue title & number with MarkdownAttribute.issue, set IssueDetailsModel as value * delegate MarkdownStyledTextView taps to IssueReferencedSectionController * don't mark issue title & number with markdown attribute, allow issues to go through didSelectItem flow * swap switch for if/else * use the result of handle(attribute:) to set shouldShowIssueOnItemSelection
1 parent dbb5603 commit 90cc726

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

Classes/Issues/Referenced/IssueReferencedSectionController.swift

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import Foundation
1010
import IGListKit
1111

12-
final class IssueReferencedSectionController: ListGenericSectionController<IssueReferencedModel> {
12+
final class IssueReferencedSectionController: ListGenericSectionController<IssueReferencedModel>, MarkdownStyledTextViewDelegate {
1313

1414
private let client: GithubClient
1515

@@ -29,14 +29,29 @@ final class IssueReferencedSectionController: ListGenericSectionController<Issue
2929
let object = self.object
3030
else { fatalError("Missing context, model, or cell wrong type") }
3131
cell.configure(object)
32-
cell.delegate = viewController
32+
cell.delegate = self
3333
return cell
3434
}
3535

36+
private var shouldShowIssueOnItemSelection: Bool = true
37+
3638
override func didSelectItem(at index: Int) {
39+
guard shouldShowIssueOnItemSelection else {
40+
shouldShowIssueOnItemSelection = true
41+
return
42+
}
3743
guard let object = self.object else { return }
3844
let model = IssueDetailsModel(owner: object.owner, repo: object.repo, number: object.number)
3945
viewController?.route_push(to: IssuesViewController(client: client, model: model))
4046
}
4147

48+
// MARK: MarkdownStyledTextViewDelegate
49+
50+
func didTap(cell: MarkdownStyledTextView, attribute: DetectedMarkdownAttribute) {
51+
guard let viewController = viewController else {
52+
return
53+
}
54+
shouldShowIssueOnItemSelection = !viewController.handle(attribute: attribute)
55+
}
56+
4257
}

0 commit comments

Comments
 (0)