Files
Woka_Native_iOS/WOKA/Theme/Controller/UserNotificationVC.swift
BilalKhanWDI 1d6add0322 - Added DropDown
- Added api for show listing , made data model, updated the dropdown
- Added api for category, made data model
- Made the dynamic height tableview to show all the shows
- On fav add remove , will refresh the mylist screen
- Added default load on hindi
- On category selection change, updating the show list data
- Handled the fav category id as int, string , string seeprated with “,”
- Modifying my list with bookmark id with above
2024-06-19 20:07:47 +05:30

82 lines
3.1 KiB
Swift

//
// UserNotificationVC.swift
// WOKA
//
// Created by MacBook Pro on 13/06/24.
//
import UIKit
class UserNotificationVC: UIViewController {
@IBOutlet weak var tableView: UITableView!
let refreshControl = UIRefreshControl()
let feedbackGenerator = UIImpactFeedbackGenerator(style: .light)
override func viewDidLoad() {
super.viewDidLoad()
let color1 = #colorLiteral(red: 0.05490196078, green: 0.01176470588, blue: 0.3882352941, alpha: 1)
let color2 = #colorLiteral(red: 0.2041364683, green: 0.156624428, blue: 0.5904380268, alpha: 1)
self.view.applyMultiGradient(colors: [color1, color2,color1], startPoint: CGPoint(x: 0, y: 0), endPoint: CGPoint(x: 0, y: 0.8))
self.title = "NOTIFICATIONS"
setupCell()
navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default)
navigationController?.navigationBar.shadowImage = UIImage()
//Adding pull to Refresh
refreshControl.attributedTitle = NSAttributedString(string: "Refreshing...",attributes: [.foregroundColor: UIColor.white])
refreshControl.tintColor = .white
refreshControl.addTarget(self, action: #selector(self.refresh(_:)), for: .valueChanged)
tableView.addSubview(refreshControl)
}
// MARK: - Pull to refresh
@objc func refresh(_ sender: AnyObject) {
CommonNwCall.shareInstance.getUserNotification(vc: self,isRefreshing: true) { [weak self] isDone in
guard let self else{return}
feedbackGenerator.impactOccurred()
tableView.reloadData()
refreshControl.endRefreshing()
}
}
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)
}
func setupCell(){
tableView.register(UINib(nibName: K.CellIdentifier.Home.userNotificationCell, bundle: nil), forCellReuseIdentifier: K.CellIdentifier.Home.userNotificationCell)
tableView.delegate = self
tableView.dataSource = self
}
}
// MARK: - TableView DataSource , Delegates
extension UserNotificationVC : TableViewSRC{
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return CommonNwCall.shareInstance.userNotification.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: K.CellIdentifier.Home.userNotificationCell) as! UserNotificationCell
let data = CommonNwCall.shareInstance.userNotification[indexPath.row]
cell.setData(data: data)
return cell
}
}