- 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
79 lines
1.8 KiB
Swift
79 lines
1.8 KiB
Swift
//
|
|
// AuthFunc.swift
|
|
// WOKA
|
|
//
|
|
// Created by Bilal on 26/04/2024.
|
|
//
|
|
|
|
import Foundation
|
|
import AVFoundation
|
|
|
|
/*
|
|
Language Enum
|
|
*/
|
|
enum LocalizedEnum : String , CaseIterable{
|
|
case hindi = "hi"
|
|
case english = "en"
|
|
}
|
|
|
|
class AuthFunc{
|
|
|
|
/**
|
|
This is not for external use!
|
|
This should only be used for login, registration, Auth Process process & userData Extraction.
|
|
*/
|
|
|
|
var player: AVQueuePlayer?
|
|
var playerLooper: AVPlayerLooper?
|
|
var userType = UserType.adult
|
|
var languageSelected = LocalizedEnum.english
|
|
|
|
var authID = String()
|
|
var authPass = String()
|
|
|
|
//This is temporary variable. Make it emtpy when the registration is finished.
|
|
var regData = UserRegPostModel()
|
|
|
|
static let shareInstance = AuthFunc()
|
|
|
|
|
|
func setAuthIDPass(){
|
|
if let id = Bundle.main.infoDictionary?["API_KEY_ID"] as? String{
|
|
authID = id
|
|
}
|
|
|
|
if let pass = Bundle.main.infoDictionary?["API_KEY_PASS"] as? String{
|
|
authPass = pass
|
|
}
|
|
}
|
|
|
|
func playStartUpsound(){
|
|
guard let path = Bundle.main.path(forResource: K.StaticFilesString.onBoardMainSound, ofType:"m4a") else {
|
|
return }
|
|
let url = URL(fileURLWithPath: path)
|
|
|
|
let playerItem = AVPlayerItem(url: url)
|
|
|
|
// Initialize AVQueuePlayer with the player item
|
|
player = AVQueuePlayer(items: [playerItem])
|
|
|
|
// Create AVPlayerLooper
|
|
playerLooper = AVPlayerLooper(player: player!, templateItem: playerItem)
|
|
player?.play()
|
|
}
|
|
|
|
func stopSound(){
|
|
player?.removeAllItems()
|
|
}
|
|
|
|
func pauseSound(){
|
|
player?.pause()
|
|
}
|
|
|
|
}
|
|
|
|
enum UserType {
|
|
case adult
|
|
case kid
|
|
}
|