Skip to content
This repository was archived by the owner on Sep 20, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
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
9 changes: 8 additions & 1 deletion Classes/Issues/Comments/Tables/IssueCommentTableCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,14 @@ UICollectionViewDelegateFlowLayout {

override func layoutSubviews() {
super.layoutSubviews()
collectionView.frame = contentView.bounds
if let model = self.model {
collectionView.frame = CGRect(
x: 0,
y: 0,
width: bounds.width,
height: model.size.height
)
}
}

// MARK: ListBindable
Expand Down
7 changes: 7 additions & 0 deletions Classes/Issues/Comments/Tables/IssueCommentTableModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,17 @@ final class IssueCommentTableModel: NSObject, ListDiffable {

let columns: [Column]
let rowHeights: [CGFloat]
let size: CGSize

init(columns: [Column], rowHeights: [CGFloat]) {
self.columns = columns
self.rowHeights = rowHeights

let inset = IssueCommentTableCell.inset
self.size = CGSize(
width: columns.reduce(0) { $0 + $1.width } + inset.left + inset.right,
height: rowHeights.reduce(0) { $0 + $1 } + inset.top + inset.bottom
)
}

// MARK: ListDiffable
Expand Down
3 changes: 1 addition & 2 deletions Classes/Issues/IssueCommentModelHandling.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ func BodyHeightForComment(
} else if let cache = webviewCache, let viewModel = viewModel as? IssueCommentHtmlModel {
return cache.height(model: viewModel, width: width)
} else if let viewModel = viewModel as? IssueCommentTableModel {
let inset = IssueCommentTableCell.inset
return viewModel.rowHeights.reduce(0) { $0 + $1 } + inset.top + inset.bottom
return viewModel.size.height
} else {
return Styles.Sizes.tableCellHeight
}
Expand Down