mirror of
https://github.com/zhigang1992/GitHawk.git
synced 2026-06-16 18:40:08 +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
51 lines
1.4 KiB
Swift
51 lines
1.4 KiB
Swift
//
|
|
// IssueTargetBranchModel.swift
|
|
// Freetime
|
|
//
|
|
// Created by Yury Bogdanov on 13/03/2018.
|
|
// Copyright © 2018 Ryan Nystrom. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
import IGListKit
|
|
import StyledTextKit
|
|
|
|
final class IssueTargetBranchModel: ListDiffable {
|
|
|
|
let targetBranchText: StyledTextRenderer
|
|
|
|
|
|
init(branch: String, width: CGFloat) {
|
|
let builder = StyledTextBuilder(styledText: StyledText(
|
|
style: Styles.Text.secondary.with(foreground: Styles.Colors.Gray.medium.color)
|
|
))
|
|
.save()
|
|
.add(styledText: StyledText(
|
|
text: "Target branch: ")
|
|
)
|
|
.save()
|
|
.add(styledText: StyledText(
|
|
text: branch,
|
|
style: Styles.Text.secondaryCode.with(foreground: Styles.Colors.Gray.dark.color)
|
|
))
|
|
.save()
|
|
|
|
self.targetBranchText = StyledTextRenderer(
|
|
string: builder.build(),
|
|
contentSizeCategory: .small
|
|
).warm(width: width)
|
|
}
|
|
|
|
// MARK: ListDiffable
|
|
|
|
func diffIdentifier() -> NSObjectProtocol {
|
|
return targetBranchText.diffIdentifier()
|
|
}
|
|
|
|
func isEqual(toDiffableObject object: ListDiffable?) -> Bool {
|
|
if self === object { return true }
|
|
guard let object = object as? IssueTargetBranchModel else { return false }
|
|
return targetBranchText.isEqual(toDiffableObject: object)
|
|
}
|
|
}
|