143 lines
4.9 KiB
Swift
143 lines
4.9 KiB
Swift
//
|
|
// ThemeOneVC.swift
|
|
// WOKA
|
|
//
|
|
// Created by Bilal on 03/05/2024.
|
|
//
|
|
|
|
import UIKit
|
|
|
|
class ThemeOneVC: UIViewController {
|
|
|
|
@IBOutlet weak var gradientView: UIView!
|
|
@IBOutlet weak var cloud2: UIImageView!
|
|
@IBOutlet weak var cloud1: UIImageView!
|
|
@IBOutlet weak var liveTVView: UIView!
|
|
@IBOutlet weak var liveTvPlayer: UIView!
|
|
@IBOutlet weak var homeGrass: UIImageView!
|
|
@IBOutlet weak var nameLabel: UILabel!
|
|
@IBOutlet weak var welcomeLabel: LocalisedElementsLabel!
|
|
@IBOutlet weak var HelloLabel: LocalisedElementsLabel!
|
|
@IBOutlet weak var liveTVIcon: UIView!
|
|
|
|
@IBOutlet weak var notificationBtnn: UIButton!
|
|
@IBOutlet weak var avatarImage: UIImageView!
|
|
|
|
@IBOutlet weak var webSeriesView: UIView!
|
|
@IBOutlet weak var audioBooksView: UIView!
|
|
@IBOutlet var star: [UIImageView]!
|
|
@IBOutlet weak var moonImage: UIImageView!
|
|
@IBOutlet weak var moreStack: UIStackView!
|
|
@IBOutlet weak var bottomArrow: UIImageView!
|
|
@IBOutlet weak var gamesView: UIView!
|
|
@IBOutlet weak var karaokeView: UIView!
|
|
@IBOutlet weak var shopView: UIView!
|
|
|
|
var timer: Timer?
|
|
|
|
var vm = ThemeOneVM()
|
|
|
|
weak var delegate: ChildViewControllerDelegate?
|
|
|
|
|
|
deinit{
|
|
timer?.invalidate()
|
|
// Removing observers
|
|
NotificationCenter.default.removeObserver(self, name: UIApplication.didEnterBackgroundNotification, object: nil)
|
|
NotificationCenter.default.removeObserver(self, name: UIApplication.willEnterForegroundNotification, object: nil)
|
|
NotificationCenter.default.removeObserver(self, name: NSNotification.Name(rawValue: K.NotificationCenterReloads.reloadTheme), object: nil)
|
|
NotificationCenter.default.removeObserver(self, name: NSNotification.Name(rawValue: K.NotificationCenterReloads.themeOnePush), object: nil)
|
|
}
|
|
|
|
override func viewDidLoad() {
|
|
super.viewDidLoad()
|
|
vm.vc = self
|
|
vm.initView()
|
|
// connectedToNetwork()
|
|
}
|
|
|
|
override func viewWillDisappear(_ animated: Bool) {
|
|
vm.shouldAnimate = false
|
|
if let player = vm.avPlayer{
|
|
player.pause()
|
|
}
|
|
}
|
|
|
|
override func viewDidAppear(_ animated: Bool) {
|
|
vm.shouldAnimate = true
|
|
K.GVar.topView = .theme1
|
|
vm.moveLiveTVView()
|
|
if let player = vm.avPlayer{
|
|
player.play()
|
|
}
|
|
}
|
|
|
|
override func viewDidLayoutSubviews() {
|
|
vm.setupAvPlayer()
|
|
vm.handleBackground()
|
|
}
|
|
|
|
// Define a function to customize tab bar item icon size
|
|
func customizeTabBarItemIconSize() {
|
|
// Get a reference to the tab bar controller
|
|
if let tabBarController = self.tabBarController {
|
|
// Loop through each tab bar item
|
|
for item in tabBarController.tabBar.items! {
|
|
// Adjust the image insets to increase the icon size
|
|
item.imageInsets = UIEdgeInsets(top: 2, left: -5, bottom: -8, right: -5)
|
|
item.titlePositionAdjustment.vertical = CGFloat(8)
|
|
}
|
|
}
|
|
}
|
|
|
|
@IBAction func barButtonTapped(_ sender: UIButton) {
|
|
self.sideMenuController?.revealMenu()
|
|
}
|
|
|
|
@IBAction func notificationBtnTapped(_ sender: UIButton) {
|
|
CommonNwCall.shareInstance.getUserNotification(vc: self) { isDone in
|
|
if isDone{
|
|
let sb = UIStoryboard(name: K.StoryBoard.theme, bundle: nil)
|
|
let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.Home.userNotificationVC) as! UserNotificationVC
|
|
self.navigationController?.pushViewController(vcPush, animated: true)
|
|
}
|
|
}
|
|
}
|
|
|
|
@IBAction func radioBtnTapped(_ sender: UIButton) {
|
|
let sb = UIStoryboard(name: K.StoryBoard.theme, bundle: nil)
|
|
let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.Theme.radioVC) as! RadioVC
|
|
vcPush.modalPresentationStyle = .overCurrentContext
|
|
vcPush.modalTransitionStyle = .crossDissolve
|
|
self.present(vcPush, animated: true)
|
|
}
|
|
}
|
|
|
|
|
|
class NavigationController: UINavigationController {
|
|
|
|
open override var childForStatusBarHidden: UIViewController? {
|
|
return self.topViewController
|
|
}
|
|
|
|
open override var childForStatusBarStyle: UIViewController? {
|
|
return self.topViewController
|
|
}
|
|
}
|
|
|
|
|
|
extension UINavigationController {
|
|
func pushWithPopInAnimation(_ viewController: UIViewController, duration: CFTimeInterval = 0.3) {
|
|
let transition = CATransition()
|
|
transition.duration = duration
|
|
transition.type = CATransitionType.push
|
|
transition.subtype = CATransitionSubtype.fromRight
|
|
|
|
// Customize the animation to look like a "pop-in"
|
|
transition.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeInEaseOut)
|
|
|
|
self.view.layer.add(transition, forKey: kCATransition)
|
|
self.pushViewController(viewController, animated: false)
|
|
}
|
|
}
|