Extract code for creating rounded background view into a new class

pull/254/head
Hwee-Boon Yar 7 years ago
parent f4d76c8d7f
commit 234761c034
  1. 4
      Trust.xcodeproj/project.pbxproj
  2. 13
      Trust/Market/ViewControllers/ImportTicketViewController.swift
  3. 13
      Trust/Redeem/ViewControllers/RedeemTicketsQuantitySelectionViewController.swift
  4. 13
      Trust/Redeem/ViewControllers/RedeemTicketsViewController.swift
  5. 13
      Trust/Sell/ViewControllers/EnterSellTicketsPriceQuantityViewController.swift
  6. 13
      Trust/Sell/ViewControllers/SellTicketsViewController.swift
  7. 13
      Trust/Sell/ViewControllers/SetSellTicketsExpiryDateViewController.swift
  8. 13
      Trust/Tokens/ViewControllers/TicketsViewController.swift
  9. 13
      Trust/Transfer/ViewControllers/ChooseTicketTransferModeViewController.swift
  10. 15
      Trust/Transfer/ViewControllers/RequestViewController.swift
  11. 14
      Trust/Transfer/ViewControllers/SendViewController.swift
  12. 13
      Trust/Transfer/ViewControllers/SetTransferTicketsExpiryDateViewController.swift
  13. 13
      Trust/Transfer/ViewControllers/TransferTicketsQuantitySelectionViewController.swift
  14. 13
      Trust/Transfer/ViewControllers/TransferTicketsViaWalletAddressViewController.swift
  15. 13
      Trust/Transfer/ViewControllers/TransferTicketsViewController.swift
  16. 26
      Trust/UI/RoundedBackground.swift

@ -339,6 +339,7 @@
5E7C78407F6DCB0EDD562DF6 /* TicketTokenViewCellViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C731B6F01534683227123 /* TicketTokenViewCellViewModel.swift */; };
5E7C786AD8E4877C36D3B14A /* TicketAdaptorTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C775FD95FE80B0F1CEA33 /* TicketAdaptorTest.swift */; };
5E7C78B3FD5CA87E395E1861 /* OnboardingPageStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C7AF9A592D7224ED58016 /* OnboardingPageStyle.swift */; };
5E7C78F1D29280E3FF4EAF5E /* RoundedBackground.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C75918317E13AD540DCA7 /* RoundedBackground.swift */; };
5E7C797BE2C8DB7EF6F217B3 /* OnboardingPage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C7103135DCCCAB96EE5FC /* OnboardingPage.swift */; };
5E7C798E5F5EE00D405B91AE /* TicketRowView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C7ACB94CEE493AC37487F /* TicketRowView.swift */; };
5E7C79F30A324D75DF42DDDE /* SellTicketsViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C7EB14E787BC019660389 /* SellTicketsViewModel.swift */; };
@ -831,6 +832,7 @@
5E7C754C0E2E57F32A61F9A3 /* SetTransferTicketsExpiryDateViewControllerViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SetTransferTicketsExpiryDateViewControllerViewModel.swift; sourceTree = "<group>"; };
5E7C755132D9B6F95080A1BE /* TransferTicketsCoordinator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TransferTicketsCoordinator.swift; sourceTree = "<group>"; };
5E7C7564AF453BAB0BDAAA57 /* SettingsAction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SettingsAction.swift; sourceTree = "<group>"; };
5E7C75918317E13AD540DCA7 /* RoundedBackground.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RoundedBackground.swift; sourceTree = "<group>"; };
5E7C75CC640BAFFE0E789F44 /* WalletFilterViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WalletFilterViewModel.swift; sourceTree = "<group>"; };
5E7C75CE3F1D6B7993E7A840 /* OnboardingCollectionViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OnboardingCollectionViewController.swift; sourceTree = "<group>"; };
5E7C75F877B2F2E24C7EF258 /* TicketTableViewCellViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TicketTableViewCellViewModel.swift; sourceTree = "<group>"; };
@ -1309,6 +1311,7 @@
298542E21FBA722F00CB5081 /* ContainerView.swift */,
29DF40091FD3E80A000077CA /* TabBarController.swift */,
442FC575B6A4A50B0555E1B0 /* NumberStepper.swift */,
5E7C75918317E13AD540DCA7 /* RoundedBackground.swift */,
);
path = UI;
sourceTree = "<group>";
@ -3631,6 +3634,7 @@
5E7C7CCC8D376C6E5C245715 /* EthCurrencyHelper.swift in Sources */,
5E7C77A8425E0AFAB11F1FCD /* PromptBackupCoordinator.swift in Sources */,
5E7C7317533D24B6A292F88D /* UIStackView+Array.swift in Sources */,
5E7C78F1D29280E3FF4EAF5E /* RoundedBackground.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

@ -10,8 +10,7 @@ protocol ImportTicketViewControllerDelegate: class {
class ImportTicketViewController: UIViewController {
weak var delegate: ImportTicketViewControllerDelegate?
//roundedBackground is used to achieve the top 2 rounded corners-only effect since maskedCorners to not round bottom corners is not available in iOS 10
let roundedBackground = UIView()
let roundedBackground = RoundedBackground()
let header = TicketsViewControllerTitleHeader()
let ticketView = TicketRowView()
let statusLabel = UILabel()
@ -41,8 +40,6 @@ class ImportTicketViewController: UIViewController {
activityIndicator.hidesWhenStopped = true
roundedBackground.translatesAutoresizingMaskIntoConstraints = false
roundedBackground.backgroundColor = Colors.appWhite
roundedBackground.cornerRadius = 20
view.addSubview(roundedBackground)
ethCostLabelLabel.translatesAutoresizingMaskIntoConstraints = false
@ -92,7 +89,6 @@ class ImportTicketViewController: UIViewController {
stackView.translatesAutoresizingMaskIntoConstraints = false
roundedBackground.addSubview(stackView)
let marginToHideBottomRoundedCorners = CGFloat(30)
let footerBar = UIView()
footerBar.translatesAutoresizingMaskIntoConstraints = false
footerBar.backgroundColor = Colors.appHighlightGreen
@ -141,12 +137,7 @@ class ImportTicketViewController: UIViewController {
stackView.leadingAnchor.constraint(equalTo: roundedBackground.leadingAnchor),
stackView.trailingAnchor.constraint(equalTo: roundedBackground.trailingAnchor),
stackView.topAnchor.constraint(equalTo: roundedBackground.topAnchor),
roundedBackground.leadingAnchor.constraint(equalTo: view.leadingAnchor),
roundedBackground.trailingAnchor.constraint(equalTo: view.trailingAnchor),
roundedBackground.topAnchor.constraint(equalTo: view.topAnchor),
roundedBackground.bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: marginToHideBottomRoundedCorners),
])
] + roundedBackground.createConstraintsWithContainer(view: view))
}
required init?(coder aDecoder: NSCoder) {

@ -15,8 +15,7 @@ protocol RedeemTicketsQuantitySelectionViewControllerDelegate: class {
class RedeemTicketsQuantitySelectionViewController: UIViewController {
//roundedBackground is used to achieve the top 2 rounded corners-only effect since maskedCorners to not round bottom corners is not available in iOS 10
let roundedBackground = UIView()
let roundedBackground = RoundedBackground()
let header = TicketsViewControllerTitleHeader()
let subtitleLabel = UILabel()
var quantityStepper = NumberStepper()
@ -31,8 +30,6 @@ class RedeemTicketsQuantitySelectionViewController: UIViewController {
navigationItem.rightBarButtonItem = UIBarButtonItem(image: R.image.location(), style: .plain, target: self, action: #selector(showInfo))
roundedBackground.translatesAutoresizingMaskIntoConstraints = false
roundedBackground.backgroundColor = Colors.appWhite
roundedBackground.cornerRadius = 20
view.addSubview(roundedBackground)
subtitleLabel.translatesAutoresizingMaskIntoConstraints = false
@ -62,7 +59,6 @@ class RedeemTicketsQuantitySelectionViewController: UIViewController {
let buttonsStackView = [nextButton].asStackView(distribution: .fillEqually, contentHuggingPriority: .required)
buttonsStackView.translatesAutoresizingMaskIntoConstraints = false
let marginToHideBottomRoundedCorners = CGFloat(30)
let footerBar = UIView()
footerBar.translatesAutoresizingMaskIntoConstraints = false
footerBar.backgroundColor = Colors.appHighlightGreen
@ -79,11 +75,6 @@ class RedeemTicketsQuantitySelectionViewController: UIViewController {
ticketView.leadingAnchor.constraint(equalTo: view.leadingAnchor),
ticketView.trailingAnchor.constraint(equalTo: view.trailingAnchor),
roundedBackground.leadingAnchor.constraint(equalTo: view.leadingAnchor),
roundedBackground.trailingAnchor.constraint(equalTo: view.trailingAnchor),
roundedBackground.topAnchor.constraint(equalTo: view.topAnchor),
roundedBackground.bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: marginToHideBottomRoundedCorners),
stackView.leadingAnchor.constraint(equalTo: roundedBackground.leadingAnchor),
stackView.trailingAnchor.constraint(equalTo: roundedBackground.trailingAnchor),
stackView.topAnchor.constraint(equalTo: roundedBackground.topAnchor),
@ -97,7 +88,7 @@ class RedeemTicketsQuantitySelectionViewController: UIViewController {
footerBar.trailingAnchor.constraint(equalTo: view.trailingAnchor),
footerBar.heightAnchor.constraint(equalToConstant: buttonsHeight),
footerBar.bottomAnchor.constraint(equalTo: view.bottomAnchor),
])
] + roundedBackground.createConstraintsWithContainer(view: view))
}
required init?(coder aDecoder: NSCoder) {

@ -15,8 +15,7 @@ protocol RedeemTicketsViewControllerDelegate: class {
class RedeemTicketsViewController: UIViewController {
//roundedBackground is used to achieve the top 2 rounded corners-only effect since maskedCorners to not round bottom corners is not available in iOS 10
let roundedBackground = UIView()
let roundedBackground = RoundedBackground()
let header = TicketsViewControllerTitleHeader()
let tableView = UITableView(frame: .zero, style: .plain)
let nextButton = UIButton(type: .system)
@ -31,8 +30,6 @@ class RedeemTicketsViewController: UIViewController {
view.backgroundColor = Colors.appBackground
roundedBackground.translatesAutoresizingMaskIntoConstraints = false
roundedBackground.backgroundColor = Colors.appWhite
roundedBackground.cornerRadius = 20
view.addSubview(roundedBackground)
tableView.register(TicketTableViewCellWithCheckbox.self, forCellReuseIdentifier: TicketTableViewCellWithCheckbox.identifier)
@ -49,7 +46,6 @@ class RedeemTicketsViewController: UIViewController {
let buttonsStackView = [nextButton].asStackView(distribution: .fillEqually, contentHuggingPriority: .required)
buttonsStackView.translatesAutoresizingMaskIntoConstraints = false
let marginToHideBottomRoundedCorners = CGFloat(30)
let footerBar = UIView()
footerBar.translatesAutoresizingMaskIntoConstraints = false
footerBar.backgroundColor = Colors.appHighlightGreen
@ -59,11 +55,6 @@ class RedeemTicketsViewController: UIViewController {
footerBar.addSubview(buttonsStackView)
NSLayoutConstraint.activate([
roundedBackground.leadingAnchor.constraint(equalTo: view.leadingAnchor),
roundedBackground.trailingAnchor.constraint(equalTo: view.trailingAnchor),
roundedBackground.topAnchor.constraint(equalTo: view.topAnchor),
roundedBackground.bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: marginToHideBottomRoundedCorners),
tableView.leadingAnchor.constraint(equalTo: roundedBackground.leadingAnchor),
tableView.trailingAnchor.constraint(equalTo: roundedBackground.trailingAnchor),
tableView.topAnchor.constraint(equalTo: roundedBackground.topAnchor),
@ -78,7 +69,7 @@ class RedeemTicketsViewController: UIViewController {
footerBar.trailingAnchor.constraint(equalTo: view.trailingAnchor),
footerBar.heightAnchor.constraint(equalToConstant: buttonsHeight),
footerBar.bottomAnchor.constraint(equalTo: view.bottomAnchor),
])
] + roundedBackground.createConstraintsWithContainer(view: view))
}
required init?(coder aDecoder: NSCoder) {

@ -10,8 +10,7 @@ protocol EnterSellTicketsPriceQuantityViewControllerDelegate: class {
class EnterSellTicketsPriceQuantityViewController: UIViewController {
let storage: TokensDataStore
//roundedBackground is used to achieve the top 2 rounded corners-only effect since maskedCorners to not round bottom corners is not available in iOS 10
let roundedBackground = UIView()
let roundedBackground = RoundedBackground()
let scrollView = UIScrollView()
let header = TicketsViewControllerTitleHeader()
let pricePerTicketLabel = UILabel()
@ -53,8 +52,6 @@ class EnterSellTicketsPriceQuantityViewController: UIViewController {
navigationItem.rightBarButtonItem = UIBarButtonItem(image: R.image.location(), style: .plain, target: self, action: #selector(showInfo))
roundedBackground.translatesAutoresizingMaskIntoConstraints = false
roundedBackground.backgroundColor = Colors.appWhite
roundedBackground.cornerRadius = 20
view.addSubview(roundedBackground)
scrollView.translatesAutoresizingMaskIntoConstraints = false
@ -138,7 +135,6 @@ class EnterSellTicketsPriceQuantityViewController: UIViewController {
let buttonsStackView = [nextButton].asStackView(distribution: .fillEqually, contentHuggingPriority: .required)
buttonsStackView.translatesAutoresizingMaskIntoConstraints = false
let marginToHideBottomRoundedCorners = CGFloat(30)
let footerBar = UIView()
footerBar.translatesAutoresizingMaskIntoConstraints = false
footerBar.backgroundColor = Colors.appHighlightGreen
@ -160,11 +156,6 @@ class EnterSellTicketsPriceQuantityViewController: UIViewController {
ticketView.leadingAnchor.constraint(equalTo: view.leadingAnchor),
ticketView.trailingAnchor.constraint(equalTo: view.trailingAnchor),
roundedBackground.leadingAnchor.constraint(equalTo: view.leadingAnchor),
roundedBackground.trailingAnchor.constraint(equalTo: view.trailingAnchor),
roundedBackground.topAnchor.constraint(equalTo: view.topAnchor),
roundedBackground.bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: marginToHideBottomRoundedCorners),
separator1.heightAnchor.constraint(equalToConstant: 1),
separator1.leadingAnchor.constraint(equalTo: ticketView.background.leadingAnchor),
separator1.trailingAnchor.constraint(equalTo: ticketView.background.trailingAnchor),
@ -198,7 +189,7 @@ class EnterSellTicketsPriceQuantityViewController: UIViewController {
pricePerTicketField.widthAnchor.constraint(equalTo: quantityStepper.widthAnchor),
pricePerTicketField.heightAnchor.constraint(equalTo: quantityStepper.heightAnchor),
])
] + roundedBackground.createConstraintsWithContainer(view: view))
}
required init?(coder aDecoder: NSCoder) {

@ -9,8 +9,7 @@ protocol SellTicketsViewControllerDelegate: class {
class SellTicketsViewController: UIViewController {
//roundedBackground is used to achieve the top 2 rounded corners-only effect since maskedCorners to not round bottom corners is not available in iOS 10
let roundedBackground = UIView()
let roundedBackground = RoundedBackground()
let header = TicketsViewControllerTitleHeader()
let tableView = UITableView(frame: .zero, style: .plain)
let nextButton = UIButton(type: .system)
@ -27,8 +26,6 @@ class SellTicketsViewController: UIViewController {
view.backgroundColor = Colors.appBackground
roundedBackground.translatesAutoresizingMaskIntoConstraints = false
roundedBackground.backgroundColor = Colors.appWhite
roundedBackground.cornerRadius = 20
view.addSubview(roundedBackground)
tableView.register(TicketTableViewCellWithCheckbox.self, forCellReuseIdentifier: TicketTableViewCellWithCheckbox.identifier)
@ -45,7 +42,6 @@ class SellTicketsViewController: UIViewController {
let buttonsStackView = [nextButton].asStackView(distribution: .fillEqually, contentHuggingPriority: .required)
buttonsStackView.translatesAutoresizingMaskIntoConstraints = false
let marginToHideBottomRoundedCorners = CGFloat(30)
let footerBar = UIView()
footerBar.translatesAutoresizingMaskIntoConstraints = false
footerBar.backgroundColor = Colors.appHighlightGreen
@ -55,11 +51,6 @@ class SellTicketsViewController: UIViewController {
footerBar.addSubview(buttonsStackView)
NSLayoutConstraint.activate([
roundedBackground.leadingAnchor.constraint(equalTo: view.leadingAnchor),
roundedBackground.trailingAnchor.constraint(equalTo: view.trailingAnchor),
roundedBackground.topAnchor.constraint(equalTo: view.topAnchor),
roundedBackground.bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: marginToHideBottomRoundedCorners),
tableView.leadingAnchor.constraint(equalTo: roundedBackground.leadingAnchor),
tableView.trailingAnchor.constraint(equalTo: roundedBackground.trailingAnchor),
tableView.topAnchor.constraint(equalTo: roundedBackground.topAnchor),
@ -74,7 +65,7 @@ class SellTicketsViewController: UIViewController {
footerBar.trailingAnchor.constraint(equalTo: view.trailingAnchor),
footerBar.heightAnchor.constraint(equalToConstant: buttonsHeight),
footerBar.bottomAnchor.constraint(equalTo: view.bottomAnchor),
])
] + roundedBackground.createConstraintsWithContainer(view: view))
}
required init?(coder aDecoder: NSCoder) {

@ -10,8 +10,7 @@ protocol SetSellTicketsExpiryDateViewControllerDelegate: class {
class SetSellTicketsExpiryDateViewController: UIViewController {
let storage: TokensDataStore
//roundedBackground is used to achieve the top 2 rounded corners-only effect since maskedCorners to not round bottom corners is not available in iOS 10
let roundedBackground = UIView()
let roundedBackground = RoundedBackground()
let scrollView = UIScrollView()
let header = TicketsViewControllerTitleHeader()
let linkExpiryDateLabel = UILabel()
@ -47,8 +46,6 @@ class SetSellTicketsExpiryDateViewController: UIViewController {
navigationItem.rightBarButtonItem = UIBarButtonItem(image: R.image.location(), style: .plain, target: self, action: #selector(showInfo))
roundedBackground.translatesAutoresizingMaskIntoConstraints = false
roundedBackground.backgroundColor = Colors.appWhite
roundedBackground.cornerRadius = 20
view.addSubview(roundedBackground)
scrollView.translatesAutoresizingMaskIntoConstraints = false
@ -136,7 +133,6 @@ class SetSellTicketsExpiryDateViewController: UIViewController {
let buttonsStackView = [nextButton].asStackView(distribution: .fillEqually, contentHuggingPriority: .required)
buttonsStackView.translatesAutoresizingMaskIntoConstraints = false
let marginToHideBottomRoundedCorners = CGFloat(30)
let footerBar = UIView()
footerBar.translatesAutoresizingMaskIntoConstraints = false
footerBar.backgroundColor = Colors.appHighlightGreen
@ -154,11 +150,6 @@ class SetSellTicketsExpiryDateViewController: UIViewController {
ticketView.leadingAnchor.constraint(equalTo: view.leadingAnchor),
ticketView.trailingAnchor.constraint(equalTo: view.trailingAnchor),
roundedBackground.leadingAnchor.constraint(equalTo: view.leadingAnchor),
roundedBackground.trailingAnchor.constraint(equalTo: view.trailingAnchor),
roundedBackground.topAnchor.constraint(equalTo: view.topAnchor),
roundedBackground.bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: marginToHideBottomRoundedCorners),
linkExpiryDateField.leadingAnchor.constraint(equalTo: ticketView.background.leadingAnchor),
linkExpiryTimeField.rightAnchor.constraint(equalTo: ticketView.background.rightAnchor),
linkExpiryDateField.heightAnchor.constraint(equalToConstant: 50),
@ -198,7 +189,7 @@ class SetSellTicketsExpiryDateViewController: UIViewController {
scrollView.trailingAnchor.constraint(equalTo: view.trailingAnchor),
scrollView.topAnchor.constraint(equalTo: view.topAnchor),
scrollView.bottomAnchor.constraint(equalTo: footerBar.topAnchor),
])
] + roundedBackground.createConstraintsWithContainer(view: view))
}
required init?(coder aDecoder: NSCoder) {

@ -29,8 +29,7 @@ class TicketsViewController: UIViewController {
var session: WalletSession!
weak var delegate: TicketsViewControllerDelegate?
let header = TicketsViewControllerHeader()
//roundedBackground is used to achieve the top 2 rounded corners-only effect since maskedCorners to not round bottom corners is not available in iOS 10
let roundedBackground = UIView()
let roundedBackground = RoundedBackground()
let tableView = UITableView(frame: .zero, style: .plain)
let redeemButton = UIButton(type: .system)
@ -45,8 +44,6 @@ class TicketsViewController: UIViewController {
view.backgroundColor = Colors.appBackground
roundedBackground.translatesAutoresizingMaskIntoConstraints = false
roundedBackground.backgroundColor = Colors.appWhite
roundedBackground.cornerRadius = 20
view.addSubview(roundedBackground)
tableView.register(TicketTableViewCellWithoutCheckbox.self, forCellReuseIdentifier: TicketTableViewCellWithoutCheckbox.identifier)
@ -69,7 +66,6 @@ class TicketsViewController: UIViewController {
let buttonsStackView = [redeemButton, sellButton, transferButton].asStackView(distribution: .fillEqually, contentHuggingPriority: .required)
buttonsStackView.translatesAutoresizingMaskIntoConstraints = false
let marginToHideBottomRoundedCorners = CGFloat(30)
let footerBar = UIView()
footerBar.translatesAutoresizingMaskIntoConstraints = false
footerBar.backgroundColor = Colors.appHighlightGreen
@ -90,11 +86,6 @@ class TicketsViewController: UIViewController {
let separatorThickness = CGFloat(1)
NSLayoutConstraint.activate([
roundedBackground.leadingAnchor.constraint(equalTo: view.leadingAnchor),
roundedBackground.trailingAnchor.constraint(equalTo: view.trailingAnchor),
roundedBackground.topAnchor.constraint(equalTo: view.topAnchor),
roundedBackground.bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: marginToHideBottomRoundedCorners),
tableView.leadingAnchor.constraint(equalTo: roundedBackground.leadingAnchor),
tableView.trailingAnchor.constraint(equalTo: roundedBackground.trailingAnchor),
tableView.topAnchor.constraint(equalTo: roundedBackground.topAnchor),
@ -119,7 +110,7 @@ class TicketsViewController: UIViewController {
footerBar.trailingAnchor.constraint(equalTo: view.trailingAnchor),
footerBar.heightAnchor.constraint(equalToConstant: buttonsHeight),
footerBar.bottomAnchor.constraint(equalTo: view.bottomAnchor),
])
] + roundedBackground.createConstraintsWithContainer(view: view))
}
required init?(coder aDecoder: NSCoder) {

@ -11,8 +11,7 @@ protocol ChooseTicketTransferModeViewControllerDelegate: class {
class ChooseTicketTransferModeViewController: UIViewController {
let horizontalAdjustmentForLongMagicLinkButtonTitle = CGFloat(20)
//roundedBackground is used to achieve the top 2 rounded corners-only effect since maskedCorners to not round bottom corners is not available in iOS 10
let roundedBackground = UIView()
let roundedBackground = RoundedBackground()
let header = TicketsViewControllerTitleHeader()
let ticketView = TicketRowView()
let generateMagicLinkButton = UIButton(type: .system)
@ -30,8 +29,6 @@ class ChooseTicketTransferModeViewController: UIViewController {
navigationItem.rightBarButtonItem = UIBarButtonItem(image: R.image.location(), style: .plain, target: self, action: #selector(showInfo))
roundedBackground.translatesAutoresizingMaskIntoConstraints = false
roundedBackground.backgroundColor = Colors.appWhite
roundedBackground.cornerRadius = 20
view.addSubview(roundedBackground)
generateMagicLinkButton.setTitle(R.string.localizable.aWalletTicketTokenTransferModeMagicLinkButtonTitle(), for: .normal)
@ -53,7 +50,6 @@ class ChooseTicketTransferModeViewController: UIViewController {
let buttonsStackView = [generateMagicLinkButton, transferNowButton].asStackView(distribution: .fillEqually, contentHuggingPriority: .required)
buttonsStackView.translatesAutoresizingMaskIntoConstraints = false
let marginToHideBottomRoundedCorners = CGFloat(30)
let footerBar = UIView()
footerBar.translatesAutoresizingMaskIntoConstraints = false
footerBar.backgroundColor = Colors.appHighlightGreen
@ -74,11 +70,6 @@ class ChooseTicketTransferModeViewController: UIViewController {
ticketView.leadingAnchor.constraint(equalTo: view.leadingAnchor),
ticketView.trailingAnchor.constraint(equalTo: view.trailingAnchor),
roundedBackground.leadingAnchor.constraint(equalTo: view.leadingAnchor),
roundedBackground.trailingAnchor.constraint(equalTo: view.trailingAnchor),
roundedBackground.topAnchor.constraint(equalTo: view.topAnchor),
roundedBackground.bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: marginToHideBottomRoundedCorners),
stackView.leadingAnchor.constraint(equalTo: roundedBackground.leadingAnchor),
stackView.trailingAnchor.constraint(equalTo: roundedBackground.trailingAnchor),
stackView.topAnchor.constraint(equalTo: roundedBackground.topAnchor),
@ -97,7 +88,7 @@ class ChooseTicketTransferModeViewController: UIViewController {
footerBar.trailingAnchor.constraint(equalTo: view.trailingAnchor),
footerBar.heightAnchor.constraint(equalToConstant: buttonsHeight),
footerBar.bottomAnchor.constraint(equalTo: view.bottomAnchor),
])
] + roundedBackground.createConstraintsWithContainer(view: view))
}
required init?(coder aDecoder: NSCoder) {

@ -9,12 +9,9 @@ import StackViewController
//Careful to fit in shorter phone like iPhone 5s without needing to scroll
class RequestViewController: UIViewController {
//roundedBackground is used to achieve the top 2 rounded corners-only effect since maskedCorners to not round bottom corners is not available in iOS 10
let roundedBackground: UIView = {
let roundedBackground = UIView()
let roundedBackground: RoundedBackground = {
let roundedBackground = RoundedBackground()
roundedBackground.translatesAutoresizingMaskIntoConstraints = false
roundedBackground.backgroundColor = Colors.appWhite
roundedBackground.cornerRadius = 20
return roundedBackground
}()
@ -107,13 +104,7 @@ class RequestViewController: UIViewController {
addressContainerLeadingAnchorConstraint.priority = .defaultLow
let addressContainerTrailingAnchorConstraint = addressContainerView.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: 10)
addressContainerTrailingAnchorConstraint.priority = .defaultLow
let marginToHideBottomRoundedCorners = CGFloat(30)
NSLayoutConstraint.activate([
roundedBackground.leadingAnchor.constraint(equalTo: view.leadingAnchor),
roundedBackground.trailingAnchor.constraint(equalTo: view.trailingAnchor),
roundedBackground.topAnchor.constraint(equalTo: view.topAnchor),
roundedBackground.bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: marginToHideBottomRoundedCorners),
addressContainerLeadingAnchorConstraint,
addressContainerTrailingAnchorConstraint,
@ -126,7 +117,7 @@ class RequestViewController: UIViewController {
imageView.widthAnchor.constraint(equalToConstant: 260),
imageView.heightAnchor.constraint(equalToConstant: 260),
])
] + roundedBackground.createConstraintsWithContainer(view: view))
changeQRCode(value: 0)
}

@ -20,8 +20,7 @@ protocol SendViewControllerDelegate: class {
}
class SendViewController: UIViewController {
//roundedBackground is used to achieve the top 2 rounded corners-only effect since maskedCorners to not round bottom corners is not available in iOS 10
let roundedBackground = UIView()
let roundedBackground = RoundedBackground()
let header = SendHeaderView()
let targetAddressTextField = UITextField()
let amountTextField = UITextField()
@ -101,8 +100,6 @@ class SendViewController: UIViewController {
configureBalanceViewModel()
roundedBackground.translatesAutoresizingMaskIntoConstraints = false
roundedBackground.backgroundColor = Colors.appWhite
roundedBackground.cornerRadius = 20
view.addSubview(roundedBackground)
targetAddressTextField.translatesAutoresizingMaskIntoConstraints = false
@ -156,8 +153,6 @@ class SendViewController: UIViewController {
stackView.translatesAutoresizingMaskIntoConstraints = false
roundedBackground.addSubview(stackView)
let marginToHideBottomRoundedCorners = CGFloat(30)
let footerBar = UIView()
footerBar.translatesAutoresizingMaskIntoConstraints = false
footerBar.backgroundColor = Colors.appHighlightGreen
@ -186,11 +181,6 @@ class SendViewController: UIViewController {
myAddressContainer.leadingAnchor.constraint(equalTo: roundedBackground.leadingAnchor, constant: 30),
myAddressContainer.trailingAnchor.constraint(equalTo: roundedBackground.trailingAnchor, constant: -30),
roundedBackground.leadingAnchor.constraint(equalTo: view.leadingAnchor),
roundedBackground.trailingAnchor.constraint(equalTo: view.trailingAnchor),
roundedBackground.topAnchor.constraint(equalTo: view.topAnchor),
roundedBackground.bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: marginToHideBottomRoundedCorners),
imageView.widthAnchor.constraint(equalTo: myAddressContainerStackView.widthAnchor, multiplier: 0.5, constant: 10),
imageView.widthAnchor.constraint(equalTo: imageView.heightAnchor),
@ -207,7 +197,7 @@ class SendViewController: UIViewController {
footerBar.trailingAnchor.constraint(equalTo: view.trailingAnchor),
footerBar.heightAnchor.constraint(equalToConstant: buttonsHeight),
footerBar.bottomAnchor.constraint(equalTo: view.bottomAnchor),
])
] + roundedBackground.createConstraintsWithContainer(view: view))
storage.updatePrices()
getGasPrice()

@ -9,8 +9,7 @@ protocol SetTransferTicketsExpiryDateViewControllerDelegate: class {
class SetTransferTicketsExpiryDateViewController: UIViewController {
//roundedBackground is used to achieve the top 2 rounded corners-only effect since maskedCorners to not round bottom corners is not available in iOS 10
let roundedBackground = UIView()
let roundedBackground = RoundedBackground()
let scrollView = UIScrollView()
let header = TicketsViewControllerTitleHeader()
let ticketView = TicketRowView()
@ -38,8 +37,6 @@ class SetTransferTicketsExpiryDateViewController: UIViewController {
navigationItem.rightBarButtonItem = UIBarButtonItem(image: R.image.location(), style: .plain, target: self, action: #selector(showInfo))
roundedBackground.translatesAutoresizingMaskIntoConstraints = false
roundedBackground.backgroundColor = Colors.appWhite
roundedBackground.cornerRadius = 20
view.addSubview(roundedBackground)
scrollView.translatesAutoresizingMaskIntoConstraints = false
@ -121,7 +118,6 @@ class SetTransferTicketsExpiryDateViewController: UIViewController {
let buttonsStackView = [nextButton].asStackView(distribution: .fillEqually, contentHuggingPriority: .required)
buttonsStackView.translatesAutoresizingMaskIntoConstraints = false
let marginToHideBottomRoundedCorners = CGFloat(30)
let footerBar = UIView()
footerBar.translatesAutoresizingMaskIntoConstraints = false
footerBar.backgroundColor = Colors.appHighlightGreen
@ -136,11 +132,6 @@ class SetTransferTicketsExpiryDateViewController: UIViewController {
ticketView.leadingAnchor.constraint(equalTo: view.leadingAnchor),
ticketView.trailingAnchor.constraint(equalTo: view.trailingAnchor),
roundedBackground.leadingAnchor.constraint(equalTo: view.leadingAnchor),
roundedBackground.trailingAnchor.constraint(equalTo: view.trailingAnchor),
roundedBackground.topAnchor.constraint(equalTo: view.topAnchor),
roundedBackground.bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: marginToHideBottomRoundedCorners),
linkExpiryDateField.leadingAnchor.constraint(equalTo: ticketView.background.leadingAnchor),
linkExpiryTimeField.rightAnchor.constraint(equalTo: ticketView.background.rightAnchor),
linkExpiryDateField.heightAnchor.constraint(equalToConstant: 50),
@ -180,7 +171,7 @@ class SetTransferTicketsExpiryDateViewController: UIViewController {
scrollView.trailingAnchor.constraint(equalTo: view.trailingAnchor),
scrollView.topAnchor.constraint(equalTo: view.topAnchor),
scrollView.bottomAnchor.constraint(equalTo: footerBar.topAnchor),
])
] + roundedBackground.createConstraintsWithContainer(view: view))
}
required init?(coder aDecoder: NSCoder) {

@ -9,8 +9,7 @@ protocol TransferTicketsQuantitySelectionViewControllerDelegate: class {
class TransferTicketsQuantitySelectionViewController: UIViewController {
//roundedBackground is used to achieve the top 2 rounded corners-only effect since maskedCorners to not round bottom corners is not available in iOS 10
let roundedBackground = UIView()
let roundedBackground = RoundedBackground()
let header = TicketsViewControllerTitleHeader()
let subtitleLabel = UILabel()
var quantityStepper = NumberStepper()
@ -27,8 +26,6 @@ class TransferTicketsQuantitySelectionViewController: UIViewController {
navigationItem.rightBarButtonItem = UIBarButtonItem(image: R.image.location(), style: .plain, target: self, action: #selector(showInfo))
roundedBackground.translatesAutoresizingMaskIntoConstraints = false
roundedBackground.backgroundColor = Colors.appWhite
roundedBackground.cornerRadius = 20
view.addSubview(roundedBackground)
subtitleLabel.translatesAutoresizingMaskIntoConstraints = false
@ -58,7 +55,6 @@ class TransferTicketsQuantitySelectionViewController: UIViewController {
let buttonsStackView = [nextButton].asStackView(distribution: .fillEqually, contentHuggingPriority: .required)
buttonsStackView.translatesAutoresizingMaskIntoConstraints = false
let marginToHideBottomRoundedCorners = CGFloat(30)
let footerBar = UIView()
footerBar.translatesAutoresizingMaskIntoConstraints = false
footerBar.backgroundColor = Colors.appHighlightGreen
@ -75,11 +71,6 @@ class TransferTicketsQuantitySelectionViewController: UIViewController {
ticketView.leadingAnchor.constraint(equalTo: view.leadingAnchor),
ticketView.trailingAnchor.constraint(equalTo: view.trailingAnchor),
roundedBackground.leadingAnchor.constraint(equalTo: view.leadingAnchor),
roundedBackground.trailingAnchor.constraint(equalTo: view.trailingAnchor),
roundedBackground.topAnchor.constraint(equalTo: view.topAnchor),
roundedBackground.bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: marginToHideBottomRoundedCorners),
stackView.leadingAnchor.constraint(equalTo: roundedBackground.leadingAnchor),
stackView.trailingAnchor.constraint(equalTo: roundedBackground.trailingAnchor),
stackView.topAnchor.constraint(equalTo: roundedBackground.topAnchor),
@ -93,7 +84,7 @@ class TransferTicketsQuantitySelectionViewController: UIViewController {
footerBar.trailingAnchor.constraint(equalTo: view.trailingAnchor),
footerBar.heightAnchor.constraint(equalToConstant: buttonsHeight),
footerBar.bottomAnchor.constraint(equalTo: view.bottomAnchor),
])
] + roundedBackground.createConstraintsWithContainer(view: view))
}
required init?(coder aDecoder: NSCoder) {

@ -10,8 +10,7 @@ protocol TransferTicketsViaWalletAddressViewControllerDelegate: class {
class TransferTicketsViaWalletAddressViewController: UIViewController {
//roundedBackground is used to achieve the top 2 rounded corners-only effect since maskedCorners to not round bottom corners is not available in iOS 10
let roundedBackground = UIView()
let roundedBackground = RoundedBackground()
let header = TicketsViewControllerTitleHeader()
let ticketView = TicketRowView()
let targetAddressLabel = UILabel()
@ -30,8 +29,6 @@ class TransferTicketsViaWalletAddressViewController: UIViewController {
navigationItem.rightBarButtonItem = UIBarButtonItem(image: R.image.location(), style: .plain, target: self, action: #selector(showInfo))
roundedBackground.translatesAutoresizingMaskIntoConstraints = false
roundedBackground.backgroundColor = Colors.appWhite
roundedBackground.cornerRadius = 20
view.addSubview(roundedBackground)
targetAddressTextField.translatesAutoresizingMaskIntoConstraints = false
@ -60,7 +57,6 @@ class TransferTicketsViaWalletAddressViewController: UIViewController {
let buttonsStackView = [nextButton].asStackView(distribution: .fillEqually, contentHuggingPriority: .required)
buttonsStackView.translatesAutoresizingMaskIntoConstraints = false
let marginToHideBottomRoundedCorners = CGFloat(30)
let footerBar = UIView()
footerBar.translatesAutoresizingMaskIntoConstraints = false
footerBar.backgroundColor = Colors.appHighlightGreen
@ -79,11 +75,6 @@ class TransferTicketsViaWalletAddressViewController: UIViewController {
targetAddressTextField.trailingAnchor.constraint(equalTo: roundedBackground.trailingAnchor, constant: -30),
targetAddressTextField.heightAnchor.constraint(equalToConstant: ScreenChecker().isNarrowScreen() ? 30 : 50),
roundedBackground.leadingAnchor.constraint(equalTo: view.leadingAnchor),
roundedBackground.trailingAnchor.constraint(equalTo: view.trailingAnchor),
roundedBackground.topAnchor.constraint(equalTo: view.topAnchor),
roundedBackground.bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: marginToHideBottomRoundedCorners),
stackView.leadingAnchor.constraint(equalTo: roundedBackground.leadingAnchor),
stackView.trailingAnchor.constraint(equalTo: roundedBackground.trailingAnchor),
stackView.topAnchor.constraint(equalTo: roundedBackground.topAnchor),
@ -97,7 +88,7 @@ class TransferTicketsViaWalletAddressViewController: UIViewController {
footerBar.trailingAnchor.constraint(equalTo: view.trailingAnchor),
footerBar.heightAnchor.constraint(equalToConstant: buttonsHeight),
footerBar.bottomAnchor.constraint(equalTo: view.bottomAnchor),
])
] + roundedBackground.createConstraintsWithContainer(view: view))
}
required init?(coder aDecoder: NSCoder) {

@ -9,8 +9,7 @@ protocol TransferTicketsViewControllerDelegate: class {
class TransferTicketsViewController: UIViewController {
//roundedBackground is used to achieve the top 2 rounded corners-only effect since maskedCorners to not round bottom corners is not available in iOS 10
let roundedBackground = UIView()
let roundedBackground = RoundedBackground()
let header = TicketsViewControllerTitleHeader()
let tableView = UITableView(frame: .zero, style: .plain)
let nextButton = UIButton(type: .system)
@ -27,8 +26,6 @@ class TransferTicketsViewController: UIViewController {
view.backgroundColor = Colors.appBackground
roundedBackground.translatesAutoresizingMaskIntoConstraints = false
roundedBackground.backgroundColor = Colors.appWhite
roundedBackground.cornerRadius = 20
view.addSubview(roundedBackground)
tableView.register(TicketTableViewCellWithCheckbox.self, forCellReuseIdentifier: TicketTableViewCellWithCheckbox.identifier)
@ -45,7 +42,6 @@ class TransferTicketsViewController: UIViewController {
let buttonsStackView = [nextButton].asStackView(distribution: .fillEqually, contentHuggingPriority: .required)
buttonsStackView.translatesAutoresizingMaskIntoConstraints = false
let marginToHideBottomRoundedCorners = CGFloat(30)
let footerBar = UIView()
footerBar.translatesAutoresizingMaskIntoConstraints = false
footerBar.backgroundColor = Colors.appHighlightGreen
@ -55,11 +51,6 @@ class TransferTicketsViewController: UIViewController {
footerBar.addSubview(buttonsStackView)
NSLayoutConstraint.activate([
roundedBackground.leadingAnchor.constraint(equalTo: view.leadingAnchor),
roundedBackground.trailingAnchor.constraint(equalTo: view.trailingAnchor),
roundedBackground.topAnchor.constraint(equalTo: view.topAnchor),
roundedBackground.bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: marginToHideBottomRoundedCorners),
tableView.leadingAnchor.constraint(equalTo: roundedBackground.leadingAnchor),
tableView.trailingAnchor.constraint(equalTo: roundedBackground.trailingAnchor),
tableView.topAnchor.constraint(equalTo: roundedBackground.topAnchor),
@ -74,7 +65,7 @@ class TransferTicketsViewController: UIViewController {
footerBar.trailingAnchor.constraint(equalTo: view.trailingAnchor),
footerBar.heightAnchor.constraint(equalToConstant: buttonsHeight),
footerBar.bottomAnchor.constraint(equalTo: view.bottomAnchor),
])
] + roundedBackground.createConstraintsWithContainer(view: view))
}
required init?(coder aDecoder: NSCoder) {

@ -0,0 +1,26 @@
// Copyright © 2018 Stormbird PTE. LTD.
import UIKit
///Used to achieve the top 2 rounded corners-only effect since maskedCorners to not round bottom corners is not available in iOS 10
class RoundedBackground: UIView {
override init(frame: CGRect) {
super.init(frame: frame)
backgroundColor = Colors.appWhite
cornerRadius = 20
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func createConstraintsWithContainer(view: UIView) -> [NSLayoutConstraint] {
let marginToHideBottomRoundedCorners = CGFloat(30)
return [
leadingAnchor.constraint(equalTo: view.leadingAnchor),
trailingAnchor.constraint(equalTo: view.trailingAnchor),
topAnchor.constraint(equalTo: view.topAnchor),
bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: marginToHideBottomRoundedCorners),
]
}
}
Loading…
Cancel
Save