Skip to content

Commit

Permalink
pop views on successful submissionupdate contraint margins
Browse files Browse the repository at this point in the history
  • Loading branch information
scottkicks committed Sep 28, 2023
1 parent 62e8c77 commit b38f921
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,6 @@ internal final class ReportProjectCell: UITableViewCell, ValueCell {
_ = self
|> baseTableViewCellStyle()
|> ReportProjectCell.lens.accessibilityTraits .~ accessibilityTraits
|> ReportProjectCell.lens.contentView.layoutMargins %~~ { _, cell in
cell.traitCollection.isRegularRegular
? .init(topBottom: Styles.gridHalf(5), leftRight: Styles.grid(16))
: .init(topBottom: Styles.gridHalf(5), leftRight: Styles.gridHalf(7))
}
}

private func setupReportProjectLabelView(projectFlagged: Bool) {
Expand All @@ -48,14 +43,17 @@ internal final class ReportProjectCell: UITableViewCell, ValueCell {

self.contentView.addSubview(hostingController.view)

let leftRightInset = self.traitCollection.isRegularRegular ? Styles.grid(16) : Styles.gridHalf(5)

NSLayoutConstraint.activate([
hostingController.view.topAnchor.constraint(equalTo: self.contentView.topAnchor, constant: 12),
hostingController.view.topAnchor
.constraint(equalTo: self.contentView.topAnchor, constant: Styles.gridHalf(5)),
hostingController.view.bottomAnchor
.constraint(equalTo: self.contentView.bottomAnchor, constant: -12),
.constraint(equalTo: self.contentView.bottomAnchor, constant: -Styles.gridHalf(5)),
hostingController.view.leadingAnchor
.constraint(equalTo: self.contentView.leadingAnchor, constant: 12),
.constraint(equalTo: self.contentView.leadingAnchor, constant: leftRightInset),
hostingController.view.trailingAnchor
.constraint(equalTo: self.contentView.trailingAnchor, constant: -12)
.constraint(equalTo: self.contentView.trailingAnchor, constant: -leftRightInset)
])
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import SwiftUI
struct ReportProjectLabelView: View {
let flagged: Bool

let isIpad = AppEnvironment.current.device.userInterfaceIdiom == .pad
@SwiftUI.Environment(\.horizontalSizeClass) private var horizontalSizeClass

var body: some View {
if flagged {
Expand All @@ -23,7 +23,7 @@ struct ReportProjectLabelView: View {
.scaledToFit()
.frame(width: 10, height: 10)

Check warning on line 24 in Kickstarter-iOS/Features/ProjectPage/Views/ReportProjectLabelView.swift

View check run for this annotation

Codecov / codecov/patch

Kickstarter-iOS/Features/ProjectPage/Views/ReportProjectLabelView.swift#L21-L24

Added lines #L21 - L24 were not covered by tests
}
.padding(isIpad ? 0 : 10)
.padding(self.horizontalSizeClass == .regular ? 0 : 10)

Check warning on line 26 in Kickstarter-iOS/Features/ProjectPage/Views/ReportProjectLabelView.swift

View check run for this annotation

Codecov / codecov/patch

Kickstarter-iOS/Features/ProjectPage/Views/ReportProjectLabelView.swift#L26

Added line #L26 was not covered by tests
}
}

Expand Down

0 comments on commit b38f921

Please sign in to comment.