From 66dc61ace0a384419e390aeec2218a678fbb6b9d Mon Sep 17 00:00:00 2001 From: Ryan Nystrom Date: Sun, 18 Mar 2018 14:55:57 -0400 Subject: [PATCH] Refactor labeled events to use StyledText (#1659) * refactor tap handling on attributed views * styled cell interaction working * share menu code * label events finished --- .../IssueCommentSectionController.swift | 73 ++++++++++--------- Classes/Issues/GithubClient+Issues.swift | 3 + Classes/Issues/Issue+IssueType.swift | 2 + .../Issues/IssueCommentModelHandling.swift | 2 - Classes/Issues/Labeled/IssueLabeledCell.swift | 4 +- .../Issues/Labeled/IssueLabeledModel.swift | 65 +++++++---------- .../IssueLabeledSectionController.swift | 2 +- .../IssuePreviewSectionController.swift | 1 - Classes/Issues/PullRequest+IssueType.swift | 2 + .../Review/IssueReviewSectionController.swift | 21 +++--- .../RepositoryReadmeSectionController.swift | 1 - .../Utility/UIViewController+Routing.swift | 29 ++++++++ ...troller+AttributedStringViewDelegate.swift | 21 +----- ...ontroller+StyledTextViewCellDelegate.swift | 17 +++++ Classes/Views/AttributedStringView.swift | 41 +---------- Classes/Views/StyledTextViewCell.swift | 68 +++++++++++++++++ Classes/Views/Styles.swift | 8 ++ Classes/Views/UIView+DateDetails.swift | 25 +++++++ Freetime.xcodeproj/project.pbxproj | 32 ++++++-- Podfile.lock | 2 +- Pods/Manifest.lock | 2 +- .../StyledText/StyledTextBuilder.swift | 9 ++- 22 files changed, 272 insertions(+), 158 deletions(-) create mode 100644 Classes/Utility/UIViewController+Routing.swift create mode 100644 Classes/View Controllers/UIViewController+StyledTextViewCellDelegate.swift create mode 100644 Classes/Views/StyledTextViewCell.swift create mode 100644 Classes/Views/UIView+DateDetails.swift diff --git a/Classes/Issues/Comments/IssueCommentSectionController.swift b/Classes/Issues/Comments/IssueCommentSectionController.swift index 9d5dcfa2..9ff76723 100644 --- a/Classes/Issues/Comments/IssueCommentSectionController.swift +++ b/Classes/Issues/Comments/IssueCommentSectionController.swift @@ -16,7 +16,7 @@ final class IssueCommentSectionController: ListBindingSectionController(previous.labels.labels.map { $0.name }) let newLabelNames = Set(labels.map { $0.name }) @@ -331,6 +332,7 @@ extension GithubClient { type: .added, repoOwner: owner, repoName: repo, + contentSizeCategory: contentSizeCategory, width: 0 )) } @@ -346,6 +348,7 @@ extension GithubClient { type: .removed, repoOwner: owner, repoName: repo, + contentSizeCategory: contentSizeCategory, width: 0 )) } diff --git a/Classes/Issues/Issue+IssueType.swift b/Classes/Issues/Issue+IssueType.swift index 3a48bf9c..407e3608 100644 --- a/Classes/Issues/Issue+IssueType.swift +++ b/Classes/Issues/Issue+IssueType.swift @@ -103,6 +103,7 @@ extension IssueOrPullRequestQuery.Data.Repository.IssueOrPullRequest.AsIssue: Is type: .removed, repoOwner: owner, repoName: repo, + contentSizeCategory: contentSizeCategory, width: width ) results.append(model) @@ -117,6 +118,7 @@ extension IssueOrPullRequestQuery.Data.Repository.IssueOrPullRequest.AsIssue: Is type: .added, repoOwner: owner, repoName: repo, + contentSizeCategory: contentSizeCategory, width: width ) results.append(model) diff --git a/Classes/Issues/IssueCommentModelHandling.swift b/Classes/Issues/IssueCommentModelHandling.swift index eef97d6a..704cda39 100644 --- a/Classes/Issues/IssueCommentModelHandling.swift +++ b/Classes/Issues/IssueCommentModelHandling.swift @@ -57,7 +57,6 @@ func ExtraCommentCellConfigure( htmlNavigationDelegate: IssueCommentHtmlCellNavigationDelegate?, htmlImageDelegate: IssueCommentHtmlCellImageDelegate?, attributedDelegate: AttributedStringViewDelegate?, - extrasAttributedDelegate: AttributedStringViewExtrasDelegate?, imageHeightDelegate: IssueCommentImageHeightCellDelegate ) { if let cell = cell as? IssueCommentImageCell { @@ -69,7 +68,6 @@ func ExtraCommentCellConfigure( cell.imageDelegate = htmlImageDelegate } else if let cell = cell as? IssueCommentTextCell { cell.textView.delegate = attributedDelegate - cell.textView.extrasDelegate = extrasAttributedDelegate } else if let cell = cell as? IssueCommentQuoteCell { cell.textView.delegate = attributedDelegate } else if let cell = cell as? IssueCommentTableCell { diff --git a/Classes/Issues/Labeled/IssueLabeledCell.swift b/Classes/Issues/Labeled/IssueLabeledCell.swift index c00318ec..f240101d 100644 --- a/Classes/Issues/Labeled/IssueLabeledCell.swift +++ b/Classes/Issues/Labeled/IssueLabeledCell.swift @@ -9,7 +9,7 @@ import UIKit import SnapKit -final class IssueLabeledCell: AttributedStringCell { +final class IssueLabeledCell: StyledTextViewCell { static let insets = UIEdgeInsets( top: Styles.Sizes.inlineSpacing, @@ -21,7 +21,7 @@ final class IssueLabeledCell: AttributedStringCell { // MARK: Public API func configure(_ model: IssueLabeledModel) { - set(attributedText: model.attributedString) + set(renderer: model.string) } } diff --git a/Classes/Issues/Labeled/IssueLabeledModel.swift b/Classes/Issues/Labeled/IssueLabeledModel.swift index dff74a96..a9e81634 100644 --- a/Classes/Issues/Labeled/IssueLabeledModel.swift +++ b/Classes/Issues/Labeled/IssueLabeledModel.swift @@ -8,6 +8,7 @@ import Foundation import IGListKit +import StyledText final class IssueLabeledModel: ListDiffable { @@ -22,7 +23,7 @@ final class IssueLabeledModel: ListDiffable { let color: String let date: Date let type: EventType - let attributedString: NSAttributedStringSizing + let string: StyledTextRenderer init( id: String, @@ -33,6 +34,7 @@ final class IssueLabeledModel: ListDiffable { type: EventType, repoOwner: String, repoName: String, + contentSizeCategory: UIContentSizeCategory, width: CGFloat ) { self.id = id @@ -41,57 +43,44 @@ final class IssueLabeledModel: ListDiffable { self.color = color self.date = date self.type = type - - let attributedString = NSMutableAttributedString( - string: actor, - attributes: [ - .foregroundColor: Styles.Colors.Gray.dark.color, - .font: Styles.Text.secondaryBold.preferredFont, - MarkdownAttribute.username: actor - ] - ) + let labelColor = color.color let actionString: String switch type { case .added: actionString = NSLocalizedString(" added ", comment: "") case .removed: actionString = NSLocalizedString(" removed ", comment: "") } - attributedString.append(NSAttributedString( - string: actionString, - attributes: [ - .foregroundColor: Styles.Colors.Gray.medium.color, - .font: Styles.Text.secondary.preferredFont - ] - )) - let labelColor = color.color - attributedString.append(NSAttributedString( - string: title, - attributes: [ - .font: Styles.Text.smallTitle.preferredFont, + let builder = StyledTextBuilder(styledText: StyledText( + text: "", + style: Styles.Text.secondary.with(foreground: Styles.Colors.Gray.medium.color) + )) + .save() + .add(styledText: StyledText(text: actor, style: Styles.Text.secondaryBold.with(attributes: [ + MarkdownAttribute.username: actor, + .foregroundColor: Styles.Colors.Gray.dark.color + ]) + )) + .restore() + .add(text: actionString) + .save() + .add(styledText: StyledText(text: title, style: Styles.Text.smallTitle.with(attributes: [ .backgroundColor: labelColor, .foregroundColor: labelColor.textOverlayColor ?? .black, .baselineOffset: 1, // offset for better rounded background colors MarkdownAttribute.label: LabelDetails(owner: repoOwner, repo: repoName, label: title) - ] - )) + ] + ))) + .restore() + .add(text: " \(date.agoString)", attributes: [MarkdownAttribute.details: DateDetailsFormatter().string(from: date)]) - attributedString.append(NSAttributedString( - string: " \(date.agoString)", - attributes: [ - .font: Styles.Text.secondary.preferredFont, - .foregroundColor: Styles.Colors.Gray.medium.color, - MarkdownAttribute.details: DateDetailsFormatter().string(from: date) - ] - )) - - self.attributedString = NSAttributedStringSizing( - containerWidth: width, - attributedText: attributedString, + self.string = StyledTextRenderer( + string: builder.build(), + contentSizeCategory: contentSizeCategory, inset: IssueLabeledCell.insets, - backgroundColor: Styles.Colors.Gray.lighter.color + backgroundColor: Styles.Colors.Gray.lighter.color, + layoutManager: LabelLayoutManager() ) - } // MARK: ListDiffable diff --git a/Classes/Issues/Labeled/IssueLabeledSectionController.swift b/Classes/Issues/Labeled/IssueLabeledSectionController.swift index e3d3b88a..92e20181 100644 --- a/Classes/Issues/Labeled/IssueLabeledSectionController.swift +++ b/Classes/Issues/Labeled/IssueLabeledSectionController.swift @@ -20,7 +20,7 @@ final class IssueLabeledSectionController: ListGenericSectionController CGSize { guard let width = collectionContext?.insetContainerSize.width else { fatalError("Collection context must be set") } - return CGSize(width: width, height: object?.attributedString.textViewSize(width).height ?? 0) + return CGSize(width: width, height: object?.string.viewSize(width: width).height ?? 0) } override func cellForItem(at index: Int) -> UICollectionViewCell { diff --git a/Classes/Issues/Preview/IssuePreviewSectionController.swift b/Classes/Issues/Preview/IssuePreviewSectionController.swift index 8c97b3e3..db3cb173 100644 --- a/Classes/Issues/Preview/IssuePreviewSectionController.swift +++ b/Classes/Issues/Preview/IssuePreviewSectionController.swift @@ -66,7 +66,6 @@ ListBindingSectionControllerDataSource { htmlNavigationDelegate: nil, htmlImageDelegate: nil, attributedDelegate: nil, - extrasAttributedDelegate: nil, imageHeightDelegate: imageCache ) diff --git a/Classes/Issues/PullRequest+IssueType.swift b/Classes/Issues/PullRequest+IssueType.swift index a79768f0..0bd3ee07 100644 --- a/Classes/Issues/PullRequest+IssueType.swift +++ b/Classes/Issues/PullRequest+IssueType.swift @@ -127,6 +127,7 @@ extension IssueOrPullRequestQuery.Data.Repository.IssueOrPullRequest.AsPullReque type: .removed, repoOwner: owner, repoName: repo, + contentSizeCategory: contentSizeCategory, width: width ) results.append(model) @@ -141,6 +142,7 @@ extension IssueOrPullRequestQuery.Data.Repository.IssueOrPullRequest.AsPullReque type: .added, repoOwner: owner, repoName: repo, + contentSizeCategory: contentSizeCategory, width: width ) results.append(model) diff --git a/Classes/Issues/Review/IssueReviewSectionController.swift b/Classes/Issues/Review/IssueReviewSectionController.swift index 3178874f..81dbb89e 100644 --- a/Classes/Issues/Review/IssueReviewSectionController.swift +++ b/Classes/Issues/Review/IssueReviewSectionController.swift @@ -12,7 +12,7 @@ import IGListKit final class IssueReviewSectionController: ListBindingSectionController, ListBindingSectionControllerDataSource, IssueReviewDetailsCellDelegate, -AttributedStringViewExtrasDelegate, +AttributedStringViewDelegate, IssueReviewViewCommentsCellDelegate { private lazy var webviewCache: WebviewCellHeightCache = { @@ -113,8 +113,7 @@ IssueReviewViewCommentsCellDelegate { htmlDelegate: webviewCache, htmlNavigationDelegate: viewController, htmlImageDelegate: photoHandler, - attributedDelegate: viewController, - extrasAttributedDelegate: self, + attributedDelegate: self, imageHeightDelegate: imageCache ) @@ -134,13 +133,15 @@ IssueReviewViewCommentsCellDelegate { // MARK: AttributedStringViewIssueDelegate - func didTapIssue(view: AttributedStringView, issue: IssueDetailsModel) { - let controller = IssuesViewController(client: client, model: issue) - viewController?.show(controller, sender: nil) - } - - func didTapCheckbox(view: AttributedStringView, checkbox: MarkdownCheckboxModel) { - + func didTap(view: AttributedStringView, attribute: DetectedMarkdownAttribute) { + if viewController?.handle(attribute: attribute) == true { + return + } + switch attribute { + case .issue(let issue): + viewController?.show(IssuesViewController(client: client, model: issue), sender: nil) + default: break + } } // MARK: IssueReviewViewCommentsCellDelegate diff --git a/Classes/Repository/RepositoryReadmeSectionController.swift b/Classes/Repository/RepositoryReadmeSectionController.swift index 12f5e479..301f583f 100644 --- a/Classes/Repository/RepositoryReadmeSectionController.swift +++ b/Classes/Repository/RepositoryReadmeSectionController.swift @@ -69,7 +69,6 @@ ListBindingSectionControllerDataSource { htmlNavigationDelegate: viewController, htmlImageDelegate: photoHandler, attributedDelegate: viewController, - extrasAttributedDelegate: nil, imageHeightDelegate: imageCache ) diff --git a/Classes/Utility/UIViewController+Routing.swift b/Classes/Utility/UIViewController+Routing.swift new file mode 100644 index 00000000..cc69b0a6 --- /dev/null +++ b/Classes/Utility/UIViewController+Routing.swift @@ -0,0 +1,29 @@ +// +// UIViewController+Routing.swift +// Freetime +// +// Created by Ryan Nystrom on 3/17/18. +// Copyright © 2018 Ryan Nystrom. All rights reserved. +// + +import UIKit + +extension UIViewController { + + @discardableResult + func handle(attribute: DetectedMarkdownAttribute) -> Bool { + switch attribute { + case .url(let url): presentSafari(url: url) + case .email(let email): + if let url = URL(string: "mailTo:\(email)") { + UIApplication.shared.open(url, options: [:], completionHandler: nil) + } + case .username(let username): presentProfile(login: username) + case .label(let label): presentLabels(owner: label.owner, repo: label.repo, label: label.label) + case .commit(let commit): presentCommit(owner: commit.owner, repo: commit.repo, hash: commit.hash) + default: return false + } + return true + } + +} diff --git a/Classes/View Controllers/UIViewController+AttributedStringViewDelegate.swift b/Classes/View Controllers/UIViewController+AttributedStringViewDelegate.swift index 04f7578d..9736a6d8 100644 --- a/Classes/View Controllers/UIViewController+AttributedStringViewDelegate.swift +++ b/Classes/View Controllers/UIViewController+AttributedStringViewDelegate.swift @@ -10,25 +10,8 @@ import UIKit extension UIViewController: AttributedStringViewDelegate { - func didTapURL(view: AttributedStringView, url: URL) { - presentSafari(url: url) - } - - func didTapUsername(view: AttributedStringView, username: String) { - presentProfile(login: username) - } - - func didTapEmail(view: AttributedStringView, email: String) { - guard let url = URL(string: "mailTo:\(email)") else { return } - UIApplication.shared.open(url, options: [:], completionHandler: nil) - } - - func didTapLabel(view: AttributedStringView, label: LabelDetails) { - presentLabels(owner: label.owner, repo: label.repo, label: label.label) - } - - func didTapCommit(view: AttributedStringView, commit: CommitDetails) { - presentCommit(owner: commit.owner, repo: commit.repo, hash: commit.hash) + func didTap(view: AttributedStringView, attribute: DetectedMarkdownAttribute) { + handle(attribute: attribute) } } diff --git a/Classes/View Controllers/UIViewController+StyledTextViewCellDelegate.swift b/Classes/View Controllers/UIViewController+StyledTextViewCellDelegate.swift new file mode 100644 index 00000000..c15e8a63 --- /dev/null +++ b/Classes/View Controllers/UIViewController+StyledTextViewCellDelegate.swift @@ -0,0 +1,17 @@ +// +// UIViewController+StyledTextViewCellDelegate.swift +// Freetime +// +// Created by Ryan Nystrom on 3/18/18. +// Copyright © 2018 Ryan Nystrom. All rights reserved. +// + +import UIKit + +extension UIViewController: StyledTextViewCellDelegate { + + func didTap(cell: StyledTextViewCell, attribute: DetectedMarkdownAttribute) { + handle(attribute: attribute) + } + +} diff --git a/Classes/Views/AttributedStringView.swift b/Classes/Views/AttributedStringView.swift index 8bf3eef5..9d114cc5 100644 --- a/Classes/Views/AttributedStringView.swift +++ b/Classes/Views/AttributedStringView.swift @@ -9,22 +9,12 @@ import UIKit protocol AttributedStringViewDelegate: class { - func didTapURL(view: AttributedStringView, url: URL) - func didTapUsername(view: AttributedStringView, username: String) - func didTapEmail(view: AttributedStringView, email: String) - func didTapCommit(view: AttributedStringView, commit: CommitDetails) - func didTapLabel(view: AttributedStringView, label: LabelDetails) -} - -protocol AttributedStringViewExtrasDelegate: class { - func didTapIssue(view: AttributedStringView, issue: IssueDetailsModel) - func didTapCheckbox(view: AttributedStringView, checkbox: MarkdownCheckboxModel) + func didTap(view: AttributedStringView, attribute: DetectedMarkdownAttribute) } final class AttributedStringView: UIView { weak var delegate: AttributedStringViewDelegate? - weak var extrasDelegate: AttributedStringViewExtrasDelegate? private var text: NSAttributedStringSizing? private var tapGesture: UITapGestureRecognizer? @@ -101,22 +91,7 @@ final class AttributedStringView: UIView { @objc func onTap(recognizer: UITapGestureRecognizer) { guard let detected = DetectMarkdownAttribute(attributes: text?.attributes(point: recognizer.location(in: self))) else { return } - switch detected { - case .url(let url): - delegate?.didTapURL(view: self, url: url) - case .username(let username): - delegate?.didTapUsername(view: self, username: username) - case .email(let email): - delegate?.didTapEmail(view: self, email: email) - case .issue(let issue): - extrasDelegate?.didTapIssue(view: self, issue: issue) - case .label(let label): - delegate?.didTapLabel(view: self, label: label) - case .commit(let commit): - delegate?.didTapCommit(view: self, commit: commit) - case .checkbox(let checkbox): - extrasDelegate?.didTapCheckbox(view: self, checkbox: checkbox) - } + delegate?.didTap(view: self, attribute: detected) } @objc func onLong(recognizer: UILongPressGestureRecognizer) { @@ -129,16 +104,4 @@ final class AttributedStringView: UIView { } } - @objc func showDetailsInMenu(details: String, point: CGPoint) { - becomeFirstResponder() - let menu = UIMenuController.shared - menu.menuItems = [ - UIMenuItem(title: details, action: #selector(AttributedStringView.empty)) - ] - menu.setTargetRect(CGRect(origin: point, size: CGSize(width: 1, height: 1)), in: self) - menu.setMenuVisible(true, animated: trueUnlessReduceMotionEnabled) - } - - @objc func empty() {} - } diff --git a/Classes/Views/StyledTextViewCell.swift b/Classes/Views/StyledTextViewCell.swift new file mode 100644 index 00000000..b3ec31f8 --- /dev/null +++ b/Classes/Views/StyledTextViewCell.swift @@ -0,0 +1,68 @@ +// +// StyledTextViewCell.swift +// Freetime +// +// Created by Ryan Nystrom on 3/17/18. +// Copyright © 2018 Ryan Nystrom. All rights reserved. +// + +import UIKit +import StyledText + +protocol StyledTextViewCellDelegate: class { + func didTap(cell: StyledTextViewCell, attribute: DetectedMarkdownAttribute) +} + +class StyledTextViewCell: UICollectionViewCell, StyledTextViewDelegate { + + weak var delegate: StyledTextViewCellDelegate? + + private let textView = StyledTextView() + + override init(frame: CGRect) { + super.init(frame: frame) + textView.delegate = self + textView.gesturableAttributes = MarkdownAttribute.all + contentView.addSubview(textView) + isAccessibilityElement = true + } + + required init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + override func layoutSubviews() { + super.layoutSubviews() + layoutContentViewForSafeAreaInsets() + textView.reposition(width: contentView.bounds.width) + } + + override var accessibilityLabel: String? { + get { return AccessibilityHelper.generatedLabel(forCell: self)} + set {} + } + + override var canBecomeFirstResponder: Bool { + return true + } + + // MARK: Public API + + final func set(renderer: StyledTextRenderer) { + textView.configure(renderer: renderer, width: contentView.bounds.width) + } + + // MARK: StyledTextViewDelegate + + func didTap(view: StyledTextView, attributes: [NSAttributedStringKey: Any], point: CGPoint) { + guard let detected = DetectMarkdownAttribute(attributes: attributes) else { return } + delegate?.didTap(cell: self, attribute: detected) + } + + func didLongPress(view: StyledTextView, attributes: [NSAttributedStringKey: Any], point: CGPoint) { + if let details = attributes[MarkdownAttribute.details] as? String { + showDetailsInMenu(details: details, point: point) + } + } + +} diff --git a/Classes/Views/Styles.swift b/Classes/Views/Styles.swift index e62c9d1e..3544e4e5 100644 --- a/Classes/Views/Styles.swift +++ b/Classes/Views/Styles.swift @@ -133,6 +133,14 @@ extension TextStyle { return self.font(contentSizeCategory: UIApplication.shared.preferredContentSizeCategory) } + func with(attributes: [NSAttributedStringKey: Any]) -> TextStyle { + var newAttributes = self.attributes + for (key, value) in attributes { + newAttributes[key] = value + } + return TextStyle(font: font, size: size, attributes: newAttributes, minSize: minSize, maxSize: maxSize) + } + func with(foreground: UIColor? = nil, background: UIColor? = nil) -> TextStyle { var attributes = self.attributes attributes[.foregroundColor] = foreground ?? attributes[.foregroundColor] diff --git a/Classes/Views/UIView+DateDetails.swift b/Classes/Views/UIView+DateDetails.swift new file mode 100644 index 00000000..04a4d3ab --- /dev/null +++ b/Classes/Views/UIView+DateDetails.swift @@ -0,0 +1,25 @@ +// +// UIView+DateDetails.swift +// Freetime +// +// Created by Ryan Nystrom on 3/17/18. +// Copyright © 2018 Ryan Nystrom. All rights reserved. +// + +import UIKit + +extension UIView { + + @objc func showDetailsInMenu(details: String, point: CGPoint) { + becomeFirstResponder() + let menu = UIMenuController.shared + menu.menuItems = [ + UIMenuItem(title: details, action: #selector(UIView.__empty)) + ] + menu.setTargetRect(CGRect(origin: point, size: CGSize(width: 1, height: 1)), in: self) + menu.setMenuVisible(true, animated: trueUnlessReduceMotionEnabled) + } + + @objc private func __empty() {} + +} diff --git a/Freetime.xcodeproj/project.pbxproj b/Freetime.xcodeproj/project.pbxproj index 37673c5d..bf243d64 100644 --- a/Freetime.xcodeproj/project.pbxproj +++ b/Freetime.xcodeproj/project.pbxproj @@ -62,7 +62,6 @@ 292CD3D01F0DBB5C00D3D57B /* WebviewCellHeightCache.swift in Sources */ = {isa = PBXBuildFile; fileRef = 292CD3CF1F0DBB5C00D3D57B /* WebviewCellHeightCache.swift */; }; 292CD3D21F0DBEC000D3D57B /* UIViewController+Safari.swift in Sources */ = {isa = PBXBuildFile; fileRef = 292CD3D11F0DBEC000D3D57B /* UIViewController+Safari.swift */; }; 292CD3D41F0DC12100D3D57B /* PhotoViewHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 292CD3D31F0DC12100D3D57B /* PhotoViewHandler.swift */; }; - 292CD3D61F0DC4DA00D3D57B /* UIViewController+AttributedStringViewDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 292CD3D51F0DC4DA00D3D57B /* UIViewController+AttributedStringViewDelegate.swift */; }; 292CD3D81F0DC52900D3D57B /* UIViewController+IssueCommentHtmlCellNavigationDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 292CD3D71F0DC52900D3D57B /* UIViewController+IssueCommentHtmlCellNavigationDelegate.swift */; }; 292EB08D1F1FF58D0046865D /* IssueMilestoneEventModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 292EB08C1F1FF58D0046865D /* IssueMilestoneEventModel.swift */; }; 292EB08F1F1FF5EC0046865D /* IssueMilestoneEventCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 292EB08E1F1FF5EC0046865D /* IssueMilestoneEventCell.swift */; }; @@ -253,6 +252,11 @@ 299E86491EFD9DBB00E5FE70 /* FlexController.m in Sources */ = {isa = PBXBuildFile; fileRef = 299E86481EFD9DBB00E5FE70 /* FlexController.m */; }; 299F4A89204CEDDC004BA4F0 /* Client+AccessToken.swift in Sources */ = {isa = PBXBuildFile; fileRef = 299F4A88204CEDDC004BA4F0 /* Client+AccessToken.swift */; }; 299F63D4205DA24A0015D901 /* MarkdownAttributeHandling.swift in Sources */ = {isa = PBXBuildFile; fileRef = 299F63D3205DA24A0015D901 /* MarkdownAttributeHandling.swift */; }; + 299F63DA205DD86E0015D901 /* StyledTextViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 299F63D9205DD86E0015D901 /* StyledTextViewCell.swift */; }; + 299F63DE205DDCF40015D901 /* UIViewController+AttributedStringViewDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 299F63DD205DDCF40015D901 /* UIViewController+AttributedStringViewDelegate.swift */; }; + 299F63E0205DDF6B0015D901 /* UIViewController+Routing.swift in Sources */ = {isa = PBXBuildFile; fileRef = 299F63DF205DDF6B0015D901 /* UIViewController+Routing.swift */; }; + 299F63E2205DE1470015D901 /* UIView+DateDetails.swift in Sources */ = {isa = PBXBuildFile; fileRef = 299F63E1205DE1470015D901 /* UIView+DateDetails.swift */; }; + 299F63E4205E1CAB0015D901 /* UIViewController+StyledTextViewCellDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 299F63E3205E1CAB0015D901 /* UIViewController+StyledTextViewCellDelegate.swift */; }; 29A08FBD1F12EF7C00C5368E /* IssueReferencedCommitCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29A08FBA1F12EF7C00C5368E /* IssueReferencedCommitCell.swift */; }; 29A08FBE1F12EF7C00C5368E /* IssueReferencedCommitModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29A08FBB1F12EF7C00C5368E /* IssueReferencedCommitModel.swift */; }; 29A08FBF1F12EF7C00C5368E /* IssueReferencedCommitSectionController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29A08FBC1F12EF7C00C5368E /* IssueReferencedCommitSectionController.swift */; }; @@ -489,7 +493,6 @@ 292CD3CF1F0DBB5C00D3D57B /* WebviewCellHeightCache.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebviewCellHeightCache.swift; sourceTree = ""; }; 292CD3D11F0DBEC000D3D57B /* UIViewController+Safari.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIViewController+Safari.swift"; sourceTree = ""; }; 292CD3D31F0DC12100D3D57B /* PhotoViewHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhotoViewHandler.swift; sourceTree = ""; }; - 292CD3D51F0DC4DA00D3D57B /* UIViewController+AttributedStringViewDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIViewController+AttributedStringViewDelegate.swift"; sourceTree = ""; }; 292CD3D71F0DC52900D3D57B /* UIViewController+IssueCommentHtmlCellNavigationDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIViewController+IssueCommentHtmlCellNavigationDelegate.swift"; sourceTree = ""; }; 292EB08C1F1FF58D0046865D /* IssueMilestoneEventModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IssueMilestoneEventModel.swift; sourceTree = ""; }; 292EB08E1F1FF5EC0046865D /* IssueMilestoneEventCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IssueMilestoneEventCell.swift; sourceTree = ""; }; @@ -683,6 +686,11 @@ 299E86481EFD9DBB00E5FE70 /* FlexController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FlexController.m; sourceTree = ""; }; 299F4A88204CEDDC004BA4F0 /* Client+AccessToken.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Client+AccessToken.swift"; sourceTree = ""; }; 299F63D3205DA24A0015D901 /* MarkdownAttributeHandling.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MarkdownAttributeHandling.swift; sourceTree = ""; }; + 299F63D9205DD86E0015D901 /* StyledTextViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StyledTextViewCell.swift; sourceTree = ""; }; + 299F63DD205DDCF40015D901 /* UIViewController+AttributedStringViewDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIViewController+AttributedStringViewDelegate.swift"; sourceTree = ""; }; + 299F63DF205DDF6B0015D901 /* UIViewController+Routing.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIViewController+Routing.swift"; sourceTree = ""; }; + 299F63E1205DE1470015D901 /* UIView+DateDetails.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIView+DateDetails.swift"; sourceTree = ""; }; + 299F63E3205E1CAB0015D901 /* UIViewController+StyledTextViewCellDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIViewController+StyledTextViewCellDelegate.swift"; sourceTree = ""; }; 29A08FBA1F12EF7C00C5368E /* IssueReferencedCommitCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IssueReferencedCommitCell.swift; sourceTree = ""; }; 29A08FBB1F12EF7C00C5368E /* IssueReferencedCommitModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IssueReferencedCommitModel.swift; sourceTree = ""; }; 29A08FBC1F12EF7C00C5368E /* IssueReferencedCommitSectionController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IssueReferencedCommitSectionController.swift; sourceTree = ""; }; @@ -1440,22 +1448,23 @@ 29316DBE1ECC95DB007CAE3F /* RootViewControllers.swift */, 29C33FDA1F127DBB00EC8D40 /* SplitPlaceholderViewController.swift */, 29AC90E41F00A7C8000B80E4 /* SplitViewControllerDelegate.swift */, + 65A315282044369D0074E3B6 /* TabBarController.swift */, 294B111F1F7B07DD00E04F2D /* TabBarControllerDelegate.swift */, 294B111D1F7B07BB00E04F2D /* TabNavRootViewControllerType.swift */, 29D548CA1FA27FE900F8E46F /* UINavigationItem+TitleSubtitle.swift */, + D8D876F71FB6083200A57E2B /* UIPopoverPresentationController+SourceView.swift */, 297AE8691EC0D5C200B44A1F /* UIViewController+Alerts.swift */, - 292CD3D51F0DC4DA00D3D57B /* UIViewController+AttributedStringViewDelegate.swift */, + 299F63DD205DDCF40015D901 /* UIViewController+AttributedStringViewDelegate.swift */, 29AF1E851F8AADD00008A0EF /* UIViewController+CancelAction.swift */, 29CEA5CE1F84DCB3009827DB /* UIViewController+EmptyBackBar.swift */, + 29136BE2200AAA5A007317BE /* UIViewController+FilePathTitle.swift */, 292CD3D71F0DC52900D3D57B /* UIViewController+IssueCommentHtmlCellNavigationDelegate.swift */, 297AE86A1EC0D5C200B44A1F /* UIViewController+LoadingIndicator.swift */, + 29792B181FFB10A3007A0C57 /* UIViewController+MessageAutocompleteControllerLayoutDelegate.swift */, 292CD3D11F0DBEC000D3D57B /* UIViewController+Safari.swift */, + 299F63E3205E1CAB0015D901 /* UIViewController+StyledTextViewCellDelegate.swift */, 290D2A3C1F044CB20082E6CC /* UIViewController+SmartDeselection.swift */, 4920F1A71F72E27200131E9D /* UIViewController+UserActivity.swift */, - D8D876F71FB6083200A57E2B /* UIPopoverPresentationController+SourceView.swift */, - 29792B181FFB10A3007A0C57 /* UIViewController+MessageAutocompleteControllerLayoutDelegate.swift */, - 29136BE2200AAA5A007317BE /* UIViewController+FilePathTitle.swift */, - 65A315282044369D0074E3B6 /* TabBarController.swift */, ); path = "View Controllers"; sourceTree = ""; @@ -1496,6 +1505,7 @@ 2971722C1F069E96005E43AC /* SpinnerCell.swift */, 29A08FC01F12F08100C5368E /* String+HashDisplay.swift */, 291929621F3FF0DA0012067B /* StyledTableCell.swift */, + 299F63D9205DD86E0015D901 /* StyledTextViewCell.swift */, 29C9FDE01EC667AE00EE3A52 /* Styles.swift */, 29AF1E891F8AB1C30008A0EF /* TextActionsController.swift */, D8D876F91FB6084F00A57E2B /* UIBarButtonItem+TightSpacing.swift */, @@ -1512,6 +1522,7 @@ 29AF1E831F8AAB4A0008A0EF /* UITextView+GitHawk.swift */, 292FF8B11F302FE7009E63F7 /* UITextView+SelectedRange.swift */, 298BA08E1EC90FEE00B01946 /* UIView+BottomBorder.swift */, + 299F63E1205DE1470015D901 /* UIView+DateDetails.swift */, ); path = Views; sourceTree = ""; @@ -1796,6 +1807,7 @@ 98835BCD1F1965E2005BA24F /* UIDevice+Model.swift */, 98B5A0851F6D0FFE000617D6 /* UINavigationController+Replace.swift */, 49FE18FC204B5D32001681E8 /* Sequence+Contains.swift */, + 299F63DF205DDF6B0015D901 /* UIViewController+Routing.swift */, ); path = Utility; sourceTree = ""; @@ -2290,6 +2302,7 @@ 299997302031227E00995FFD /* IssueMergeButtonModel.swift in Sources */, 2939718B1F904D2A002FAC4B /* Toast+GitHawk.swift in Sources */, 29CEA5CD1F84DB1B009827DB /* BaseListViewController.swift in Sources */, + 299F63E0205DDF6B0015D901 /* UIViewController+Routing.swift in Sources */, 98835BD41F1A17EE005BA24F /* Bundle+Version.swift in Sources */, 29316DB51ECC7DEB007CAE3F /* ButtonCell.swift in Sources */, 295F52AD1EF1BE83000B53CF /* CommentModelsFromMarkdown.swift in Sources */, @@ -2316,6 +2329,7 @@ 29C167741ECA0DBB00439D62 /* GithubAPIDateFormatter.swift in Sources */, 294434E11FB1F2DA00050C06 /* BookmarkNavigationController.swift in Sources */, 29EE44461F19D5C100B05ED3 /* GithubClient+Issues.swift in Sources */, + 299F63E4205E1CAB0015D901 /* UIViewController+StyledTextViewCellDelegate.swift in Sources */, 29B94E6D1FCB472400715D7E /* IssueFileChangesModel.swift in Sources */, 986B87191F2B875800AAB55C /* GithubClient+Search.swift in Sources */, 29C0E7071ECBC6C50051D756 /* GithubClient.swift in Sources */, @@ -2411,6 +2425,7 @@ DCA5ED141FAEE8030072F074 /* Bookmark.swift in Sources */, 299F4A89204CEDDC004BA4F0 /* Client+AccessToken.swift in Sources */, 2931892F1F539C0E00EF0911 /* IssueMilestoneSectionController.swift in Sources */, + 299F63E2205DE1470015D901 /* UIView+DateDetails.swift in Sources */, 9870B9031FC73EE70009719C /* Secrets.swift in Sources */, 29F7F0611F2A83AA00F6075D /* IssueNeckLoadCell.swift in Sources */, 29A5AF451F9298360065D529 /* GitHubClient+Repository.swift in Sources */, @@ -2515,6 +2530,7 @@ 298003401F51E93B00BE90F4 /* RatingCell.swift in Sources */, 2980033C1F51E82400BE90F4 /* RatingController.swift in Sources */, 29B94E671FCB2D4600715D7E /* CodeView.swift in Sources */, + 299F63DE205DDCF40015D901 /* UIViewController+AttributedStringViewDelegate.swift in Sources */, 29136BDB200A626D007317BE /* FixedRefreshControl.swift in Sources */, 2980033E1F51E93500BE90F4 /* RatingSectionController.swift in Sources */, 29FF85A51EE1EA7A007B8762 /* ReactionContent+ReactionType.swift in Sources */, @@ -2631,7 +2647,6 @@ 292FF8B21F302FE7009E63F7 /* UITextView+SelectedRange.swift in Sources */, 298BA08F1EC90FEE00B01946 /* UIView+BottomBorder.swift in Sources */, 297AE87F1EC0D5C200B44A1F /* UIViewController+Alerts.swift in Sources */, - 292CD3D61F0DC4DA00D3D57B /* UIViewController+AttributedStringViewDelegate.swift in Sources */, D8D876FA1FB6084F00A57E2B /* UIBarButtonItem+TightSpacing.swift in Sources */, 29CEA5CF1F84DCB3009827DB /* UIViewController+EmptyBackBar.swift in Sources */, 292CD3D81F0DC52900D3D57B /* UIViewController+IssueCommentHtmlCellNavigationDelegate.swift in Sources */, @@ -2643,6 +2658,7 @@ 2982ED7A1F94EA8F00DBF8EB /* UICollectionViewCell+SafeAreaContentView.swift in Sources */, 290744BE1F268F8700FD9E48 /* UserAutocomplete+GraphQL.swift in Sources */, 290744BC1F268D8300FD9E48 /* UserAutocomplete.swift in Sources */, + 299F63DA205DD86E0015D901 /* StyledTextViewCell.swift in Sources */, 292CD3D01F0DBB5C00D3D57B /* WebviewCellHeightCache.swift in Sources */, 29EE443F1F19B2D300B05ED3 /* WriteButton.swift in Sources */, ); diff --git a/Podfile.lock b/Podfile.lock index 4207002a..93066e59 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -155,7 +155,7 @@ CHECKOUT OPTIONS: :commit: 97d03799f2b2745c903b6063d65adeec8f4f710d :git: https://github.com/GitHawkApp/MMMarkdown.git StyledText: - :commit: fbc274b1dfe18134791ac285f300cb4dc848672e + :commit: dbd498a2f452622b72820f20153f74b786acb19d :git: https://github.com/GitHawkApp/StyledText.git SPEC CHECKSUMS: diff --git a/Pods/Manifest.lock b/Pods/Manifest.lock index 4207002a..93066e59 100644 --- a/Pods/Manifest.lock +++ b/Pods/Manifest.lock @@ -155,7 +155,7 @@ CHECKOUT OPTIONS: :commit: 97d03799f2b2745c903b6063d65adeec8f4f710d :git: https://github.com/GitHawkApp/MMMarkdown.git StyledText: - :commit: fbc274b1dfe18134791ac285f300cb4dc848672e + :commit: dbd498a2f452622b72820f20153f74b786acb19d :git: https://github.com/GitHawkApp/StyledText.git SPEC CHECKSUMS: diff --git a/Pods/StyledText/StyledText/StyledTextBuilder.swift b/Pods/StyledText/StyledText/StyledTextBuilder.swift index 4d57918f..f0c04151 100644 --- a/Pods/StyledText/StyledText/StyledTextBuilder.swift +++ b/Pods/StyledText/StyledText/StyledTextBuilder.swift @@ -93,7 +93,13 @@ public final class StyledTextBuilder: Hashable, Equatable { return add( styledText: StyledText( text: text, - style: nextStyle + style: TextStyle( + font: tip.style.font, + size: tip.style.size, + attributes: nextAttributes, + minSize: tip.style.minSize, + maxSize: tip.style.maxSize + ) ) ) } @@ -129,4 +135,3 @@ public final class StyledTextBuilder: Hashable, Equatable { } } -