Files
Woka_Native_iOS/WOKA/Theme/Controller/UserNotificationVC.swift
BilalKhanWDI d17fe416ae - My list Audio books on add remove fav, only calling audiobooks api and reloading in background
- My list Games on add remove fav, only calling Games api and reloading in background
- My list Karaoke on add remove fav, only calling Karaoke api and reloading in background
-Finalised clicks count for every module
2024-08-12 19:58:58 +05:30

100 lines
3.8 KiB
Swift

//
// UserNotificationVC.swift
// WOKA
//
// Created by MacBook Pro on 13/06/24.
//
import UIKit
class UserNotificationVC: UIViewController {
@IBOutlet weak var tableView: UITableView!
@IBOutlet weak var noDataStack: UIStackView!
var vm = UserNotificationVM()
override func viewDidLoad() {
super.viewDidLoad()
vm.vc = self
vm.initView()
navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default)
navigationController?.navigationBar.shadowImage = UIImage()
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
navigationController?.setNavigationBarHidden(false, animated: animated)
self.navigationController?.setColor(color: .white)
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
self.navigationController?.setNavigationBarHidden(true, animated: animated)
// Customize the navigation bar's appearance
self.navigationController?.setColor(color: .black)
if self.isMovingFromParent {
// Back button was pressed
PersistentStorage.shared.addOthersCount()
}
}
@IBAction func retryBtnTapped(_ sender: UIButton) {
PersistentStorage.shared.addOthersCount()
}
}
// MARK: - TableView DataSource , Delegates
extension UserNotificationVC : TableViewSRC{
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return vm.userNotification.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: K.CellIdentifier.Home.userNotificationCell) as! UserNotificationCell
let data = vm.userNotification[indexPath.row]
cell.setData(data: data)
return cell
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
PersistentStorage.shared.addOthersCount()
if let type = vm.userNotification[indexPath.row].postType{
switch type{
case 1,2,3,4:
let sb = UIStoryboard(name: K.StoryBoard.webSeries, bundle: nil)
let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.WebSeries.webSeriesVC) as! WebSeriesVC
self.navigationController?.pushViewController(vcPush, animated: true)
case 6:
let sb = UIStoryboard(name: K.StoryBoard.Games, bundle: nil)
let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.Games.gamesListVC) as! GamesListVC
self.navigationController?.pushViewController(vcPush, animated: true)
case 7:
let sb = UIStoryboard(name: K.StoryBoard.audioBooks, bundle: nil)
let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.AudioBooks.audioBookHomeVC) as! AudioBookHomeVC
self.navigationController?.pushViewController(vcPush, animated: true)
case 8:
let sb = UIStoryboard(name: K.StoryBoard.Karaoke, bundle: nil)
let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.Karaoke.karaokeListingVC) as! KaraokeListingVC
self.navigationController?.pushViewController(vcPush, animated: true)
case 9:
let sb = UIStoryboard(name: K.StoryBoard.shop, bundle: nil)
let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.Shop.shopListingVC) as! ShopListingVC
self.navigationController?.pushViewController(vcPush, animated: true)
default:
break
}
}
}
}