Files
Woka_Native_iOS/WOKA/Main/AuthFunc.swift
BilalKhanWDI 3f2899b9a3 - Added api for child register
- Finalised the registration for parent
- Finalised the flow for above 16 and go the registeration completed.
- Added a View controller for showing the linked child.
2024-05-09 18:07:59 +05:30

90 lines
2.2 KiB
Swift

//
// AuthFunc.swift
// WOKA
//
// Created by Bilal on 26/04/2024.
//
import Foundation
import AVFoundation
import UIKit
/*
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 getDeviceUUID() -> String{
/*
UIDevice.current.name // e.g. "My iPhone"
UIDevice.current.model // e.g. @"iPhone", @"iPod touch"
UIDevice.current.localizedModel // localized version of model
UIDevice.current.systemName // e.g. @"iOS"
UIDevice.current.systemVersion // e.g. @"15.5"
*/
return UIDevice.current.identifierForVendor!.uuidString
}
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
}