[iOS] Fixed layout and localization in Onboarding views

This commit is contained in:
Alexander Boriskov 2019-11-27 16:43:16 +03:00 committed by Arsentiy Milchakov
parent d44c5fd58a
commit 31178e4277
4 changed files with 18 additions and 6 deletions

View file

@ -26,12 +26,12 @@ extension PromoDiscoveryPresenter: IPromoRouterPresenter {
viewController?.setNextButtonTitle(L("new_onboarding_step5.1_button"))
case .buySubscription:
viewController?.setTitleImage(UIImage(named: "img_onboarding_subscribeguides"))
viewController?.setTitle(L("new_onboarding_step5.2_header"))
viewController?.setTitle(L("new_onboarding_step5.1_header"))
viewController?.setText(L("new_onboarding_step5.2_message"))
viewController?.setNextButtonTitle(L("new_onboarding_step5.2_button"))
case .downloadSamples:
viewController?.setTitleImage(UIImage(named: "img_onboarding_samples"))
viewController?.setTitle(L("new_onboarding_step5.3_header"))
viewController?.setTitle(L("new_onboarding_step5.1_header"))
viewController?.setText(L("new_onboarding_step5.3_message"))
viewController?.setNextButtonTitle(L("new_onboarding_step5.3_button"))
}

View file

@ -20,7 +20,7 @@ extension TermsOfUsePresenter: ITermsOfUsePresenter {
func configure() {
view?.setTitleImage(UIImage(named: "img_onboarding_travelbuddy"))
view?.setTitle(L("new_onboarding_step1_header"))
view?.setText(L("new_onboarding_step1_message"))
view?.setText(L("new_onboarding_step1_header_2"))
view?.setPrivacyPolicyTitle(String(coreFormat: L("sign_agree_pp_gdpr"), arguments: [privacyPolicyLink]))
view?.setTermsOfUseTitle(String(coreFormat: L("sign_agree_tof_gdpr"), arguments: [termsOfUseLink]))
}

View file

@ -118,8 +118,12 @@ final class WelcomePageController: UIPageViewController {
private func updateFrame() {
let parentView = parentController.view!
let size = WelcomeViewController.presentationSize
view.frame = alternative(iPhone: CGRect(origin: CGPoint(), size: parentView.size),
iPad: CGRect(x: parentView.center.x - 260, y: parentView.center.y - 300, width: 520, height: 600))
iPad: CGRect(x: parentView.center.x - size.width/2,
y: parentView.center.y - size.height/2,
width: size.width,
height: size.height))
}
override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {

View file

@ -9,7 +9,7 @@ protocol IWelcomeView: class {
var isCloseButtonHidden: Bool {get set}
}
class WelcomeViewController: MWMViewController {
class WelcomeViewController: MWMViewController, UIAdaptivePresentationControllerDelegate {
var presenter: IWelcomePresenter?
@IBOutlet private var image: UIImageView!
@ -18,6 +18,7 @@ class WelcomeViewController: MWMViewController {
@IBOutlet private var nextButton: UIButton!
@IBOutlet private var closeButton: UIButton!
@IBOutlet private var closeButtonHeightConstraint: NSLayoutConstraint!
static var presentationSize = CGSize(width: 520, height: 600)
var isCloseButtonHidden: Bool = false {
didSet{
@ -25,9 +26,17 @@ class WelcomeViewController: MWMViewController {
}
}
required init?(coder: NSCoder) {
super.init(coder: coder)
self.modalTransitionStyle = .coverVertical
self.modalPresentationStyle = .formSheet
self.presentationController?.delegate = self;
}
override func viewDidLoad() {
super.viewDidLoad()
presenter?.configure()
self.preferredContentSize = WelcomeViewController.presentationSize
}
override func viewDidAppear(_ animated: Bool) {
@ -73,4 +82,3 @@ extension WelcomeViewController: IWelcomeView {
image.image = titleImage
}
}