136 lines
6.1 KiB
Swift
136 lines
6.1 KiB
Swift
//
|
|
// AccountOnboardingControllerTutorial.swift
|
|
// Wallet
|
|
//
|
|
// Created by Saveliy Stavitsky on 3/12/21.
|
|
// Copyright © 2021 AM. All rights reserved.
|
|
//
|
|
|
|
import UIKit
|
|
|
|
class AccountOnboardingControllerTutorial: UIViewController {
|
|
|
|
@IBOutlet var stepStackView: UIStackView!
|
|
@IBOutlet var stepImageViewContainer: UIView!
|
|
@IBOutlet var stepImage: UIImageView!
|
|
@IBOutlet var textsStackViw: UIStackView!
|
|
|
|
var step = 1 {
|
|
didSet {
|
|
textsStackViw.arrangedSubviews.forEach({ $0.isHidden = true })
|
|
stepStackView.arrangedSubviews.forEach({ $0.backgroundColor = Asset.fog.color })
|
|
stepStackView.arrangedSubviews[0..<step]
|
|
.forEach({ $0.backgroundColor = Asset.deepWater.color })
|
|
|
|
prevButton.alpha = step <= 1 ? 0 : 1
|
|
|
|
switch step {
|
|
case 1:
|
|
stepImage.image = Asset.accountOnboardingTutorialStep1.image
|
|
textsStackViw.arrangedSubviews[0].isHidden = false
|
|
textsStackViw.arrangedSubviews[1].isHidden = false
|
|
textsStackViw.arrangedSubviews[2].isHidden = false
|
|
case 2:
|
|
stepImage.image = Asset.accountOnboardingTutorialStep2.image
|
|
textsStackViw.arrangedSubviews[1].isHidden = false
|
|
textsStackViw.arrangedSubviews[3].isHidden = false
|
|
case 3:
|
|
stepImage.image = Asset.accountOnboardingTutorialStep3.image
|
|
textsStackViw.arrangedSubviews[1].isHidden = false
|
|
textsStackViw.arrangedSubviews[4].isHidden = false
|
|
case 4:
|
|
stepImage.image = Asset.accountOnboardingTutorialStep4.image
|
|
textsStackViw.arrangedSubviews[5].isHidden = false
|
|
default:
|
|
break
|
|
}
|
|
}
|
|
}
|
|
|
|
@IBOutlet var prevButton: CommonButtonAction!
|
|
@IBOutlet var skipButton: CommonButtonAction!
|
|
@IBOutlet var nextButton: CommonButtonAction!
|
|
|
|
override func viewDidLoad() {
|
|
super.viewDidLoad()
|
|
|
|
step = 1
|
|
|
|
if let data = L10n.AccountOnboarding.Tutorial.textBase(L10n.AccountOnboarding.Tutorial.text2).data(using: .utf8),
|
|
let attributedString = try? NSAttributedString(data: data,
|
|
options: [.documentType: NSAttributedString.DocumentType.html],
|
|
documentAttributes: nil) {
|
|
// swiftlint:disable force_cast
|
|
(textsStackViw.subviews[0] as! UILabel).attributedText = attributedString
|
|
}
|
|
if let data = L10n.AccountOnboarding.Tutorial.textBase(L10n.AccountOnboarding.Tutorial.text1).data(using: .utf8),
|
|
let attributedString = try? NSAttributedString(data: data,
|
|
options: [.documentType: NSAttributedString.DocumentType.html],
|
|
documentAttributes: nil) {
|
|
// swiftlint:disable force_cast
|
|
(textsStackViw.subviews[1] as! UILabel).attributedText = attributedString
|
|
}
|
|
if let data = L10n.AccountOnboarding.Tutorial.textBase(L10n.AccountOnboarding.Tutorial.text3).data(using: .utf8),
|
|
let attributedString = try? NSAttributedString(data: data,
|
|
options: [.documentType: NSAttributedString.DocumentType.html],
|
|
documentAttributes: nil) {
|
|
// swiftlint:disable force_cast
|
|
(textsStackViw.subviews[2] as! UILabel).attributedText = attributedString
|
|
}
|
|
if let data = L10n.AccountOnboarding.Tutorial.textBase(L10n.AccountOnboarding.Tutorial.text4).data(using: .utf8),
|
|
let attributedString = try? NSAttributedString(data: data,
|
|
options: [.documentType: NSAttributedString.DocumentType.html],
|
|
documentAttributes: nil) {
|
|
// swiftlint:disable force_cast
|
|
(textsStackViw.subviews[3] as! UILabel).attributedText = attributedString
|
|
}
|
|
if let data = L10n.AccountOnboarding.Tutorial.textBase(L10n.AccountOnboarding.Tutorial.text5).data(using: .utf8),
|
|
let attributedString = try? NSAttributedString(data: data,
|
|
options: [.documentType: NSAttributedString.DocumentType.html],
|
|
documentAttributes: nil) {
|
|
// swiftlint:disable force_cast
|
|
(textsStackViw.subviews[4] as! UILabel).attributedText = attributedString
|
|
}
|
|
// PAYCASH-NEW
|
|
if let data = L10n.AccountOnboarding.Tutorial.textBase(L10n.AccountOnboarding.Tutorial.text6).data(using: .utf8),
|
|
let attributedString = try? NSAttributedString(data: data,
|
|
options: [.documentType: NSAttributedString.DocumentType.html],
|
|
documentAttributes: nil) {
|
|
(textsStackViw.subviews[5] as! UILabel).attributedText = attributedString
|
|
}
|
|
|
|
stepImageViewContainer
|
|
.drawVerticalGradient(startColor: .white,
|
|
endColor: UIColor.white.withAlphaComponent(0))
|
|
}
|
|
|
|
@IBAction func onPrev(_ sender: Any) {
|
|
step -= 1
|
|
}
|
|
|
|
@IBAction func onSkip(_ sender: Any) {
|
|
AccountOnboarding.Service.Common().finishedOnboarding = true
|
|
self.dismiss(animated: true)
|
|
}
|
|
|
|
@IBAction func onNext(_ sender: Any) {
|
|
if step >= 4 {
|
|
AccountOnboarding.Service.Common().finishedOnboarding = true
|
|
self.dismiss(animated: true)
|
|
} else {
|
|
step += 1
|
|
}
|
|
}
|
|
|
|
/*
|
|
// MARK: - Navigation
|
|
|
|
// In a storyboard-based application, you will often want to do a little preparation before navigation
|
|
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
|
|
// Get the new view controller using segue.destination.
|
|
// Pass the selected object to the new view controller.
|
|
}
|
|
*/
|
|
|
|
}
|