Merge branch 'charlesmchen/experienceUpgradesVsIPhoneX'

pull/1/head
Matthew Chen 7 years ago
commit dbf2c6575f

@ -1,5 +1,5 @@
// //
// Copyright (c) 2017 Open Whisper Systems. All rights reserved. // Copyright (c) 2018 Open Whisper Systems. All rights reserved.
// //
import Foundation import Foundation
@ -10,7 +10,7 @@ private class IntroductingReadReceiptsExperienceUpgradeViewController: Experienc
var buttonAction: ((UIButton) -> Void)? var buttonAction: ((UIButton) -> Void)?
override func loadView() { override func loadView() {
self.view = UIView() self.view = UIView.container()
/// Create Views /// Create Views
@ -71,7 +71,7 @@ private class IntroductingReadReceiptsExperienceUpgradeViewController: Experienc
// Title label layout // Title label layout
titleLabel.autoSetDimension(.height, toSize: ScaleFromIPhone5(40)) titleLabel.autoSetDimension(.height, toSize: ScaleFromIPhone5(40))
titleLabel.autoPinWidthToSuperview(withMargin: ScaleFromIPhone5To7Plus(16, 24)) titleLabel.autoPinWidthToSuperview(withMargin: ScaleFromIPhone5To7Plus(16, 24))
titleLabel.autoPinEdge(toSuperviewEdge: .top) titleLabel.autoPinTopToSuperview()
// Body label layout // Body label layout
bodyLabel.autoPinEdge(.top, to: .bottom, of: imageView, withOffset: ScaleFromIPhone5To7Plus(18, 28)) bodyLabel.autoPinEdge(.top, to: .bottom, of: imageView, withOffset: ScaleFromIPhone5To7Plus(18, 28))
@ -421,13 +421,17 @@ class ExperienceUpgradesPageViewController: OWSViewController, UIPageViewControl
} }
override func loadView() { override func loadView() {
self.view = UIView() self.view = UIView.container()
view.backgroundColor = UIColor.white view.backgroundColor = UIColor.white
//// Create Views //// Create Views
// Header Background // Header Background
let headerBackgroundView = UIView() let statusBarBackgroundView = UIView.container()
view.addSubview(statusBarBackgroundView)
statusBarBackgroundView.backgroundColor = UIColor.ows_materialBlue
let headerBackgroundView = UIView.container()
view.addSubview(headerBackgroundView) view.addSubview(headerBackgroundView)
headerBackgroundView.backgroundColor = UIColor.ows_materialBlue headerBackgroundView.backgroundColor = UIColor.ows_materialBlue
@ -451,21 +455,34 @@ class ExperienceUpgradesPageViewController: OWSViewController, UIPageViewControl
//// Layout Views //// Layout Views
// Status Bar Background layout
//
// We use a separate backgrounds for the "status bar" area (which has very
// different height on iPhone X) and the "header" (which has consistent
// height).
statusBarBackgroundView.autoPinWidthToSuperview()
statusBarBackgroundView.autoPinEdge(toSuperviewEdge: .top)
statusBarBackgroundView.autoPinEdge(.bottom, to: .top, of: headerBackgroundView)
// Header Background layout // Header Background layout
statusBarBackgroundView.autoPinWidthToSuperview()
statusBarBackgroundView.autoPinEdge(toSuperviewEdge: .top)
statusBarBackgroundView.autoPinEdge(.bottom, to: .top, of: headerBackgroundView)
headerBackgroundView.autoPinWidthToSuperview() headerBackgroundView.autoPinWidthToSuperview()
headerBackgroundView.autoPinEdge(toSuperviewEdge: .top) headerBackgroundView.autoPinTopToSuperview()
headerBackgroundView.autoSetDimension(.height, toSize: ScaleFromIPhone5(80)) headerBackgroundView.autoSetDimension(.height, toSize: ScaleFromIPhone5(60))
// Dismiss button layout // Dismiss button layout
dismissButton.autoHCenterInSuperview() dismissButton.autoHCenterInSuperview()
dismissButton.autoPinEdge(toSuperviewEdge: .bottom, withInset: ScaleFromIPhone5(10)) dismissButton.autoPinBottomToSuperview(withMargin: ScaleFromIPhone5(10))
// Carousel View layout // Carousel View layout
carouselView.autoPinWidthToSuperview() carouselView.autoPinWidthToSuperview()
// negative inset so as to overlay the header text in the carousel view with the header background which // negative inset so as to overlay the header text in the carousel view with the header background which
// lives outside of the carousel. We do this so that the user can't bounce past the page view controllers // lives outside of the carousel. We do this so that the user can't bounce past the page view controllers
// width limits, exposing the edge of the header. // width limits, exposing the edge of the header.
carouselView.autoPin(toTopLayoutGuideOf: self, withInset: ScaleFromIPhone5To7Plus(14, 24)) carouselView.autoPinTopToSuperview(withMargin: ScaleFromIPhone5To7Plus(14, 24))
carouselView.autoPinEdge(.bottom, to: .top, of: dismissButton, withOffset: ScaleFromIPhone5(-10)) carouselView.autoPinEdge(.bottom, to: .top, of: dismissButton, withOffset: ScaleFromIPhone5(-10))
} }

Loading…
Cancel
Save