|
|
|
@ -4,8 +4,6 @@ import UIKit |
|
|
|
|
import MessageUI |
|
|
|
|
|
|
|
|
|
enum TicketTransferMode { |
|
|
|
|
case text |
|
|
|
|
case email |
|
|
|
|
case walletAddressTextEntry |
|
|
|
|
case walletAddressFromQRCode |
|
|
|
|
case other |
|
|
|
@ -19,8 +17,6 @@ class ChooseTicketTransferModeViewController: 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 titleLabel = UILabel() |
|
|
|
|
let textButton = TransferModeButton() |
|
|
|
|
let emailButton = TransferModeButton() |
|
|
|
|
let inputWalletAddressButton = TransferModeButton() |
|
|
|
|
let qrCodeScannerButton = TransferModeButton() |
|
|
|
|
let otherButton = TransferModeButton() |
|
|
|
@ -39,16 +35,6 @@ class ChooseTicketTransferModeViewController: UIViewController { |
|
|
|
|
roundedBackground.cornerRadius = 20 |
|
|
|
|
view.addSubview(roundedBackground) |
|
|
|
|
|
|
|
|
|
textButton.callback = { |
|
|
|
|
self.delegate?.didChoose(transferMode: .text, in: self) |
|
|
|
|
} |
|
|
|
|
textButton.translatesAutoresizingMaskIntoConstraints = false |
|
|
|
|
|
|
|
|
|
emailButton.callback = { |
|
|
|
|
self.delegate?.didChoose(transferMode: .email, in: self) |
|
|
|
|
} |
|
|
|
|
emailButton.translatesAutoresizingMaskIntoConstraints = false |
|
|
|
|
|
|
|
|
|
inputWalletAddressButton.callback = { |
|
|
|
|
self.delegate?.didChoose(transferMode: .walletAddressTextEntry, in: self) |
|
|
|
|
} |
|
|
|
@ -65,33 +51,24 @@ class ChooseTicketTransferModeViewController: UIViewController { |
|
|
|
|
otherButton.translatesAutoresizingMaskIntoConstraints = false |
|
|
|
|
|
|
|
|
|
let buttonRow1 = UIStackView(arrangedSubviews: [ |
|
|
|
|
textButton, |
|
|
|
|
emailButton, |
|
|
|
|
inputWalletAddressButton, |
|
|
|
|
qrCodeScannerButton, |
|
|
|
|
]) |
|
|
|
|
buttonRow1.translatesAutoresizingMaskIntoConstraints = false |
|
|
|
|
buttonRow1.axis = .horizontal |
|
|
|
|
buttonRow1.spacing = 12 |
|
|
|
|
buttonRow1.distribution = .fill |
|
|
|
|
|
|
|
|
|
let buttonPlaceholder = UIView() |
|
|
|
|
let buttonRow2 = UIStackView(arrangedSubviews: [ |
|
|
|
|
inputWalletAddressButton, |
|
|
|
|
qrCodeScannerButton, |
|
|
|
|
otherButton, |
|
|
|
|
buttonPlaceholder, |
|
|
|
|
]) |
|
|
|
|
buttonRow2.translatesAutoresizingMaskIntoConstraints = false |
|
|
|
|
buttonRow2.axis = .horizontal |
|
|
|
|
buttonRow2.spacing = 12 |
|
|
|
|
buttonRow2.distribution = .fill |
|
|
|
|
|
|
|
|
|
let buttonPlaceholder = UIView() |
|
|
|
|
let buttonRow3 = UIStackView(arrangedSubviews: [ |
|
|
|
|
otherButton, |
|
|
|
|
buttonPlaceholder, |
|
|
|
|
]) |
|
|
|
|
buttonRow3.translatesAutoresizingMaskIntoConstraints = false |
|
|
|
|
buttonRow3.axis = .horizontal |
|
|
|
|
buttonRow3.spacing = 12 |
|
|
|
|
buttonRow3.distribution = .fill |
|
|
|
|
|
|
|
|
|
let stackView = UIStackView(arrangedSubviews: [ |
|
|
|
|
.spacer(height: 7), |
|
|
|
|
titleLabel, |
|
|
|
@ -99,8 +76,6 @@ class ChooseTicketTransferModeViewController: UIViewController { |
|
|
|
|
buttonRow1, |
|
|
|
|
.spacer(height: 12), |
|
|
|
|
buttonRow2, |
|
|
|
|
.spacer(height: 12), |
|
|
|
|
buttonRow3, |
|
|
|
|
]) |
|
|
|
|
stackView.translatesAutoresizingMaskIntoConstraints = false |
|
|
|
|
stackView.axis = .vertical |
|
|
|
@ -140,12 +115,6 @@ class ChooseTicketTransferModeViewController: UIViewController { |
|
|
|
|
titleLabel.textAlignment = .center |
|
|
|
|
titleLabel.text = viewModel.titleLabelText |
|
|
|
|
|
|
|
|
|
textButton.title = viewModel.textButtonTitle |
|
|
|
|
textButton.image = viewModel.textButtonImage |
|
|
|
|
|
|
|
|
|
emailButton.title = viewModel.emailButtonTitle |
|
|
|
|
emailButton.image = viewModel.emailButtonImage |
|
|
|
|
|
|
|
|
|
inputWalletAddressButton.title = viewModel.inputWalletAddressButtonTitle |
|
|
|
|
inputWalletAddressButton.image = viewModel.inputWalletAddressButtonImage |
|
|
|
|
|
|
|
|
@ -155,14 +124,10 @@ class ChooseTicketTransferModeViewController: UIViewController { |
|
|
|
|
otherButton.title = viewModel.otherButtonTitle |
|
|
|
|
otherButton.image = viewModel.otherButtonImage |
|
|
|
|
|
|
|
|
|
textButton.label.font = viewModel.buttonTitleFont |
|
|
|
|
emailButton.label.font = viewModel.buttonTitleFont |
|
|
|
|
inputWalletAddressButton.label.font = viewModel.buttonTitleFont |
|
|
|
|
qrCodeScannerButton.label.font = viewModel.buttonTitleFont |
|
|
|
|
otherButton.label.font = viewModel.buttonTitleFont |
|
|
|
|
|
|
|
|
|
textButton.label.textColor = viewModel.buttonTitleColor |
|
|
|
|
emailButton.label.textColor = viewModel.buttonTitleColor |
|
|
|
|
inputWalletAddressButton.label.textColor = viewModel.buttonTitleColor |
|
|
|
|
qrCodeScannerButton.label.textColor = viewModel.buttonTitleColor |
|
|
|
|
otherButton.label.textColor = viewModel.buttonTitleColor |
|
|
|
@ -170,8 +135,6 @@ class ChooseTicketTransferModeViewController: UIViewController { |
|
|
|
|
|
|
|
|
|
override func viewDidLayoutSubviews() { |
|
|
|
|
super.viewDidLayoutSubviews() |
|
|
|
|
textButton.layer.cornerRadius = textButton.frame.size.height / 2 |
|
|
|
|
emailButton.layer.cornerRadius = emailButton.frame.size.height / 2 |
|
|
|
|
inputWalletAddressButton.layer.cornerRadius = inputWalletAddressButton.frame.size.height / 2 |
|
|
|
|
qrCodeScannerButton.layer.cornerRadius = qrCodeScannerButton.frame.size.height / 2 |
|
|
|
|
} |
|
|
|
|