Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // ForgotPasswordVC.swift
- // hubble-ios
- //
- // Created by Appdesk Services PVT. LTD. on 13/02/24.
- // Copyright (c) 2023 hubble-ios. All rights reserved.
- //
- import UIKit
- class ForgotPasswordVC: HubbleBaseVC {
- // scrolview
- lazy var contentView: UIView = {
- let view = UIView()
- view.isAccessibilityElement = false
- view.backgroundColor = UIColor.colorWith(hexString: "ffffff", alpha: 0.0)
- return view
- }()
- lazy var scrollView: UIScrollView = {
- let scroll = UIScrollView()
- scroll.translatesAutoresizingMaskIntoConstraints = false
- scroll.showsVerticalScrollIndicator = true
- scroll.isScrollEnabled = true
- scroll.isAccessibilityElement = false
- scroll.addSubview(contentView)
- contentView.snp.makeConstraints { make in
- make.height.equalTo(700)
- make.top.bottom.left.right.width.equalTo(scroll)
- }
- return scroll
- }()
- // navigation bar
- lazy var backButton: UIButton = {
- let button = UIButton()
- button.accessibilityElement(id: AccessIdentifier.backButton, label: AccessLabel.backButton)
- button.backgroundColor = .colorWhiteAlpha1
- button.tintColor = .white
- button.hubbleAction(forControlEvents: .touchUpInside) {
- self.navigationController?.popViewController(animated: true)
- }
- button.corner(cornerRadius: 10)
- button.setImage(.backButton, for: .normal)
- return button
- }()
- let titleLabel: UILabel = {
- let label = UILabel()
- label.font = .fontBold20
- label.text = "Forgot Password"
- return label
- }()
- // page Content
- lazy var appIcon: UIImageView = {
- let imageView = UIImageView()
- imageView.image = .hubbleLogo
- imageView.isAccessibilityElement = false
- return imageView
- }()
- lazy var forgotPasswordLabel: UILabel = {
- let label = UILabel()
- label.text = "Forgot\nPassword"
- label.font = .fontBold20
- label.numberOfLines = 2
- label.textColor = .white
- label.textAlignment = .center
- return label
- }()
- lazy var descreptionLabel: UILabel = {
- let label = UILabel()
- label.textColor = .white
- label.font = .fontRegular14
- label.numberOfLines = 2
- label.text = "Lorem Ipsum is simply dummy text of the printing and typesetting industry."
- label.textAlignment = .center
- return label
- }()
- lazy var email: (container: UIView, leftImage: UIImageView, fieldTitleLabel: UILabel, textField: UITextField, button: UIButton) = {
- let email = Common.createTextField(leftImage: .mailLogo, placeholder: "Enter email", font: .fontRegular18)
- email.fieldTitleLabel.text = "Email"
- email.textField.textContentType = .emailAddress
- email.textField.keyboardType = .emailAddress
- email.textField.text = self.emailString
- return email
- }()
- lazy var submitButton: UIButton = {
- let button = UIButton()
- button.corner(cornerRadius: 12)
- button.setTitle("reviewRating_Submit_text".myLocalizedString, for: .normal)
- button.setTitleColor(.primaryColor, for: .normal)
- button.hubbleAction(forControlEvents: .touchUpInside) {
- self.submitButtonTapped()
- }
- button.titleLabel?.font = .fontBold20
- button.backgroundColor = .white
- return button
- }()
- var emailString: String = K.emptyString
- override func viewDidLoad() {
- super.viewDidLoad()
- super.isSwipeToBackActive = true
- setupUI()
- }
- func submitButtonTapped() {
- let isValidEmail = Validation().isValidEmail(email.textField.text ?? K.emptyString)
- if isValidEmail {
- // TODO: Call Send OTP API
- } else {
- showAlert(message: "validation_signUp_email".myLocalizedString)
- }
- }
- func setupUI() {
- self.view.addSubview(scrollView)
- scrollView.snp.makeConstraints { make in
- make.top.equalTo(self.view.safeAreaLayoutGuide)
- make.bottom.left.right.equalTo(self.view)
- make.width.equalTo(self.view)
- make.bottom.equalTo(self.view.safeAreaLayoutGuide)
- }
- contentView.addSubview(backButton)
- backButton.snp.makeConstraints { make in
- make.top.equalTo(contentView.snp.top).offset(12)
- make.left.equalTo(contentView.snp.left).offset(20)
- make.height.width.equalTo(40)
- }
- contentView.addSubview(titleLabel)
- titleLabel.snp.makeConstraints { make in
- make.top.equalTo(contentView.snp.top).offset(20)
- make.centerX.equalTo(contentView)
- }
- contentView.addSubview(appIcon)
- appIcon.snp.makeConstraints { make in
- make.centerX.equalTo(contentView)
- make.top.equalTo(titleLabel.bottom).offset(24)
- make.height.equalTo(130)
- make.width.equalTo(124)
- }
- contentView.addSubview(forgotPasswordLabel)
- forgotPasswordLabel.snp.makeConstraints { make in
- make.centerX.equalTo(contentView)
- make.top.equalTo(appIcon.bottom).offset(topOffset)
- make.width.equalTo(contentView)
- }
- contentView.addSubview(descreptionLabel)
- descreptionLabel.snp.makeConstraints { make in
- make.centerX.equalTo(contentView)
- make.top.equalTo(forgotPasswordLabel.bottom).offset(24)
- make.width.equalTo(270)
- }
- contentView.addSubview(email.container)
- email.container.snp.makeConstraints { make in
- make.top.equalTo(descreptionLabel.bottom).offset(44)
- make.left.right.equalTo(contentView)
- make.height.equalTo(Common.containerHeight96)
- }
- contentView.addSubview(submitButton)
- submitButton.snp.makeConstraints { make in
- make.top.equalTo(email.container.bottom).offset(24)
- make.left.equalTo(email.container).offset(leftOffset)
- make.right.equalTo(email.container).inset(rightInset)
- make.height.equalTo(64)
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment