- Added verify OTP api - Modified the flow - Made a authfunc to handle the type of user and the language selected - Added OTP fields combine logic. Also handled the otp blank checks. - Added API for intrestes get
64 lines
2.5 KiB
Swift
64 lines
2.5 KiB
Swift
//
|
|
// UserDetailsRegisterVM.swift
|
|
// WOKA
|
|
//
|
|
// Created by MacBook Pro on 29/04/24.
|
|
//
|
|
|
|
import UIKit
|
|
|
|
class UserDetailsRegisterVM{
|
|
|
|
weak var vc : UserDetailsRegisterVC!
|
|
|
|
func initView(){
|
|
let color1 = #colorLiteral(red: 0.144693464, green: 0.1426281333, blue: 0.6686832905, alpha: 1)
|
|
let color2 = #colorLiteral(red: 0.6901960784, green: 0.2745098039, blue: 0.7568627451, alpha: 1)
|
|
vc.nextBtn.applyGradient(colors: [color1, color2], startPoint: CGPoint(x: 0, y: 0), endPoint: CGPoint(x: 0.8, y: 0))
|
|
vc.nextBtn.roundCorner()
|
|
tfMod(textField: [vc.enterNameTF, vc.enterPasswordTF, vc.enterUserNameTF])
|
|
hindiEnglishLanguage()
|
|
|
|
vc.enterNameTF.delegate = self.vc
|
|
vc.enterPasswordTF.delegate = self.vc
|
|
vc.enterUserNameTF.delegate = self.vc
|
|
|
|
//Adding eye to the password tf
|
|
vc.enterPasswordTF.enablePasswordToggle()
|
|
vc.enterPasswordTF.rightView?.isHidden = true
|
|
|
|
//Adding error view to the name tf
|
|
vc.enterNameTF.addRightButton(title: "", tintColor: UIColor.red, btnImage: UIImage(systemName: "exclamationmark.circle.fill"), target: self, action: #selector(errorName))
|
|
vc.enterNameTF.rightView?.isHidden = true
|
|
vc.enterUserNameTF.addRightButton(title: "", tintColor: UIColor.red, btnImage: UIImage(systemName: "exclamationmark.circle.fill"), target: self, action: #selector(errorName))
|
|
vc.enterUserNameTF.rightView?.isHidden = true
|
|
}
|
|
|
|
@objc func errorName(){
|
|
let errorView = errorViews.object(forKey: vc.enterNameTF)
|
|
if let errorView = errorView {
|
|
errorView.isHidden.toggle()
|
|
}
|
|
}
|
|
|
|
@objc func errorUserName(){
|
|
let errorView = errorViews.object(forKey: vc.enterNameTF)
|
|
if let errorView = errorView {
|
|
errorView.isHidden.toggle()
|
|
}
|
|
}
|
|
|
|
func hindiEnglishLanguage(){
|
|
vc.enterNameTF.placeholder = K.AuthenticationStringConstant.enterName.localized(loc: AuthFunc.shareInstance.languageSelected.rawValue)
|
|
vc.enterUserNameTF.placeholder = K.AuthenticationStringConstant.selectUsername.localized(loc: AuthFunc.shareInstance.languageSelected.rawValue)
|
|
vc.enterPasswordTF.placeholder = K.AuthenticationStringConstant.enterPassword.localized(loc: AuthFunc.shareInstance.languageSelected.rawValue)
|
|
}
|
|
|
|
private func tfMod(textField : [UITextField]){
|
|
for i in textField{
|
|
i.roundCorner(radius: i.frame.height / 2)
|
|
i.delegate = vc.self
|
|
}
|
|
}
|
|
}
|