This commit is contained in:
Justin Mazzocchi 2020-10-13 13:11:27 -07:00
parent bd1659af6a
commit 670e2f9af6
No known key found for this signature in database
GPG Key ID: E223E6937AAFB01C
6 changed files with 20 additions and 27 deletions

View File

@ -35,7 +35,7 @@ class AccountHeaderView: UIView {
override init(frame: CGRect) {
super.init(frame: frame)
initializationActions()
initialSetup()
}
@available(*, unavailable)
@ -62,7 +62,7 @@ extension AccountHeaderView: UITextViewDelegate {
}
private extension AccountHeaderView {
func initializationActions() {
func initialSetup() {
let baseStackView = UIStackView()
addSubview(headerImageView)

View File

@ -17,6 +17,7 @@ class AccountView: UIView {
super.init(frame: .zero)
initialSetup()
applyAccountConfiguration()
}
@available(*, unavailable)
@ -93,8 +94,6 @@ private extension AccountView {
stackView.trailingAnchor.constraint(equalTo: readableContentGuide.trailingAnchor),
stackView.bottomAnchor.constraint(equalTo: readableContentGuide.bottomAnchor)
])
applyAccountConfiguration()
}
func applyAccountConfiguration() {

View File

@ -35,19 +35,18 @@ final class CardView: UIView {
override init(frame: CGRect) {
super.init(frame: frame)
initializationActions()
initialSetup()
}
@available(*, unavailable)
required init?(coder: NSCoder) {
super.init(coder: coder)
initializationActions()
fatalError("init(coder:) has not been implemented")
}
}
private extension CardView {
// swiftlint:disable:next function_body_length
func initializationActions() {
func initialSetup() {
backgroundColor = .secondarySystemBackground
layer.cornerRadius = .defaultCornerRadius
clipsToBounds = true

View File

@ -52,18 +52,17 @@ final class StatusAttachmentsView: UIView {
override init(frame: CGRect) {
super.init(frame: frame)
initializationActions()
initialSetup()
}
@available(*, unavailable)
required init?(coder: NSCoder) {
super.init(coder: coder)
initializationActions()
fatalError("init(coder:) has not been implemented")
}
}
private extension StatusAttachmentsView {
func initializationActions() {
func initialSetup() {
backgroundColor = .clear
layoutMargins = .zero
clipsToBounds = true

View File

@ -50,6 +50,7 @@ final class StatusView: UIView {
super.init(frame: .zero)
initialSetup()
applyStatusConfiguration()
}
@available(*, unavailable)
@ -287,8 +288,6 @@ private extension StatusView {
avatarButton.bottomAnchor.constraint(equalTo: avatarImageView.bottomAnchor),
avatarButton.trailingAnchor.constraint(equalTo: avatarImageView.trailingAnchor)
])
applyStatusConfiguration()
}
func applyStatusConfiguration() {

View File

@ -9,12 +9,17 @@ final class TouchFallthroughTextView: UITextView {
override init(frame: CGRect, textContainer: NSTextContainer?) {
super.init(frame: frame, textContainer: textContainer)
initializationActions()
clipsToBounds = false
textDragInteraction?.isEnabled = false
textContainerInset = .zero
self.textContainer.lineFragmentPadding = 0
linkTextAttributes = [.foregroundColor: tintColor as Any, .underlineColor: UIColor.clear]
}
@available(*, unavailable)
required init?(coder: NSCoder) {
super.init(coder: coder)
initializationActions()
fatalError("init(coder:) has not been implemented")
}
override func point(inside point: CGPoint, with event: UIEvent?) -> Bool {
@ -124,14 +129,6 @@ final class TouchFallthroughTextView: UITextView {
private extension TouchFallthroughTextView {
static let linkHighlightViewTransform = CGAffineTransform(scaleX: 1.1, y: 1.1)
func initializationActions() {
clipsToBounds = false
textDragInteraction?.isEnabled = false
textContainerInset = .zero
textContainer.lineFragmentPadding = 0
linkTextAttributes = [.foregroundColor: tintColor as Any, .underlineColor: UIColor.clear]
}
func removeLinkHighlightView() {
UIView.animate(withDuration: .defaultAnimationDuration) {
self.linkHighlightView?.alpha = 0