- Added haptics for app load - Added JWplayer Pods. - Added Av player for home live stream - Made the Explore Woka Screen. - Made button Effect for the selection
70 lines
2.4 KiB
Swift
70 lines
2.4 KiB
Swift
//
|
|
// ThemeTwoVM.swift
|
|
// WOKA
|
|
//
|
|
// Created by MacBook Pro on 27/05/24.
|
|
//
|
|
|
|
import UIKit
|
|
|
|
struct Theme2Struct{
|
|
let imageName : String
|
|
let text : String
|
|
}
|
|
class ThemeTwoVM{
|
|
|
|
weak var vc : ThemeTwoVC!
|
|
|
|
// var cellData = ["WokaFMT2", "LiveTVT2", "WebSeriesT2", "GamesT2", "AudioBooksT2", "KaraokeT2", "ShopT2"]
|
|
var cellData = [Theme2Struct(imageName: "WokaFMT2", text: "WOKA FM"),
|
|
Theme2Struct(imageName: "LiveTVT2", text: "LIVE TV"),
|
|
Theme2Struct(imageName: "WebSeriesT2", text: "WEB SERIES"),
|
|
Theme2Struct(imageName: "GamesT2", text: "GAMES"),
|
|
Theme2Struct(imageName: "AudioBooksT2", text: "AUDIO BOOKS"),
|
|
Theme2Struct(imageName: "KaraokeT2", text: "KARAOKE"),
|
|
Theme2Struct(imageName: "ShopT2", text: "SHOP")]
|
|
|
|
func initView(){
|
|
setupCell()
|
|
NotificationCenter.default.addObserver(self, selector: #selector(self.reloadTheme), name: NSNotification.Name(rawValue: K.NotificationCenterReloads.reloadTheme), object: nil)
|
|
}
|
|
|
|
func setData(){
|
|
guard let data = AuthFunc.shareInstance.userData else{return}
|
|
//set the first name as the name
|
|
/*
|
|
Check User Type,
|
|
Dont show username if the user type is guest
|
|
*/
|
|
switch data.userType{
|
|
case "1": // child
|
|
vc.nameLabel.text = data.fullname?.components(separatedBy: " ").first
|
|
case "2" : // adult
|
|
vc.nameLabel.text = data.fullname?.components(separatedBy: " ").first
|
|
case "3": // Guest
|
|
vc.nameLabel.text = ""
|
|
break
|
|
default:
|
|
break
|
|
}
|
|
|
|
if let avatar = data.avtar{
|
|
//https://wokaland.com/admin/storage/app/public/uploads/avtar/avatar2.png?d=1716889852
|
|
vc.avatarImage.imageURL("https://i.pinimg.com/280x280_RS/da/0b/bd/da0bbdb22d191272f32fa2c7c7c8e5c2.jpg", color: .white)
|
|
}
|
|
|
|
}
|
|
|
|
// MARK: - Notification Center Handlers
|
|
|
|
@objc func reloadTheme(){
|
|
self.vc.delegate?.didPressSwitchButton(from: self.vc)
|
|
}
|
|
|
|
func setupCell(){
|
|
vc.collectionView.register(UINib(nibName: K.CellIdentifier.Theme.homeExploreCell, bundle: nil), forCellWithReuseIdentifier: K.CellIdentifier.Theme.homeExploreCell)
|
|
vc.collectionView.delegate = vc.self
|
|
vc.collectionView.dataSource = vc.self
|
|
}
|
|
}
|