Files
SideStore/Sources/SideStoreAppKit/Settings/Error Log/ErrorLogTableViewCell.swift

48 lines
1.6 KiB
Swift
Raw Normal View History

//
// ErrorLogTableViewCell.swift
// AltStore
//
// Created by Riley Testut on 9/9/22.
// Copyright © 2022 Riley Testut. All rights reserved.
//
import UIKit
@objc(ErrorLogTableViewCell)
2023-03-01 00:48:36 -05:00
final class ErrorLogTableViewCell: UITableViewCell {
@IBOutlet var appIconImageView: AppIconImageView!
2023-03-01 00:48:36 -05:00
@IBOutlet var dateLabel: UILabel!
@IBOutlet var errorFailureLabel: UILabel!
@IBOutlet var errorCodeLabel: UILabel!
@IBOutlet var errorDescriptionTextView: CollapsingTextView!
2023-03-01 00:48:36 -05:00
@IBOutlet var menuButton: UIButton!
2023-03-01 00:48:36 -05:00
private var didLayoutSubviews = false
2023-03-01 00:48:36 -05:00
override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
let moreButtonFrame = convert(errorDescriptionTextView.moreButton.frame, from: errorDescriptionTextView)
guard moreButtonFrame.contains(point) else { return super.hitTest(point, with: event) }
2023-03-01 00:48:36 -05:00
// Pass touches through menuButton so user can press moreButton.
2023-03-01 00:48:36 -05:00
return errorDescriptionTextView.moreButton
}
2023-03-01 00:48:36 -05:00
override func layoutSubviews() {
super.layoutSubviews()
2023-03-01 00:48:36 -05:00
didLayoutSubviews = true
}
2023-03-01 00:48:36 -05:00
override func systemLayoutSizeFitting(_ targetSize: CGSize, withHorizontalFittingPriority horizontalFittingPriority: UILayoutPriority, verticalFittingPriority: UILayoutPriority) -> CGSize {
if !didLayoutSubviews {
// Ensure cell is laid out so it will report correct size.
2023-03-01 00:48:36 -05:00
layoutIfNeeded()
}
2023-03-01 00:48:36 -05:00
let size = super.systemLayoutSizeFitting(targetSize, withHorizontalFittingPriority: horizontalFittingPriority, verticalFittingPriority: verticalFittingPriority)
return size
}
}