From 55263e1e630ba46555576be3b895df2fb7de91ae Mon Sep 17 00:00:00 2001 From: Bug Magnet Date: Thu, 21 Sep 2023 11:17:04 +0200 Subject: [PATCH] Fix the successful redeem as well --- ios/MullvadVPN/UI appearance/UIMetrics.swift | 1 + .../AddCreditSucceededViewController.swift | 15 +++++++-------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ios/MullvadVPN/UI appearance/UIMetrics.swift b/ios/MullvadVPN/UI appearance/UIMetrics.swift index 68b071959a73..9538f14a8669 100644 --- a/ios/MullvadVPN/UI appearance/UIMetrics.swift +++ b/ios/MullvadVPN/UI appearance/UIMetrics.swift @@ -39,6 +39,7 @@ enum UIMetrics { static let cornerRadius = 8.0 static let preferredContentSize = CGSize(width: 280, height: 260) static let contentLayoutMargins = NSDirectionalEdgeInsets(top: 16, leading: 16, bottom: 16, trailing: 16) + static let successfulRedeemMargins = NSDirectionalEdgeInsets(top: 16, leading: 8, bottom: 16, trailing: 8) } enum AccountDeletion { diff --git a/ios/MullvadVPN/View controllers/RedeemVoucher/AddCreditSucceededViewController.swift b/ios/MullvadVPN/View controllers/RedeemVoucher/AddCreditSucceededViewController.swift index 8ddf300f3eef..1176075b93b4 100644 --- a/ios/MullvadVPN/View controllers/RedeemVoucher/AddCreditSucceededViewController.swift +++ b/ios/MullvadVPN/View controllers/RedeemVoucher/AddCreditSucceededViewController.swift @@ -97,19 +97,18 @@ class AddCreditSucceededViewController: UIViewController, RootContainment { override func viewDidLoad() { super.viewDidLoad() - addSubviews() - addConstraints() + configureUI() addDismissButtonHandler() } - private func addSubviews() { - for subview in [statusImageView, titleLabel, messageLabel, dismissButton] { - view.addSubview(subview) + private func configureUI() { + let contentHolderView = UIView(frame: .zero) + + view.addConstrainedSubviews([contentHolderView]) { + contentHolderView.pinEdgesToSuperview(.all(UIMetrics.SettingsRedeemVoucher.successfulRedeemMargins)) } - } - private func addConstraints() { - view.addConstrainedSubviews([statusImageView, titleLabel, messageLabel, dismissButton]) { + contentHolderView.addConstrainedSubviews([statusImageView, titleLabel, messageLabel, dismissButton]) { statusImageView.pinEdgesToSuperviewMargins(PinnableEdges([.top(0)])) statusImageView.centerXAnchor.constraint(equalTo: view.centerXAnchor)