- Resized the images - Added Icon coloring dynamically - Fixed issue of constraint breaking for Season Cells - Fixed issue of TableHeight - Updated MyList Icons, also modified the click handler - Fixed the issue of favourite remove in my list screen - finalised mylist refresh, when user goes from mylist to seasons.
106 lines
3.3 KiB
Swift
106 lines
3.3 KiB
Swift
//
|
|
// FavouriteCell.swift
|
|
// WOKA
|
|
//
|
|
// Created by MacBook Pro on 13/06/24.
|
|
//
|
|
|
|
import UIKit
|
|
|
|
enum FavCellCLick{
|
|
case favourite
|
|
case liked
|
|
}
|
|
|
|
class FavouriteCell: UICollectionViewCell {
|
|
|
|
@IBOutlet weak var cellImage: UIImageView!
|
|
@IBOutlet weak var cellTitle: UILabel!
|
|
@IBOutlet weak var likeBtn: UIButton!
|
|
@IBOutlet weak var favBtnn: UIButton!
|
|
@IBOutlet weak var totalLikes: UILabel!
|
|
|
|
typealias btnTappedBlock = ( _ from : FavCellCLick) -> Void // 0 - plus 1 - minus
|
|
var btnTapped : btnTappedBlock!
|
|
|
|
override func awakeFromNib() {
|
|
super.awakeFromNib()
|
|
// Initialization code
|
|
}
|
|
|
|
@IBAction func favouriteBtnTapped(_ sender: UIButton) {
|
|
if btnTapped != nil {
|
|
btnTapped( .favourite)
|
|
}
|
|
}
|
|
|
|
@IBAction func likeBtnTapped(_ sender: UIButton) {
|
|
if btnTapped != nil {
|
|
btnTapped( .liked)
|
|
}
|
|
}
|
|
|
|
func setData(data : FavouriteListingDM.ResultData.ShowDatum){
|
|
//heart.fill , heart , hand.thumbsup.fill , hand.thumbsup
|
|
if AuthFunc.shareInstance.getDefaultLanguage() == .english{
|
|
cellTitle.text = data.contentMoreDetails?.filter({$0.languageMasterID == 1}).first?.title
|
|
}else{
|
|
cellTitle.text = data.contentMoreDetails?.filter({$0.languageMasterID == 2}).first?.title
|
|
}
|
|
totalLikes.text = data.likesCount?.toString() ?? "0"
|
|
|
|
if let url = data.thumbnailPath{
|
|
cellImage.imageURL(url)
|
|
}
|
|
|
|
if let favourite = data.markAsFavourite{
|
|
switch favourite{
|
|
case true:
|
|
favBtnn.setImage(UIImage(named: "FavouriteAdd"), for: .normal)
|
|
case false:
|
|
favBtnn.setImage(UIImage(named: "FavouriteRemove"), for: .normal)
|
|
}
|
|
}
|
|
|
|
if let like = data.isLiked{
|
|
switch like{
|
|
case true:
|
|
likeBtn.setImage(UIImage(named: "LikeAdd"), for: .normal)
|
|
case false:
|
|
likeBtn.setImage(UIImage(named: "LikeRemove"), for: .normal)
|
|
}
|
|
}
|
|
}
|
|
|
|
func setOtherData(data : FavouriteListingDM.ResultData.Datum){
|
|
//heart.fill , heart , hand.thumbsup.fill , hand.thumbsup
|
|
if AuthFunc.shareInstance.getDefaultLanguage() == .english{
|
|
cellTitle.text = data.contentMoreDetails?.filter({$0.languageMasterID == 1}).first?.title
|
|
}else{
|
|
cellTitle.text = data.contentMoreDetails?.filter({$0.languageMasterID == 2}).first?.title
|
|
}
|
|
totalLikes.text = data.likesCount?.toString() ?? "0"
|
|
if let url = data.thumbnailPath{
|
|
cellImage.imageURL(url)
|
|
}
|
|
|
|
if let favourite = data.markAsFavourite{
|
|
switch favourite{
|
|
case true:
|
|
favBtnn.setImage(UIImage(named: "FavouriteAdd"), for: .normal)
|
|
case false:
|
|
favBtnn.setImage(UIImage(named: "FavouriteRemove"), for: .normal)
|
|
}
|
|
}
|
|
|
|
if let like = data.isLiked{
|
|
switch like{
|
|
case true:
|
|
likeBtn.setImage(UIImage(named: "LikeAdd"), for: .normal)
|
|
case false:
|
|
likeBtn.setImage(UIImage(named: "LikeRemove"), for: .normal)
|
|
}
|
|
}
|
|
}
|
|
}
|