warm label event size caches (#1090)

This commit is contained in:
Ryan Nystrom
2017-11-26 12:34:29 -05:00
committed by GitHub
parent a504a87033
commit a45fdb3bd4
5 changed files with 16 additions and 9 deletions

View File

@@ -350,7 +350,8 @@ extension GithubClient {
date: Date(),
type: .added,
repoOwner: owner,
repoName: repo
repoName: repo,
width: 0
))
}
}
@@ -364,7 +365,8 @@ extension GithubClient {
date: Date(),
type: .removed,
repoOwner: owner,
repoName: repo
repoName: repo,
width: 0
))
}
}

View File

@@ -93,7 +93,8 @@ extension IssueOrPullRequestQuery.Data.Repository.IssueOrPullRequest.AsIssue: Is
date: date,
type: .removed,
repoOwner: owner,
repoName: repo
repoName: repo,
width: width
)
results.append(model)
} else if let labeled = node.asLabeledEvent,
@@ -106,7 +107,8 @@ extension IssueOrPullRequestQuery.Data.Repository.IssueOrPullRequest.AsIssue: Is
date: date,
type: .added,
repoOwner: owner,
repoName: repo
repoName: repo,
width: width
)
results.append(model)
} else if let closed = node.asClosedEvent,

View File

@@ -32,7 +32,8 @@ final class IssueLabeledModel: ListDiffable {
date: Date,
type: EventType,
repoOwner: String,
repoName: String
repoName: String,
width: CGFloat
) {
self.id = id
self.actor = actor
@@ -94,7 +95,7 @@ final class IssueLabeledModel: ListDiffable {
// Set
self.attributedString = NSAttributedStringSizing(
containerWidth: 0,
containerWidth: width,
attributedText: attributedString,
inset: IssueLabeledCell.insets,
backgroundColor: Styles.Colors.Gray.lighter.color

View File

@@ -99,7 +99,8 @@ extension IssueOrPullRequestQuery.Data.Repository.IssueOrPullRequest.AsPullReque
date: date,
type: .removed,
repoOwner: owner,
repoName: repo
repoName: repo,
width: width
)
results.append(model)
} else if let labeled = node.asLabeledEvent,
@@ -112,7 +113,8 @@ extension IssueOrPullRequestQuery.Data.Repository.IssueOrPullRequest.AsPullReque
date: date,
type: .added,
repoOwner: owner,
repoName: repo
repoName: repo,
width: width
)
results.append(model)
} else if let closed = node.asClosedEvent,

View File

@@ -50,7 +50,7 @@ final class CodeView: UIScrollView {
func set(attributedCode: NSAttributedString) {
textView.attributedText = attributedCode
let max = CGFloat.greatestFiniteMagnitude
let size = textVi ew.sizeThatFits(CGSize(width: max, height: max))
let size = textView.sizeThatFits(CGSize(width: max, height: max))
textView.frame = CGRect(origin: .zero, size: size)
contentSize = size
}