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

Fix pushing Issues VC when user taps on username in referenced issues #2766

Merged
merged 5 commits into from
Jun 2, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions Classes/Issues/Referenced/IssueReferencedSectionController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import Foundation
import IGListKit

final class IssueReferencedSectionController: ListGenericSectionController<IssueReferencedModel> {
final class IssueReferencedSectionController: ListGenericSectionController<IssueReferencedModel>, MarkdownStyledTextViewDelegate {

private let client: GithubClient

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

private var shouldShowIssueOnItemSelection: Bool = true

override func didSelectItem(at index: Int) {
guard shouldShowIssueOnItemSelection else {
shouldShowIssueOnItemSelection = true
return
}
guard let object = self.object else { return }
let model = IssueDetailsModel(owner: object.owner, repo: object.repo, number: object.number)
viewController?.route_push(to: IssuesViewController(client: client, model: model))
}

// MARK: MarkdownStyledTextViewDelegate

func didTap(cell: MarkdownStyledTextView, attribute: DetectedMarkdownAttribute) {
guard let viewController = viewController else {
return
}
shouldShowIssueOnItemSelection = !viewController.handle(attribute: attribute)
}

}