|
|
@ -7,9 +7,35 @@ import Foundation
|
|
|
|
private class IntroductingProfilesExperienceUpgradeViewController: ExperienceUpgradeViewController {
|
|
|
|
private class IntroductingProfilesExperienceUpgradeViewController: ExperienceUpgradeViewController {
|
|
|
|
|
|
|
|
|
|
|
|
override func loadView() {
|
|
|
|
override func loadView() {
|
|
|
|
super.loadView()
|
|
|
|
self.view = UIView()
|
|
|
|
assert(view != nil)
|
|
|
|
|
|
|
|
assert(bodyLabel != nil)
|
|
|
|
/// Create Views
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Title label
|
|
|
|
|
|
|
|
let titleLabel = UILabel()
|
|
|
|
|
|
|
|
view.addSubview(titleLabel)
|
|
|
|
|
|
|
|
titleLabel.text = header
|
|
|
|
|
|
|
|
titleLabel.textAlignment = .center
|
|
|
|
|
|
|
|
titleLabel.font = UIFont.ows_regularFont(withSize: ScaleFromIPhone5(24))
|
|
|
|
|
|
|
|
titleLabel.textColor = UIColor.white
|
|
|
|
|
|
|
|
titleLabel.minimumScaleFactor = 0.5
|
|
|
|
|
|
|
|
titleLabel.adjustsFontSizeToFitWidth = true
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Body label
|
|
|
|
|
|
|
|
let bodyLabel = UILabel()
|
|
|
|
|
|
|
|
self.bodyLabel = bodyLabel
|
|
|
|
|
|
|
|
view.addSubview(bodyLabel)
|
|
|
|
|
|
|
|
bodyLabel.text = body
|
|
|
|
|
|
|
|
bodyLabel.font = UIFont.ows_lightFont(withSize: ScaleFromIPhone5To7Plus(17, 22))
|
|
|
|
|
|
|
|
bodyLabel.textColor = UIColor.black
|
|
|
|
|
|
|
|
bodyLabel.numberOfLines = 0
|
|
|
|
|
|
|
|
bodyLabel.lineBreakMode = .byWordWrapping
|
|
|
|
|
|
|
|
bodyLabel.textAlignment = .center
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Image
|
|
|
|
|
|
|
|
let imageView = UIImageView(image: image)
|
|
|
|
|
|
|
|
view.addSubview(imageView)
|
|
|
|
|
|
|
|
imageView.contentMode = .scaleAspectFit
|
|
|
|
|
|
|
|
|
|
|
|
// Button
|
|
|
|
// Button
|
|
|
|
let button = UIButton()
|
|
|
|
let button = UIButton()
|
|
|
@ -25,10 +51,29 @@ private class IntroductingProfilesExperienceUpgradeViewController: ExperienceUpg
|
|
|
|
|
|
|
|
|
|
|
|
button.titleLabel?.font = UIFont.ows_mediumFont(withSize: ScaleFromIPhone5(18))
|
|
|
|
button.titleLabel?.font = UIFont.ows_mediumFont(withSize: ScaleFromIPhone5(18))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// Layout Views
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Image layout
|
|
|
|
|
|
|
|
imageView.autoAlignAxis(toSuperviewAxis: .vertical)
|
|
|
|
|
|
|
|
imageView.autoPinToSquareAspectRatio()
|
|
|
|
|
|
|
|
imageView.autoPinEdge(.top, to: .bottom, of: titleLabel, withOffset: ScaleFromIPhone5To7Plus(36, 40))
|
|
|
|
|
|
|
|
imageView.autoSetDimension(.height, toSize: ScaleFromIPhone5(225))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Title label layout
|
|
|
|
|
|
|
|
titleLabel.autoSetDimension(.height, toSize: ScaleFromIPhone5(40))
|
|
|
|
|
|
|
|
titleLabel.autoPinWidthToSuperview(withMargin: ScaleFromIPhone5To7Plus(16, 24))
|
|
|
|
|
|
|
|
titleLabel.autoPinEdge(toSuperviewEdge: .top)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Body label layout
|
|
|
|
|
|
|
|
bodyLabel.autoPinEdge(.top, to: .bottom, of: imageView, withOffset: ScaleFromIPhone5To7Plus(18, 28))
|
|
|
|
|
|
|
|
bodyLabel.autoPinWidthToSuperview(withMargin: bodyMargin)
|
|
|
|
|
|
|
|
bodyLabel.sizeToFit()
|
|
|
|
|
|
|
|
|
|
|
|
// Button layout
|
|
|
|
// Button layout
|
|
|
|
button.autoPinEdge(.top, to: .bottom, of: bodyLabel, withOffset: ScaleFromIPhone5(18))
|
|
|
|
button.autoPinEdge(.top, to: .bottom, of: bodyLabel, withOffset: ScaleFromIPhone5(18))
|
|
|
|
button.autoPinWidthToSuperview(withMargin: ScaleFromIPhone5(32))
|
|
|
|
button.autoPinWidthToSuperview(withMargin: ScaleFromIPhone5(32))
|
|
|
|
button.sizeToFit()
|
|
|
|
button.autoPinEdge(toSuperviewEdge: .bottom, withInset: ScaleFromIPhone5(16))
|
|
|
|
|
|
|
|
button.autoSetDimension(.height, toSize: ScaleFromIPhone5(36))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// MARK: - Actions
|
|
|
|
// MARK: - Actions
|
|
|
@ -145,19 +190,22 @@ private class ExperienceUpgradeViewController: OWSViewController {
|
|
|
|
|
|
|
|
|
|
|
|
/// Layout Views
|
|
|
|
/// Layout Views
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Image layout
|
|
|
|
|
|
|
|
imageView.autoAlignAxis(toSuperviewAxis: .vertical)
|
|
|
|
|
|
|
|
imageView.autoPinToSquareAspectRatio()
|
|
|
|
|
|
|
|
imageView.autoPinEdge(.top, to: .bottom, of: titleLabel, withOffset: ScaleFromIPhone5To7Plus(36, 60))
|
|
|
|
|
|
|
|
imageView.autoSetDimension(.height, toSize: ScaleFromIPhone5(225))
|
|
|
|
|
|
|
|
|
|
|
|
// Title label layout
|
|
|
|
// Title label layout
|
|
|
|
|
|
|
|
titleLabel.autoSetDimension(.height, toSize: ScaleFromIPhone5(40))
|
|
|
|
titleLabel.autoPinWidthToSuperview(withMargin: ScaleFromIPhone5To7Plus(16, 24))
|
|
|
|
titleLabel.autoPinWidthToSuperview(withMargin: ScaleFromIPhone5To7Plus(16, 24))
|
|
|
|
titleLabel.autoPinEdge(toSuperviewEdge: .top)
|
|
|
|
titleLabel.autoPinEdge(toSuperviewEdge: .top)
|
|
|
|
|
|
|
|
|
|
|
|
// Body label layout
|
|
|
|
// Body label layout
|
|
|
|
|
|
|
|
bodyLabel.autoPinEdge(.top, to: .bottom, of: imageView, withOffset: ScaleFromIPhone5To7Plus(18, 28))
|
|
|
|
bodyLabel.autoPinWidthToSuperview(withMargin: bodyMargin)
|
|
|
|
bodyLabel.autoPinWidthToSuperview(withMargin: bodyMargin)
|
|
|
|
bodyLabel.sizeToFit()
|
|
|
|
bodyLabel.sizeToFit()
|
|
|
|
|
|
|
|
bodyLabel.autoPinEdge(toSuperviewEdge: .bottom, withInset: ScaleFromIPhone5(16))
|
|
|
|
// Image layout
|
|
|
|
|
|
|
|
imageView.autoPinWidthToSuperview()
|
|
|
|
|
|
|
|
imageView.autoSetDimension(.height, toSize: ScaleFromIPhone5To7Plus(200, 280))
|
|
|
|
|
|
|
|
imageView.autoPinEdge(.top, to: .bottom, of: titleLabel, withOffset: ScaleFromIPhone5To7Plus(36, 60))
|
|
|
|
|
|
|
|
imageView.autoPinEdge(.bottom, to: .top, of: bodyLabel, withOffset: -ScaleFromIPhone5To7Plus(18, 28))
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|