diff --git a/Sources/Earthquake Network/Controllers/InApp/SubscriptionDetailsViewController.swift b/Sources/Earthquake Network/Controllers/InApp/SubscriptionDetailsViewController.swift index 0aa7965..600a26c 100644 --- a/Sources/Earthquake Network/Controllers/InApp/SubscriptionDetailsViewController.swift +++ b/Sources/Earthquake Network/Controllers/InApp/SubscriptionDetailsViewController.swift @@ -67,6 +67,7 @@ class SubscriptionDetailsViewController: UITableViewController { tableView.estimatedRowHeight = 2000.0 tableView.separatorStyle = .none tableView.backgroundColor = .systemGroupedBackground + tableView.contentInset = EQNBaseContainerTableViewCell.EdgeInsets tableView.registerCell(for: SubscriptionDetailsTableViewCell.self) } diff --git a/Sources/Earthquake Network/Controllers/InApp/SubscriptionsHeaderTableViewCell.swift b/Sources/Earthquake Network/Controllers/InApp/SubscriptionsHeaderTableViewCell.swift index 228a158..cfedf50 100644 --- a/Sources/Earthquake Network/Controllers/InApp/SubscriptionsHeaderTableViewCell.swift +++ b/Sources/Earthquake Network/Controllers/InApp/SubscriptionsHeaderTableViewCell.swift @@ -18,6 +18,7 @@ class SubscriptionsHeaderTableViewCell: UITableViewHeaderFooterView { label.translatesAutoresizingMaskIntoConstraints = false label.font = UIFont.preferredFont(forTextStyle: .title2) label.textColor = AppTheme.Colors.darkGray + label.textAlignment = .center return label }() @@ -48,6 +49,7 @@ class SubscriptionsHeaderTableViewCell: UITableViewHeaderFooterView { headerTitleLabel.centerYAnchor.constraint(equalTo: contentView.centerYAnchor).isActive = true headerTitleLabel.leadingAnchor.constraint(equalTo: contentView.leadingAnchor, constant: .cardPadding).isActive = true + headerTitleLabel.trailingAnchor.constraint(equalTo: contentView.trailingAnchor, constant: .cardPadding.negative).isActive = true loadingActivityIndicator.trailingAnchor.constraint(equalTo: contentView.trailingAnchor, constant: .cardPadding.negative).isActive = true loadingActivityIndicator.centerYAnchor.constraint(equalTo: headerTitleLabel.centerYAnchor).isActive = true } diff --git a/Sources/Earthquake Network/Controllers/InApp/SubscriptionsViewController.swift b/Sources/Earthquake Network/Controllers/InApp/SubscriptionsViewController.swift index cccd202..f64114b 100644 --- a/Sources/Earthquake Network/Controllers/InApp/SubscriptionsViewController.swift +++ b/Sources/Earthquake Network/Controllers/InApp/SubscriptionsViewController.swift @@ -91,6 +91,11 @@ class SubscriptionsViewController: UITableViewController { tableView.estimatedRowHeight = 600.0 tableView.separatorStyle = .none tableView.backgroundColor = .systemGroupedBackground + tableView.contentInset = EQNBaseContainerTableViewCell.EdgeInsets + if #available(iOS 15.0, *) { + // remove extra padding on top of each section header + tableView.sectionHeaderTopPadding = 0.0 + } tableView.registerCell(for: SubscriptionsActiveTableViewCell.self) tableView.registerCell(for: SubscriptionsDescriptionTableViewCell.self) tableView.registerCell(for: SubscriptionProductTableViewCell.self) @@ -190,17 +195,22 @@ class SubscriptionsViewController: UITableViewController { override func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { let tableSection = sections[section] - let view = tableView.dequeueHeaderFooterView(cellIdentifiable: SubscriptionsHeaderTableViewCell.self) - view.update(isLoading: isLoading, title: tableSection.sectionTitle) - return view + switch tableSection.sectionTitle { + case .some(let title): + let view = tableView.dequeueHeaderFooterView(cellIdentifiable: SubscriptionsHeaderTableViewCell.self) + view.update(isLoading: isLoading, title: title) + return view + case .none: + return nil + } } override func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { let tableSection = sections[section] - if tableSection.sectionTitle != nil { - return 50 + return switch tableSection.sectionTitle { + case .some: 50.0 + case .none: 0.0 } - return 0 } override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {