mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
Optimize layout for profile upgrade, remove other upgrade screens
// FREEBIE
This commit is contained in:
parent
0244a82031
commit
59eb782d57
|
@ -7,9 +7,35 @@ import Foundation
|
|||
private class IntroductingProfilesExperienceUpgradeViewController: ExperienceUpgradeViewController {
|
||||
|
||||
override func loadView() {
|
||||
super.loadView()
|
||||
assert(view != nil)
|
||||
assert(bodyLabel != nil)
|
||||
self.view = UIView()
|
||||
|
||||
/// 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
|
||||
let button = UIButton()
|
||||
|
@ -25,10 +51,29 @@ private class IntroductingProfilesExperienceUpgradeViewController: ExperienceUpg
|
|||
|
||||
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.autoPinEdge(.top, to: .bottom, of: bodyLabel, withOffset: ScaleFromIPhone5(18))
|
||||
button.autoPinWidthToSuperview(withMargin: ScaleFromIPhone5(32))
|
||||
button.sizeToFit()
|
||||
button.autoPinEdge(toSuperviewEdge: .bottom, withInset: ScaleFromIPhone5(16))
|
||||
button.autoSetDimension(.height, toSize: ScaleFromIPhone5(36))
|
||||
}
|
||||
|
||||
// MARK: - Actions
|
||||
|
@ -145,19 +190,22 @@ private class ExperienceUpgradeViewController: OWSViewController {
|
|||
|
||||
/// 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
|
||||
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()
|
||||
|
||||
// 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))
|
||||
bodyLabel.autoPinEdge(toSuperviewEdge: .bottom, withInset: ScaleFromIPhone5(16))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -37,8 +37,12 @@ class ExperienceUpgradeFinder: NSObject {
|
|||
// Keep these ordered by increasing uniqueId.
|
||||
private var allExperienceUpgrades: [ExperienceUpgrade] {
|
||||
return [
|
||||
videoCalling,
|
||||
(UIDevice.current.supportsCallKit ? callKit : nil),
|
||||
// Disable old experience upgrades. Most people have seen them by now, and accomodating multiple makes layout harder.
|
||||
// Note if we ever want to show multiple experience upgrades again
|
||||
// we'll have to update the layout in ExperienceUpgradesPageViewController
|
||||
//
|
||||
// videoCalling,
|
||||
// (UIDevice.current.supportsCallKit ? callKit : nil),
|
||||
introducingProfiles
|
||||
].flatMap { $0 }
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@ class ExperienceUpgrade: TSYapDatabaseObject {
|
|||
let title: String
|
||||
let body: String
|
||||
let image: UIImage?
|
||||
var seenAt: Date?
|
||||
|
||||
required init(uniqueId: String, title: String, body: String, image: UIImage) {
|
||||
self.title = title
|
||||
|
@ -61,9 +60,4 @@ class ExperienceUpgrade: TSYapDatabaseObject {
|
|||
return super.storageBehaviorForProperty(withKey: propertyKey)
|
||||
}
|
||||
}
|
||||
|
||||
func markAsSeen(transaction: YapDatabaseReadWriteTransaction) {
|
||||
self.seenAt = Date()
|
||||
super.save(with: transaction)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1520,7 +1520,7 @@
|
|||
"UPGRADE_EXPERIENCE_INTRODUCING_PROFILES_BUTTON" = "Set up Your Profile";
|
||||
|
||||
/* Description of new profile feature for upgrading (existing) users */
|
||||
"UPGRADE_EXPERIENCE_INTRODUCING_PROFILES_DESCRIPTION" = "You can now share a photo and name with your friends on Signal.";
|
||||
"UPGRADE_EXPERIENCE_INTRODUCING_PROFILES_DESCRIPTION" = "You can now share a profile photo and name with your friends on Signal.";
|
||||
|
||||
/* Header for upgrade experience */
|
||||
"UPGRADE_EXPERIENCE_INTRODUCING_PROFILES_TITLE" = "Ready for Your Closeup?";
|
||||
|
|
Loading…
Reference in a new issue