Small tweaks plus changelog entry.

Use the new generated localisation strings. Add comments.

Address feedback from PR review.
This commit is contained in:
Doug
2021-09-30 14:14:15 +01:00
parent 997ee54f20
commit 634424d288
10 changed files with 167 additions and 61 deletions
@@ -23,7 +23,9 @@ final class ServiceTermsModalScreenViewController: UIViewController {
// MARK: - Constants
private enum Constants {
/// Reuse identifier for the prototype cell in the storyboard.
static let cellReuseIdentifier = "Service Terms Cell"
static let minimumTableViewHeight: CGFloat = 120
}
// MARK: - Properties
@@ -82,7 +84,7 @@ final class ServiceTermsModalScreenViewController: UIViewController {
override func viewWillLayoutSubviews() {
super.viewWillLayoutSubviews()
tableViewHeightConstraint.constant = max(120, tableView.contentSize.height)
tableViewHeightConstraint.constant = max(Constants.minimumTableViewHeight, tableView.contentSize.height)
}
override var preferredStatusBarStyle: UIStatusBarStyle {
@@ -166,6 +168,7 @@ final class ServiceTermsModalScreenViewController: UIViewController {
self.tableView.register(TableViewCellWithCheckBoxAndLabel.nib(), forCellReuseIdentifier: TableViewCellWithCheckBoxAndLabel.defaultReuseIdentifier())
tableHeaderView = ServiceTermsModalTableHeaderView.instantiate()
tableHeaderView.delegate = self
self.tableView.tableHeaderView = tableHeaderView
}
@@ -274,6 +277,8 @@ extension ServiceTermsModalScreenViewController: UITableViewDataSource {
}
}
// MARK: - UITableViewDelegate
extension ServiceTermsModalScreenViewController: UITableViewDelegate {
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let policy = policies[indexPath.section]
@@ -281,3 +286,25 @@ extension ServiceTermsModalScreenViewController: UITableViewDelegate {
tableView.deselectRow(at: indexPath, animated: true)
}
}
// MARK: - ServiceTermsModalTableHeaderViewDelegate
extension ServiceTermsModalScreenViewController: ServiceTermsModalTableHeaderViewDelegate {
func tableHeaderViewDidTapInformationButton() {
let title: String
let message: String
if viewModel.serviceType == MXServiceTypeIdentityService {
title = VectorL10n.serviceTermsModalInformationTitleIdentityServer
message = VectorL10n.serviceTermsModalInformationDescriptionIdentityServer(AppInfo.current.displayName)
} else {
title = VectorL10n.serviceTermsModalInformationTitleIntegrationManager
message = VectorL10n.serviceTermsModalInformationDescriptionIntegrationManager(AppInfo.current.displayName)
}
let alertController = UIAlertController(title: title, message: message, preferredStyle: .alert)
alertController.addAction(UIAlertAction(title: Bundle.mxk_localizedString(forKey: "ok"), style: .default))
present(alertController, animated: true)
}
}
@@ -17,10 +17,16 @@
import UIKit
import Reusable
protocol ServiceTermsModalTableHeaderViewDelegate: AnyObject {
func tableHeaderViewDidTapInformationButton()
}
class ServiceTermsModalTableHeaderView: UIView, NibLoadable, Themable {
// MARK: - Properties
weak var delegate: ServiceTermsModalTableHeaderViewDelegate?
@IBOutlet weak var titleLabel: UILabel!
@IBOutlet weak var serviceURLLabel: UILabel!
@@ -44,6 +50,7 @@ class ServiceTermsModalTableHeaderView: UIView, NibLoadable, Themable {
// MARK: - Action
@IBAction private func buttonAction(_ sender: Any) {
delegate?.tableHeaderViewDidTapInformationButton()
}
}