updated the likes and fav

This commit is contained in:
Bilal
2024-08-04 12:20:12 +05:30
parent e97c7e56f4
commit c8ec96a832
9 changed files with 49 additions and 25 deletions

View File

@@ -28,7 +28,6 @@ class ExploreWokaVC: UIViewController {
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
drawBackgroundBlur() drawBackgroundBlur()
} }
override func viewDidLayoutSubviews() { override func viewDidLayoutSubviews() {

View File

@@ -70,12 +70,8 @@ class MyListVC: UIViewController{
K.GVar.topView = .myList K.GVar.topView = .myList
if K.GVar.myListSoftReload{ if K.GVar.myListSoftReload{
self.webSeriesCV.reloadData() vm.reloadCollections()
self.webSeriesHindiCV.reloadData() vm.checkNil()
self.audioBooksCV.reloadData()
self.karaokeCV.reloadData()
self.gamesCV.reloadData()
self.vm.checkNil()
K.GVar.myListSoftReload = false K.GVar.myListSoftReload = false
} }
@@ -134,7 +130,7 @@ extension MyListVC : CollectionViewSRC{
} }
return MyListDataTemp.shareInstance.favListingData?.gameData?.count ?? 0 return MyListDataTemp.shareInstance.favListingData?.gameData?.count ?? 0
case webSeriesHindiCV: case webSeriesHindiCV:
if MyListDataTemp.shareInstance.webSeriesHindi.count == 0 || MyListDataTemp.shareInstance.favListingData == nil{ if MyListDataTemp.shareInstance.webSeriesHindi.count == 0{
webSeriesHindiStack.isHidden = true webSeriesHindiStack.isHidden = true
}else{ }else{
webSeriesHindiStack.isHidden = false webSeriesHindiStack.isHidden = false

View File

@@ -798,7 +798,7 @@
</subviews> </subviews>
<userDefinedRuntimeAttributes> <userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius"> <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
<integer key="value" value="10"/> <integer key="value" value="20"/>
</userDefinedRuntimeAttribute> </userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes> </userDefinedRuntimeAttributes>
</stackView> </stackView>
@@ -830,11 +830,6 @@
<constraint firstAttribute="width" constant="220" id="KZf-jN-jCA"/> <constraint firstAttribute="width" constant="220" id="KZf-jN-jCA"/>
<constraint firstItem="iPr-OV-7V5" firstAttribute="leading" secondItem="DNc-fQ-fy8" secondAttribute="leading" id="sSk-em-jlT"/> <constraint firstItem="iPr-OV-7V5" firstAttribute="leading" secondItem="DNc-fQ-fy8" secondAttribute="leading" id="sSk-em-jlT"/>
</constraints> </constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
<integer key="value" value="20"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</view> </view>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="P1N-m9-rvT"> <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="P1N-m9-rvT">
<rect key="frame" x="183.66666666666666" y="835.66666666666663" width="62.666666666666657" height="62.333333333333371"/> <rect key="frame" x="183.66666666666666" y="835.66666666666663" width="62.666666666666657" height="62.333333333333371"/>
@@ -1396,10 +1391,10 @@
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> <color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor> </systemColor>
<systemColor name="systemGreenColor"> <systemColor name="systemGreenColor">
<color red="0.20392156862745098" green="0.7803921568627451" blue="0.34901960784313724" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color red="0.20392156859999999" green="0.78039215689999997" blue="0.34901960780000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor> </systemColor>
<systemColor name="systemMintColor"> <systemColor name="systemMintColor">
<color red="0.0" green="0.7803921568627451" blue="0.74509803921568629" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color red="0.0" green="0.78039215689999997" blue="0.74509803919999995" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor> </systemColor>
</resources> </resources>
</document> </document>

View File

@@ -77,7 +77,8 @@ struct FavouriteListingDM: Codable {
let thumbnailPath: String? let thumbnailPath: String?
let showType: String? let showType: String?
let totalSeasons, totalEpisodes: Int? let totalSeasons, totalEpisodes: Int?
let categoryMasterID, ageRangeMasterID, genderMasterID: String? let ageRangeMasterID, genderMasterID: String?
var categoryMasterID : String?
let contentMoreDetails: [WebSeriesShowListDM.MoreDetail]? let contentMoreDetails: [WebSeriesShowListDM.MoreDetail]?
var markAsFavourite, isLiked: Bool? var markAsFavourite, isLiked: Bool?
var likesCount : Int? var likesCount : Int?

View File

@@ -130,6 +130,12 @@ class MyListVM{
self.vc.toast(msg: data.message ?? "Unrecognised error" , time: 2) self.vc.toast(msg: data.message ?? "Unrecognised error" , time: 2)
MyListDataTemp.shareInstance.webSeriesHindi.removeAll() MyListDataTemp.shareInstance.webSeriesHindi.removeAll()
MyListDataTemp.shareInstance.favListingData = nil MyListDataTemp.shareInstance.favListingData = nil
// make this true if mylist is loaded once
MyListDataTemp.shareInstance.isDatafetched = true
if MyListDataTemp.shareInstance.favListingData?.showData == nil {
MyListDataTemp.shareInstance.favListingData = FavouriteListingDM.ResultData(showData: [], videoData: [], gameData: [], singKaraokeData: [], audioData: [])
}
reloadCollections() reloadCollections()
checkNil() checkNil()
case 1: case 1:
@@ -152,6 +158,7 @@ class MyListVM{
}.map { element -> FavouriteListingDM.ResultData.ShowDatum in }.map { element -> FavouriteListingDM.ResultData.ShowDatum in
var modifiedElement = element var modifiedElement = element
modifiedElement.bookmarkCategoryIDS = "18" modifiedElement.bookmarkCategoryIDS = "18"
modifiedElement.categoryMasterID = "18"
return modifiedElement return modifiedElement
} }
@@ -182,7 +189,12 @@ class MyListVM{
// Updating the showData with the filtered list // Updating the showData with the filtered list
MyListDataTemp.shareInstance.favListingData?.showData = hindiData // MyListDataTemp.shareInstance.favListingData?.showData = hindiData.map({$0.categoryMasterID = 1})
MyListDataTemp.shareInstance.favListingData?.showData = hindiData.map { item in
var modifiedItem = item
modifiedItem.categoryMasterID = "1"
return modifiedItem
}
// make this true if mylist is loaded once // make this true if mylist is loaded once
MyListDataTemp.shareInstance.isDatafetched = true MyListDataTemp.shareInstance.isDatafetched = true
@@ -198,6 +210,9 @@ class MyListVM{
self.refreshControl.endRefreshing() self.refreshControl.endRefreshing()
Utilities.dismissProgressHUD() Utilities.dismissProgressHUD()
checkNil() checkNil()
if MyListDataTemp.shareInstance.favListingData?.showData == nil {
MyListDataTemp.shareInstance.favListingData = FavouriteListingDM.ResultData(showData: [], videoData: [], gameData: [], singKaraokeData: [], audioData: [])
}
self.vc.toast(msg: error.localizedDescription , time: 2) self.vc.toast(msg: error.localizedDescription , time: 2)
} }
} }
@@ -307,10 +322,16 @@ class MyListVM{
} }
func checkNil(){ func checkNil(){
guard let data = MyListDataTemp.shareInstance.favListingData else{
self.vc.noDataStack.isHidden = false guard let data = MyListDataTemp.shareInstance.favListingData else{
if MyListDataTemp.shareInstance.webSeriesHindi.count != 0 {
self.vc.noDataStack.isHidden = true
}else{
self.vc.noDataStack.isHidden = false
}
return return
} }
if data.showData?.count == 0 && data.singKaraokeData?.count == 0 && data.gameData?.count == 0 && data.audioData?.count == 0 && MyListDataTemp.shareInstance.webSeriesHindi.count == 0{ if data.showData?.count == 0 && data.singKaraokeData?.count == 0 && data.gameData?.count == 0 && data.audioData?.count == 0 && MyListDataTemp.shareInstance.webSeriesHindi.count == 0{
self.vc.noDataStack.isHidden = false self.vc.noDataStack.isHidden = false
}else{ }else{

View File

@@ -66,6 +66,10 @@ class ThemeOneVC: UIViewController {
super.viewDidLoad() super.viewDidLoad()
vm.vc = self vm.vc = self
vm.initView() vm.initView()
if MyListDataTemp.shareInstance.favListingData?.showData == nil {
MyListDataTemp.shareInstance.favListingData = FavouriteListingDM.ResultData(showData: [], videoData: [], gameData: [], singKaraokeData: [], audioData: [])
}
// connectedToNetwork() // connectedToNetwork()
} }

View File

@@ -35,6 +35,10 @@ class ThemeTwoVC: UIViewController {
guard let self else{return} guard let self else{return}
self.vm.playLiveTV() self.vm.playLiveTV()
} }
if MyListDataTemp.shareInstance.favListingData?.showData == nil {
MyListDataTemp.shareInstance.favListingData = FavouriteListingDM.ResultData(showData: [], videoData: [], gameData: [], singKaraokeData: [], audioData: [])
}
} }
override func viewWillAppear(_ animated: Bool) { override func viewWillAppear(_ animated: Bool) {

View File

@@ -161,14 +161,15 @@ extension WebSeriesVC : TableViewSRC{
// Update for mylist // Update for mylist
if let id = vm.categoryListingData[vm.dropDownModule.indexForSelectedRow ?? 0].id{ if let id = vm.categoryListingData[vm.dropDownModule.indexForSelectedRow ?? 0].id{
if id == 1{ // english if id == 1{ // english
K.GVar.myListSoftReload = true if !MyListDataTemp.shareInstance.isDatafetched {return}
let showData = vm.showData[index] let showData = vm.showData[index]
MyListDataTemp.shareInstance.favListingData?.showData?.append(FavouriteListingDM.ResultData.ShowDatum(id: showData.id, title: showData.title, description: showData.description, thumbnailPath: showData.thumbnailPath, showType: showData.showType, totalSeasons: showData.totalSeasons, totalEpisodes: showData.totalEpisodes, categoryMasterID: showData.categoryMasterID, ageRangeMasterID: showData.ageRangeMasterID, genderMasterID: showData.genderMasterID, contentMoreDetails: showData.contentMoreDetails, markAsFavourite: showData.markAsFavourite, isLiked: showData.isLiked, likesCount: showData.likesCount, viewsCount: showData.viewsCount, bookmarkCount: showData.bookmarkCount, bookmarkCategoryIDS: "1")) MyListDataTemp.shareInstance.favListingData?.showData?.append(FavouriteListingDM.ResultData.ShowDatum(id: showData.id, title: showData.title, description: showData.description, thumbnailPath: showData.thumbnailPath, showType: showData.showType, totalSeasons: showData.totalSeasons, totalEpisodes: showData.totalEpisodes, ageRangeMasterID: showData.ageRangeMasterID, genderMasterID: showData.genderMasterID, categoryMasterID: "1", contentMoreDetails: showData.contentMoreDetails, markAsFavourite: showData.markAsFavourite, isLiked: showData.isLiked, likesCount: showData.likesCount, viewsCount: showData.viewsCount, bookmarkCount: showData.bookmarkCount, bookmarkCategoryIDS: "1"))
K.GVar.myListSoftReload = true
}else{ // hindi }else{ // hindi
// return if the data is not fetched. IT means user has not loaded mylist yet // return if the data is not fetched. IT means user has not loaded mylist yet
if !MyListDataTemp.shareInstance.isDatafetched {return} if !MyListDataTemp.shareInstance.isDatafetched {return}
let showData = vm.showData[index] let showData = vm.showData[index]
MyListDataTemp.shareInstance.webSeriesHindi.append(FavouriteListingDM.ResultData.ShowDatum(id: showData.id, title: showData.title, description: showData.description, thumbnailPath: showData.thumbnailPath, showType: showData.showType, totalSeasons: showData.totalSeasons, totalEpisodes: showData.totalEpisodes, categoryMasterID: showData.categoryMasterID, ageRangeMasterID: showData.ageRangeMasterID, genderMasterID: showData.genderMasterID, contentMoreDetails: showData.contentMoreDetails, markAsFavourite: showData.markAsFavourite, isLiked: showData.isLiked, likesCount: showData.likesCount, viewsCount: showData.viewsCount, bookmarkCount: showData.bookmarkCount, bookmarkCategoryIDS: "18")) MyListDataTemp.shareInstance.webSeriesHindi.append(FavouriteListingDM.ResultData.ShowDatum(id: showData.id, title: showData.title, description: showData.description, thumbnailPath: showData.thumbnailPath, showType: showData.showType, totalSeasons: showData.totalSeasons, totalEpisodes: showData.totalEpisodes, ageRangeMasterID: showData.ageRangeMasterID, genderMasterID: showData.genderMasterID, categoryMasterID: "18", contentMoreDetails: showData.contentMoreDetails, markAsFavourite: showData.markAsFavourite, isLiked: showData.isLiked, likesCount: showData.likesCount, viewsCount: showData.viewsCount, bookmarkCount: showData.bookmarkCount, bookmarkCategoryIDS: "18"))
K.GVar.myListSoftReload = true K.GVar.myListSoftReload = true
} }
} }

View File

@@ -74,11 +74,14 @@ class WebSeriesSeasonVM{
if self.categoryID == 18{ // hindi if self.categoryID == 18{ // hindi
guard let showData = self.showData else{return} guard let showData = self.showData else{return}
MyListDataTemp.shareInstance.webSeriesHindi.append(FavouriteListingDM.ResultData.ShowDatum(id: showData.id, title: showData.title, description: showData.description, thumbnailPath: showData.thumbnailPath, showType: showData.showType, totalSeasons: showData.totalSeasons, totalEpisodes: showData.totalEpisodes, categoryMasterID: showData.categoryMasterID, ageRangeMasterID: showData.ageRangeMasterID, genderMasterID: showData.genderMasterID, contentMoreDetails: showData.contentMoreDetails, markAsFavourite: showData.markAsFavourite, isLiked: showData.isLiked, likesCount: showData.likesCount, viewsCount: showData.viewsCount, bookmarkCount: showData.bookmarkCount, bookmarkCategoryIDS: "18")) MyListDataTemp.shareInstance.webSeriesHindi.append(FavouriteListingDM.ResultData.ShowDatum(id: showData.id, title: showData.title, description: showData.description, thumbnailPath: showData.thumbnailPath, showType: showData.showType, totalSeasons: showData.totalSeasons, totalEpisodes: showData.totalEpisodes, ageRangeMasterID: showData.ageRangeMasterID, genderMasterID: showData.genderMasterID, categoryMasterID: self.categoryID?.toString(), contentMoreDetails: showData.contentMoreDetails, markAsFavourite: showData.markAsFavourite, isLiked: showData.isLiked, likesCount: showData.likesCount, viewsCount: showData.viewsCount, bookmarkCount: showData.bookmarkCount, bookmarkCategoryIDS: "18"))
K.GVar.myListSoftReload = true K.GVar.myListSoftReload = true
}else{ // english }else{ // english
guard let showData = self.showData else{return} guard let showData = self.showData else{return}
MyListDataTemp.shareInstance.favListingData?.showData?.append(FavouriteListingDM.ResultData.ShowDatum(id: showData.id, title: showData.title, description: showData.description, thumbnailPath: showData.thumbnailPath, showType: showData.showType, totalSeasons: showData.totalSeasons, totalEpisodes: showData.totalEpisodes, categoryMasterID: showData.categoryMasterID, ageRangeMasterID: showData.ageRangeMasterID, genderMasterID: showData.genderMasterID, contentMoreDetails: showData.contentMoreDetails, markAsFavourite: showData.markAsFavourite, isLiked: showData.isLiked, likesCount: showData.likesCount, viewsCount: showData.viewsCount, bookmarkCount: showData.bookmarkCount, bookmarkCategoryIDS: "1")) if MyListDataTemp.shareInstance.favListingData?.showData == nil {
MyListDataTemp.shareInstance.favListingData?.showData = []
}
MyListDataTemp.shareInstance.favListingData?.showData?.append(FavouriteListingDM.ResultData.ShowDatum(id: showData.id, title: showData.title, description: showData.description, thumbnailPath: showData.thumbnailPath, showType: showData.showType, totalSeasons: showData.totalSeasons, totalEpisodes: showData.totalEpisodes, ageRangeMasterID: showData.ageRangeMasterID, genderMasterID: showData.genderMasterID, categoryMasterID: self.categoryID?.toString(), contentMoreDetails: showData.contentMoreDetails, markAsFavourite: showData.markAsFavourite, isLiked: showData.isLiked, likesCount: showData.likesCount, viewsCount: showData.viewsCount, bookmarkCount: showData.bookmarkCount, bookmarkCategoryIDS: "1"))
K.GVar.myListSoftReload = true K.GVar.myListSoftReload = true
} }
} }