mirror of
https://github.com/zhigang1992/GitHawk.git
synced 2026-04-26 13:15:06 +08:00
* wip * reply cell shows up in comments * focus on reply model and scroll to reply * api to create PR comment replies * reply working * clean and code reuse * even more reuse * organize
41 lines
1.4 KiB
Swift
41 lines
1.4 KiB
Swift
//
|
|
// PullRequestReviewReplySectionController.swift
|
|
// Freetime
|
|
//
|
|
// Created by Ryan Nystrom on 1/29/18.
|
|
// Copyright © 2018 Ryan Nystrom. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
import IGListKit
|
|
|
|
protocol PullRequestReviewReplySectionControllerDelegate: class {
|
|
func didSelect(replySectionController: PullRequestReviewReplySectionController, reply: PullRequestReviewReplyModel)
|
|
}
|
|
|
|
final class PullRequestReviewReplySectionController: ListGenericSectionController<PullRequestReviewReplyModel> {
|
|
|
|
private weak var delegate: PullRequestReviewReplySectionControllerDelegate?
|
|
|
|
init(delegate: PullRequestReviewReplySectionControllerDelegate) {
|
|
self.delegate = delegate
|
|
}
|
|
|
|
override func sizeForItem(at index: Int) -> CGSize {
|
|
guard let width = collectionContext?.insetContainerSize.width else { return .zero }
|
|
return CGSize(width: width, height: Styles.Sizes.tableCellHeight)
|
|
}
|
|
|
|
override func cellForItem(at index: Int) -> UICollectionViewCell {
|
|
guard let cell = collectionContext?.dequeueReusableCell(of: PullRequestReviewReplyCell.self, for: self, at: index) as? PullRequestReviewReplyCell
|
|
else { fatalError("Missing context or wrong cell") }
|
|
return cell
|
|
}
|
|
|
|
override func didSelectItem(at index: Int) {
|
|
guard let object = self.object else { return }
|
|
delegate?.didSelect(replySectionController: self, reply: object)
|
|
}
|
|
|
|
}
|