mirror of
https://github.com/zhigang1992/GitHawk.git
synced 2026-06-13 09:14:44 +08:00
* clean up title model * update title style * organize issue SC method * remove background colors from styled text in issues * collection view bg white * remove card inset and clean up snap superview code * clean up label design * thread is root and change base font size * remove borders on comment cells * adjust collapse design * adjust comment line spacing and make non-root body smaller * refactor detail view * viewer header background color * more buttons in reaction cell * vertical spacers working * design basically finished; * scroll to bottom accounts for inset * PR review background color white * fixup PR review comments * spacing on merge and review * readme background white * rename to just "spacer" * horizontal spacing * fix tests
50 lines
1.7 KiB
Swift
50 lines
1.7 KiB
Swift
//
|
|
// IssueViewFilesSectionController.swift
|
|
// Freetime
|
|
//
|
|
// Created by Ryan Nystrom on 8/11/17.
|
|
// Copyright © 2017 Ryan Nystrom. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
import IGListKit
|
|
|
|
final class IssueViewFilesSectionController: ListGenericSectionController<IssueFileChangesModel> {
|
|
|
|
private let issueModel: IssueDetailsModel
|
|
private let client: GithubClient
|
|
|
|
init(issueModel: IssueDetailsModel, client: GithubClient) {
|
|
self.issueModel = issueModel
|
|
self.client = client
|
|
super.init()
|
|
inset = UIEdgeInsets(top: 0, left: 0, bottom: Styles.Sizes.rowSpacing / 2, right: 0)
|
|
}
|
|
|
|
override func sizeForItem(at index: Int) -> CGSize {
|
|
guard let width = collectionContext?.insetContainerSize.width else { fatalError("Collection context must be set") }
|
|
return CGSize(
|
|
width: width,
|
|
height: Styles.Text.secondary.preferredFont.lineHeight
|
|
)
|
|
}
|
|
|
|
override func cellForItem(at index: Int) -> UICollectionViewCell {
|
|
guard let cell = collectionContext?.dequeueReusableCell(of: IssueViewFilesCell.self, for: self, at: index) as? IssueViewFilesCell,
|
|
let object = self.object
|
|
else { fatalError("Missing collection context") }
|
|
cell.configure(changes: object.changes)
|
|
return cell
|
|
}
|
|
|
|
override func didSelectItem(at index: Int) {
|
|
guard let object = self.object else { return }
|
|
|
|
collectionContext?.deselectItem(at: index, sectionController: self, animated: trueUnlessReduceMotionEnabled)
|
|
|
|
let controller = IssueFilesViewController(model: issueModel, client: client, fileCount: object.changes.changedFiles)
|
|
viewController?.show(controller, sender: nil)
|
|
}
|
|
|
|
}
|