parent
98f8a463b5
commit
0851012d1f
@ -0,0 +1,21 @@ |
||||
{ |
||||
"images" : [ |
||||
{ |
||||
"idiom" : "universal", |
||||
"scale" : "1x" |
||||
}, |
||||
{ |
||||
"idiom" : "universal", |
||||
"scale" : "2x" |
||||
}, |
||||
{ |
||||
"idiom" : "universal", |
||||
"filename" : "hd-introduction.png", |
||||
"scale" : "3x" |
||||
} |
||||
], |
||||
"info" : { |
||||
"version" : 1, |
||||
"author" : "xcode" |
||||
} |
||||
} |
After Width: | Height: | Size: 107 KiB |
@ -0,0 +1,113 @@ |
||||
// Copyright © 2019 Stormbird PTE. LTD. |
||||
|
||||
import UIKit |
||||
|
||||
protocol SeedPhraseBackupIntroductionViewControllerDelegate: class { |
||||
func didTapBackupWallet(inViewController viewController: SeedPhraseBackupIntroductionViewController) |
||||
} |
||||
|
||||
class SeedPhraseBackupIntroductionViewController: UIViewController { |
||||
private var viewModel = SeedPhraseBackupIntroductionViewModel() |
||||
private let roundedBackground = RoundedBackground() |
||||
private let subtitleLabel = UILabel() |
||||
private let imageView = UIImageView() |
||||
private let descriptionLabel1 = UILabel() |
||||
private let descriptionLabel2 = UILabel() |
||||
private let buttonsBar = ButtonsBar(numberOfButtons: 1) |
||||
|
||||
private var imageViewDimension: CGFloat { |
||||
if ScreenChecker().isNarrowScreen { |
||||
return 180 |
||||
} else { |
||||
return 250 |
||||
} |
||||
} |
||||
|
||||
weak var delegate: SeedPhraseBackupIntroductionViewControllerDelegate? |
||||
|
||||
init() { |
||||
super.init(nibName: nil, bundle: nil) |
||||
|
||||
hidesBottomBarWhenPushed = true |
||||
|
||||
roundedBackground.translatesAutoresizingMaskIntoConstraints = false |
||||
view.addSubview(roundedBackground) |
||||
|
||||
imageView.contentMode = .scaleAspectFit |
||||
|
||||
let stackView = [ |
||||
UIView.spacer(height: 30), |
||||
subtitleLabel, |
||||
UIView.spacer(height: 40), |
||||
imageView, |
||||
UIView.spacer(height: 40), |
||||
descriptionLabel1, |
||||
descriptionLabel2, |
||||
].asStackView(axis: .vertical) |
||||
stackView.translatesAutoresizingMaskIntoConstraints = false |
||||
roundedBackground.addSubview(stackView) |
||||
|
||||
let footerBar = UIView() |
||||
footerBar.translatesAutoresizingMaskIntoConstraints = false |
||||
footerBar.backgroundColor = .clear |
||||
roundedBackground.addSubview(footerBar) |
||||
|
||||
footerBar.addSubview(buttonsBar) |
||||
|
||||
NSLayoutConstraint.activate([ |
||||
imageView.heightAnchor.constraint(equalToConstant: imageViewDimension), |
||||
|
||||
stackView.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 20), |
||||
stackView.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -20), |
||||
stackView.topAnchor.constraint(equalTo: view.topAnchor), |
||||
stackView.bottomAnchor.constraint(lessThanOrEqualTo: view.bottomAnchor), |
||||
|
||||
buttonsBar.leadingAnchor.constraint(equalTo: footerBar.leadingAnchor), |
||||
buttonsBar.trailingAnchor.constraint(equalTo: footerBar.trailingAnchor), |
||||
buttonsBar.topAnchor.constraint(equalTo: footerBar.topAnchor), |
||||
buttonsBar.heightAnchor.constraint(equalToConstant: ButtonsBar.buttonsHeight), |
||||
|
||||
footerBar.leadingAnchor.constraint(equalTo: view.leadingAnchor), |
||||
footerBar.trailingAnchor.constraint(equalTo: view.trailingAnchor), |
||||
footerBar.topAnchor.constraint(equalTo: view.layoutGuide.bottomAnchor, constant: -ButtonsBar.buttonsHeight - ButtonsBar.marginAtBottomScreen), |
||||
footerBar.bottomAnchor.constraint(equalTo: view.bottomAnchor), |
||||
] + roundedBackground.createConstraintsWithContainer(view: view)) |
||||
} |
||||
|
||||
required init?(coder aDecoder: NSCoder) { |
||||
fatalError("init(coder:) has not been implemented") |
||||
} |
||||
|
||||
func configure() { |
||||
view.backgroundColor = Colors.appBackground |
||||
|
||||
subtitleLabel.textAlignment = .center |
||||
subtitleLabel.numberOfLines = 0 |
||||
subtitleLabel.textColor = viewModel.subtitleColor |
||||
subtitleLabel.font = viewModel.subtitleFont |
||||
subtitleLabel.text = viewModel.subtitle |
||||
|
||||
imageView.image = viewModel.imageViewImage |
||||
|
||||
descriptionLabel1.textAlignment = .center |
||||
descriptionLabel1.textColor = viewModel.descriptionColor |
||||
descriptionLabel1.font = viewModel.descriptionFont |
||||
descriptionLabel1.numberOfLines = 0 |
||||
descriptionLabel1.text = viewModel.description1 |
||||
|
||||
descriptionLabel2.textAlignment = .center |
||||
descriptionLabel2.textColor = viewModel.descriptionColor |
||||
descriptionLabel2.font = viewModel.descriptionFont |
||||
descriptionLabel2.numberOfLines = 0 |
||||
descriptionLabel2.text = viewModel.description2 |
||||
|
||||
buttonsBar.configure() |
||||
let exportButton = buttonsBar.buttons[0] |
||||
exportButton.setTitle(viewModel.title, for: .normal) |
||||
exportButton.addTarget(self, action: #selector(tappedExportButton), for: .touchUpInside) |
||||
} |
||||
|
||||
@objc private func tappedExportButton() { |
||||
delegate?.didTapBackupWallet(inViewController: self) |
||||
} |
||||
} |
@ -0,0 +1,46 @@ |
||||
// Copyright © 2019 Stormbird PTE. LTD. |
||||
|
||||
import Foundation |
||||
import UIKit |
||||
|
||||
struct SeedPhraseBackupIntroductionViewModel { |
||||
var backgroundColor: UIColor { |
||||
return Colors.appWhite |
||||
} |
||||
|
||||
var title: String { |
||||
return R.string.localizable.walletsBackupHdWalletIntroductionButtonTitle() |
||||
} |
||||
|
||||
var subtitle: String { |
||||
return R.string.localizable.walletsBackupHdWalletIntroductionTitle() |
||||
} |
||||
|
||||
var subtitleColor: UIColor { |
||||
return Colors.appText |
||||
} |
||||
|
||||
var subtitleFont: UIFont { |
||||
return Fonts.regular(size: 22)! |
||||
} |
||||
|
||||
var imageViewImage: UIImage { |
||||
return R.image.hdIntroduction()! |
||||
} |
||||
|
||||
var description1: String { |
||||
return R.string.localizable.walletsShowSeedPhraseSubtitle() |
||||
} |
||||
|
||||
var description2: String { |
||||
return R.string.localizable.walletsShowSeedPhraseDescription() |
||||
} |
||||
|
||||
var descriptionColor: UIColor { |
||||
return Colors.darkGray |
||||
} |
||||
|
||||
var descriptionFont: UIFont { |
||||
return Fonts.regular(size: 18)! |
||||
} |
||||
} |
Loading…
Reference in new issue