- My list audio listing, handled the model.
- Added lazy loading for karaoke - Completed lazy loading of audio books
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
import UIKit
|
||||
|
||||
protocol ReloadAudioBooksFavLike{
|
||||
func updateRows(id : Int, type : FavCellCLick, isFav : Bool? , isLike : Bool? )
|
||||
func updateAudioRows(id : Int, type : FavCellCLick, isFav : Bool? , isLike : Bool? )
|
||||
}
|
||||
|
||||
class AudioBookDetailsVC : UIViewController{
|
||||
@@ -54,14 +54,14 @@ class AudioBookDetailsVC : UIViewController{
|
||||
LikeFavCommonFunc.shareInstance.removeFavourite(postID: showID, postType: postType, categoryID: 0, vc: self) { isDone in
|
||||
self.audioData?.markAsFavourite = false
|
||||
K.GVar.reloadMyList = true
|
||||
self.delegate?.updateRows(id: showID, type: .favourite, isFav: false, isLike: nil)
|
||||
self.delegate?.updateAudioRows(id: showID, type: .favourite, isFav: false, isLike: nil)
|
||||
self.initView()
|
||||
}
|
||||
}else{
|
||||
LikeFavCommonFunc.shareInstance.addFavourite(postID: showID, postType: postType, categoryID: 0, vc: self) { isDone in
|
||||
self.audioData?.markAsFavourite = true
|
||||
K.GVar.reloadMyList = true
|
||||
self.delegate?.updateRows(id: showID, type: .favourite, isFav: true, isLike: nil)
|
||||
self.delegate?.updateAudioRows(id: showID, type: .favourite, isFav: true, isLike: nil)
|
||||
self.initView()
|
||||
}
|
||||
}
|
||||
@@ -74,14 +74,14 @@ class AudioBookDetailsVC : UIViewController{
|
||||
LikeFavCommonFunc.shareInstance.removeFavourite(postID: showID, postType: postType, categoryID: 0, vc: self) { isDone in
|
||||
self.continueAudioData?.markAsFavourite = false
|
||||
K.GVar.reloadMyList = true
|
||||
self.delegate?.updateRows(id: showID, type: .favourite, isFav: false, isLike: nil)
|
||||
self.delegate?.updateAudioRows(id: showID, type: .favourite, isFav: false, isLike: nil)
|
||||
self.initView()
|
||||
}
|
||||
}else{
|
||||
LikeFavCommonFunc.shareInstance.addFavourite(postID: showID, postType: postType, categoryID: 0, vc: self) { isDone in
|
||||
self.continueAudioData?.markAsFavourite = true
|
||||
K.GVar.reloadMyList = true
|
||||
self.delegate?.updateRows(id: showID, type: .favourite, isFav: true, isLike: nil)
|
||||
self.delegate?.updateAudioRows(id: showID, type: .favourite, isFav: true, isLike: nil)
|
||||
self.initView()
|
||||
}
|
||||
}
|
||||
@@ -100,14 +100,14 @@ class AudioBookDetailsVC : UIViewController{
|
||||
LikeFavCommonFunc.shareInstance.unlikePost(postID: showID, postType: postType, vc: self) { isDone in
|
||||
self.audioData?.isLiked = false
|
||||
K.GVar.reloadMyList = true
|
||||
self.delegate?.updateRows(id: showID, type: .liked, isFav: nil, isLike: false)
|
||||
self.delegate?.updateAudioRows(id: showID, type: .liked, isFav: nil, isLike: false)
|
||||
self.initView()
|
||||
}
|
||||
}else{
|
||||
LikeFavCommonFunc.shareInstance.likePost(postID: showID, postType: postType, vc: self) { isDone in
|
||||
self.audioData?.isLiked = true
|
||||
K.GVar.reloadMyList = true
|
||||
self.delegate?.updateRows(id: showID, type: .liked, isFav: nil, isLike: true)
|
||||
self.delegate?.updateAudioRows(id: showID, type: .liked, isFav: nil, isLike: true)
|
||||
self.initView()
|
||||
}
|
||||
}
|
||||
@@ -120,14 +120,14 @@ class AudioBookDetailsVC : UIViewController{
|
||||
LikeFavCommonFunc.shareInstance.unlikePost(postID: showID, postType: postType, vc: self) { isDone in
|
||||
self.continueAudioData?.isLiked = false
|
||||
K.GVar.reloadMyList = true
|
||||
self.delegate?.updateRows(id: showID, type: .liked, isFav: nil, isLike: false)
|
||||
self.delegate?.updateAudioRows(id: showID, type: .liked, isFav: nil, isLike: false)
|
||||
self.initView()
|
||||
}
|
||||
}else{
|
||||
LikeFavCommonFunc.shareInstance.likePost(postID: showID, postType: postType, vc: self) { isDone in
|
||||
self.continueAudioData?.isLiked = true
|
||||
K.GVar.reloadMyList = true
|
||||
self.delegate?.updateRows(id: showID, type: .liked, isFav: nil, isLike: true)
|
||||
self.delegate?.updateAudioRows(id: showID, type: .liked, isFav: nil, isLike: true)
|
||||
self.initView()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,9 @@ class AudioBookHomeVC: UIViewController {
|
||||
@IBOutlet weak var headerTitleLabel: UILabel!
|
||||
@IBOutlet weak var listenView: ShimmerEffectView!
|
||||
|
||||
@IBOutlet weak var loadMoreBtn: LocalisedElementsButton!
|
||||
@IBOutlet weak var loadMoreActivityIndicator: UIActivityIndicatorView!
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
vm.vc = self
|
||||
@@ -62,6 +65,13 @@ class AudioBookHomeVC: UIViewController {
|
||||
vm.updateTableHeight()
|
||||
}
|
||||
|
||||
@IBAction func loadMoreBtn(_ sender: LocalisedElementsButton) {
|
||||
loadMoreBtn.isHidden = true
|
||||
vm.pageNo += 1
|
||||
loadMoreActivityIndicator.startAnimating()
|
||||
vm.getShowListing()
|
||||
}
|
||||
|
||||
@IBAction func listenAudioBtnTapped(_ sender: LocalisedElementsButton) {
|
||||
let data = vm.audioListData[vm.indexToLoad]
|
||||
var playerItems = [JwPlayerItemCreate]()
|
||||
@@ -82,7 +92,7 @@ class AudioBookHomeVC: UIViewController {
|
||||
|
||||
extension AudioBookHomeVC : ReloadAudioBooksFavLike{
|
||||
|
||||
func updateRows(id: Int, type: FavCellCLick, isFav: Bool?, isLike: Bool?) {
|
||||
func updateAudioRows(id: Int, type: FavCellCLick, isFav: Bool?, isLike: Bool?) {
|
||||
if let isFav{
|
||||
if let continueDataIndex = vm.continueWatchingData.firstIndex(where:{$0.id == id}) {
|
||||
vm.continueWatchingData[continueDataIndex].markAsFavourite = isFav
|
||||
|
||||
@@ -14,7 +14,8 @@ class AudioBookHomeVM{
|
||||
var continueWatchingData = [ContinueAudioListDM.ResultData]()
|
||||
var audioListData = [ListenAudioListingDM.AudioDatum]()
|
||||
var indexToLoad = 0
|
||||
|
||||
var pageNo = 0
|
||||
|
||||
func initView(){
|
||||
startShimmer()
|
||||
setupCell()
|
||||
@@ -111,7 +112,10 @@ class AudioBookHomeVM{
|
||||
func getShowListing(){
|
||||
// Utilities.startProgressHUD()
|
||||
let headers : HTTPHeaders = ["access-token" : AuthFunc.shareInstance.getAccessToken()]
|
||||
NetworkManager.shareInstance.apiRequest(url: APIEndPoints.AudioBooks.listen_audio_listing, method: .post,headers: headers) { [weak self](result : Result<BaseResponseModel<ListenAudioListingDM>, NetworkManager.APIError>) in
|
||||
let params : Parameters = ["api_version" : "v2",
|
||||
"start" : pageNo,
|
||||
"limit": 10]
|
||||
NetworkManager.shareInstance.apiRequest(url: APIEndPoints.AudioBooks.listen_audio_listing, method: .post, parameters: params,headers: headers) { [weak self](result : Result<BaseResponseModel<ListenAudioListingDM>, NetworkManager.APIError>) in
|
||||
switch result{
|
||||
case .success(let data):
|
||||
guard let self else{
|
||||
@@ -128,8 +132,7 @@ class AudioBookHomeVM{
|
||||
case 1:
|
||||
Utilities.dismissProgressHUD()
|
||||
guard let data = data.data?.audioData else{return}
|
||||
self.audioListData.removeAll()
|
||||
self.audioListData = data
|
||||
self.audioListData.append(contentsOf: data)
|
||||
self.vc.audioListingTableView.reloadData()
|
||||
self.vc.tableHeight.constant = self.vc.audioListingTableView.contentSize.height + 100
|
||||
self.vc.audioListingTableView.layoutIfNeeded()
|
||||
@@ -137,6 +140,16 @@ class AudioBookHomeVM{
|
||||
self.indexToLoad = 0
|
||||
self.setInitialData()
|
||||
self.stopShimmer()
|
||||
|
||||
self.vc.loadMoreActivityIndicator.stopAnimating()
|
||||
self.vc.loadMoreActivityIndicator.hidesWhenStopped = true
|
||||
|
||||
if self.audioListData.count.isMultiple(of: 10){
|
||||
// if not multiple of 10, means more data can be there, show more btn
|
||||
self.vc.loadMoreBtn.isHidden = false
|
||||
}else{
|
||||
self.vc.loadMoreBtn.isHidden = true
|
||||
}
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
||||
@@ -98,10 +98,10 @@
|
||||
<rect key="frame" x="0.0" y="116" width="393" height="477"/>
|
||||
<subviews>
|
||||
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="15" translatesAutoresizingMaskIntoConstraints="NO" id="LRD-os-sag">
|
||||
<rect key="frame" x="0.0" y="0.0" width="393" height="40"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="393" height="105"/>
|
||||
<subviews>
|
||||
<stackView hidden="YES" opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="wjN-Eq-Uv8">
|
||||
<rect key="frame" x="10" y="0.0" width="373" height="270"/>
|
||||
<rect key="frame" x="10" y="-270" width="373" height="270"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="CONTINUE WATCHING" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Ovn-Ul-XkS" customClass="LocalisedElementsLabel" customModule="WOKA" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="373" height="40"/>
|
||||
@@ -149,6 +149,48 @@
|
||||
</tableView>
|
||||
</subviews>
|
||||
</stackView>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="JdL-UR-aEk">
|
||||
<rect key="frame" x="10" y="55" width="373" height="50"/>
|
||||
<subviews>
|
||||
<button hidden="YES" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="tailTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="r2H-eP-JnE" customClass="LocalisedElementsButton" customModule="WOKA" customModuleProvider="target">
|
||||
<rect key="frame" x="109" y="0.0" width="155" height="50"/>
|
||||
<color key="backgroundColor" red="0.36862745099999999" green="0.1215686275" blue="0.76862745099999996" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="50" id="JCn-Ft-aaW"/>
|
||||
<constraint firstAttribute="width" constant="155" id="iXA-M0-1Nt"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" name="Exo2-Bold" family="Exo 2" pointSize="18"/>
|
||||
<color key="tintColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<inset key="titleEdgeInsets" minX="5" minY="0.0" maxX="0.0" maxY="0.0"/>
|
||||
<inset key="imageEdgeInsets" minX="-10" minY="0.0" maxX="10" maxY="0.0"/>
|
||||
<state key="normal" title="LOAD MORE"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
|
||||
<integer key="value" value="25"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
<connections>
|
||||
<action selector="loadMoreBtn:" destination="Y6W-OH-hqX" eventType="touchUpInside" id="c1q-er-FbM"/>
|
||||
</connections>
|
||||
</button>
|
||||
<activityIndicatorView hidden="YES" opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" hidesWhenStopped="YES" style="medium" translatesAutoresizingMaskIntoConstraints="NO" id="SC3-M4-kXo">
|
||||
<rect key="frame" x="161.66666666666666" y="0.0" width="50" height="50"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" secondItem="SC3-M4-kXo" secondAttribute="height" multiplier="1:1" id="yMz-Th-LQe"/>
|
||||
</constraints>
|
||||
<color key="color" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
|
||||
</activityIndicatorView>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="bottom" secondItem="r2H-eP-JnE" secondAttribute="bottom" id="R5x-qH-ThN"/>
|
||||
<constraint firstAttribute="bottom" secondItem="SC3-M4-kXo" secondAttribute="bottom" id="XbZ-xY-5dk"/>
|
||||
<constraint firstItem="r2H-eP-JnE" firstAttribute="centerX" secondItem="JdL-UR-aEk" secondAttribute="centerX" id="bOq-9R-kbi"/>
|
||||
<constraint firstItem="SC3-M4-kXo" firstAttribute="centerX" secondItem="JdL-UR-aEk" secondAttribute="centerX" id="doe-Mg-Vvs"/>
|
||||
<constraint firstItem="SC3-M4-kXo" firstAttribute="top" secondItem="JdL-UR-aEk" secondAttribute="top" id="q2p-a2-Po0"/>
|
||||
<constraint firstItem="r2H-eP-JnE" firstAttribute="top" secondItem="JdL-UR-aEk" secondAttribute="top" id="ud7-Eq-r0z"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</subviews>
|
||||
<edgeInsets key="layoutMargins" top="0.0" left="10" bottom="0.0" right="10"/>
|
||||
</stackView>
|
||||
@@ -189,6 +231,8 @@
|
||||
<outlet property="headerView" destination="Y14-44-gYV" id="iEI-3T-DaP"/>
|
||||
<outlet property="headerViewTopConstraint" destination="1nk-Sb-8DA" id="0WC-Ao-ddY"/>
|
||||
<outlet property="listenView" destination="U8f-iQ-dPK" id="viY-Sn-3SO"/>
|
||||
<outlet property="loadMoreActivityIndicator" destination="SC3-M4-kXo" id="WiT-SC-pYV"/>
|
||||
<outlet property="loadMoreBtn" destination="r2H-eP-JnE" id="6rt-ro-60V"/>
|
||||
<outlet property="scrollView" destination="QFQ-dJ-08w" id="iQT-YH-vSA"/>
|
||||
<outlet property="tableHeight" destination="B9K-xl-IPt" id="DoT-oS-DrI"/>
|
||||
<outlet property="topLabel" destination="gVU-VB-fhU" id="z72-4N-T9u"/>
|
||||
|
||||
@@ -93,3 +93,55 @@ struct ListenAudioListingDM: Codable {
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
//{
|
||||
// "id": 6,
|
||||
// "title": "DADAGIRI KI AISI KI TAISE",
|
||||
// "description": "<p>Kalu and Chitta are the two big bullies of the school who don't stop at troubling anyone. They steal someone's food and bully someone. ADI and his friends can't take it all. They go to seek help from the wise sage, Piku Baba. What clever method did Piku Baba tell Kalu and Chitta to teach them a lesson? Has Kalu and Chitta's bullying come to an end? Can ADI and his crew stop them? Listen to this funny story to find out.</p>",
|
||||
// "thumbnail_path": "https://wokaland.com/admin/storage/app/public/uploads/Listen/64b2bdf9d277d.png?d=1719904091",
|
||||
// "audio_url": "https://content.jwplatform.com/videos/tUJ8m9W0-Ysj2G4DQ.mp4",
|
||||
// "category_master_id": "11",
|
||||
// "age_range_master_id": "0",
|
||||
// "tags_keyword": "0",
|
||||
// "release_date": "2023-07-15 00:00:00",
|
||||
// "language_master_id": 1,
|
||||
// "gender_master_id": "0",
|
||||
// "audio_duration": "00:07:25",
|
||||
// "media_id": "",
|
||||
// "content_more_details": [
|
||||
// {
|
||||
// "id": 831,
|
||||
// "content_id": 6,
|
||||
// "post_type": 7,
|
||||
// "language_master_id": 1,
|
||||
// "title": "DADAGIRI KI AISI KI TAISE",
|
||||
// "description": "<p>Kalu and Chitta are the two big bullies of the school who don't stop at troubling anyone. They steal someone's food and bully someone. ADI and his friends can't take it all. They go to seek help from the wise sage, Piku Baba. What clever method did Piku Baba tell Kalu and Chitta to teach them a lesson? Has Kalu and Chitta's bullying come to an end? Can ADI and his crew stop them? Listen to this funny story to find out.</p>",
|
||||
// "url": "https://content.jwplatform.com/videos/tUJ8m9W0-Ysj2G4DQ.mp4",
|
||||
// "tags_keywords": "0"
|
||||
// },
|
||||
// {
|
||||
// "id": 832,
|
||||
// "content_id": 6,
|
||||
// "post_type": 7,
|
||||
// "language_master_id": 2,
|
||||
// "title": "दादागिरी की ऐसी की तैसी",
|
||||
// "description": "<p>कालू और चिट्टा स्कूल के दो बड़े बदमाश हैं जो किसी को भी सताने से बाज़ नहीं आते। किसी का वे खाना चुरा लेते हैं और किसी के ऊपर दादागिरी जमाते रहते हैं। आदि और उसके दोस्त यह सब सहन नहीं कर पा रहे हैं। वे ज्ञानी साधु, पीकू बाबा से मदद माँगने जाते हैं। कालू और चिट्ठा को सबक सिखानेके लिए। पीकू बाबा ने उन्हें कौन सा खुफिया तरीका बताया? क्या कालू और चिट्टा की दादागिरी ख़त्म हुई? क्या आदि और उसका दल उन्हें रोक पाते हैं? पता लगाने के लिए यह मज़ेदार कहानी सुनो।</p>",
|
||||
// "url": "https://content.jwplatform.com/videos/tUJ8m9W0-Ysj2G4DQ.mp4",
|
||||
// "tags_keywords": "0"
|
||||
// }
|
||||
// ],
|
||||
// "user_video_view": [],
|
||||
// "category_data": [
|
||||
// {
|
||||
// "id": 11,
|
||||
// "category_name": "Audio"
|
||||
// }
|
||||
// ],
|
||||
// "age_range_data": [],
|
||||
// "gender_data": [],
|
||||
// "mark_as_favourite": false,
|
||||
// "is_liked": false,
|
||||
// "views_count": 4763,
|
||||
// "likes_count": 20,
|
||||
// "bookmark_count": 15
|
||||
// }
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
import UIKit
|
||||
|
||||
class GamesListVC: UIViewController {
|
||||
|
||||
|
||||
@IBOutlet weak var scrollView: UIScrollView!
|
||||
@IBOutlet weak var headerHeight: NSLayoutConstraint!
|
||||
|
||||
@@ -136,7 +136,7 @@ extension MyListVC : CollectionViewSRC{
|
||||
cell.setData(data: data)
|
||||
case audioBooksCV:
|
||||
if let data = vm.favListingData?.audioData?[indexPath.row]{
|
||||
cell.setOtherData(data: data)
|
||||
cell.setAudioData(data: data)
|
||||
}
|
||||
case karaokeCV:
|
||||
if let data = vm.favListingData?.singKaraokeData?[indexPath.row]{
|
||||
@@ -410,12 +410,46 @@ extension MyListVC : CollectionViewSRC{
|
||||
vcPush.vm.categoryID = 18
|
||||
self.navigationController?.pushViewController(vcPush, animated: true)
|
||||
self.vm.selectedCollection = .webSeriesHindiCV
|
||||
case audioBooksCV:
|
||||
guard let audioData = vm.favListingData?.audioData?[indexPath.row] else{return}
|
||||
|
||||
let sb = UIStoryboard(name: K.StoryBoard.audioBooks, bundle: nil)
|
||||
let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.AudioBooks.audioBookDetailsVC) as! AudioBookDetailsVC
|
||||
vcPush.modalPresentationStyle = .overCurrentContext
|
||||
vcPush.modalTransitionStyle = .crossDissolve
|
||||
vcPush.audioData = audioData
|
||||
vcPush.delegate = self
|
||||
self.present(vcPush, animated: true)
|
||||
default:
|
||||
print(indexPath.row)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
// MARK: - Delegate for reload
|
||||
|
||||
extension MyListVC : ReloadAudioBooksFavLike{
|
||||
|
||||
func updateAudioRows(id: Int, type: FavCellCLick, isFav: Bool?, isLike: Bool?) {
|
||||
if let isFav{
|
||||
|
||||
if let audioListDataIndex = vm.favListingData?.audioData?.firstIndex(where:{$0.id == id}) {
|
||||
vm.favListingData?.audioData?[audioListDataIndex].markAsFavourite = isFav
|
||||
audioBooksCV.reloadItems(at: [IndexPath(row: audioListDataIndex, section: 0)])
|
||||
K.GVar.reloadMyList = true
|
||||
}
|
||||
}
|
||||
|
||||
if let isLike{
|
||||
|
||||
if let audioListDataIndex = vm.favListingData?.audioData?.firstIndex(where:{$0.id == id}) {
|
||||
vm.favListingData?.audioData?[audioListDataIndex].isLiked = isLike
|
||||
audioBooksCV.reloadItems(at: [IndexPath(row: audioListDataIndex, section: 0)])
|
||||
K.GVar.reloadMyList = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension MyListVC : ReloadSeriesFavLike{
|
||||
func updateRows(index: Int, type: FavCellCLick, isFav: Bool?, isLike: Bool?) {
|
||||
|
||||
@@ -15,8 +15,8 @@ struct FavouriteListingDM: Codable {
|
||||
struct ResultData: Codable {
|
||||
var showData: [ShowDatum]?
|
||||
var videoData: [Datum]?
|
||||
var gameData, audioData, singKaraokeData: [Datum]?
|
||||
|
||||
var gameData, singKaraokeData: [Datum]?
|
||||
var audioData : [ListenAudioListingDM.AudioDatum]?
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case showData = "show_data"
|
||||
case videoData = "video_data"
|
||||
@@ -69,23 +69,6 @@ struct FavouriteListingDM: Codable {
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - ContentMoreDetail
|
||||
// struct ContentMoreDetail: Codable {
|
||||
// let id, contentID, postType, languageMasterID: Int?
|
||||
// let title, description: String?
|
||||
// let url: String?
|
||||
// let tagsKeywords: String?
|
||||
//
|
||||
// enum CodingKeys: String, CodingKey {
|
||||
// case id
|
||||
// case contentID = "content_id"
|
||||
// case postType = "post_type"
|
||||
// case languageMasterID = "language_master_id"
|
||||
// case title, description, url
|
||||
// case tagsKeywords = "tags_keywords"
|
||||
// }
|
||||
// }
|
||||
|
||||
// MARK: - ShowDatum
|
||||
struct ShowDatum: Codable {
|
||||
let id: Int?
|
||||
|
||||
@@ -102,4 +102,35 @@ class FavouriteCell: UICollectionViewCell {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func setAudioData(data : ListenAudioListingDM.AudioDatum){
|
||||
//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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ class KaraokeDetailsVC: UIViewController {
|
||||
@IBOutlet weak var addView: UIView!
|
||||
@IBOutlet weak var shareView: UIView!
|
||||
@IBOutlet weak var likeView: UIView!
|
||||
@IBOutlet weak var singNowBtn: LocalisedElementsButton!
|
||||
|
||||
var karaokeData : KaraokeListingDM.KaraokeDatum?
|
||||
var delegate : ReloadAudioBooksFavLike?
|
||||
@@ -31,6 +32,12 @@ class KaraokeDetailsVC: UIViewController {
|
||||
super.viewDidLoad()
|
||||
initView()
|
||||
tapHandler()
|
||||
|
||||
singNowBtn.layer.shadowColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0.25).cgColor
|
||||
singNowBtn.layer.shadowOffset = CGSize(width: 0, height: 3)
|
||||
singNowBtn.layer.shadowOpacity = 1.0
|
||||
singNowBtn.layer.shadowRadius = 10.0
|
||||
singNowBtn.layer.masksToBounds = false
|
||||
}
|
||||
|
||||
func initView(){
|
||||
@@ -106,14 +113,14 @@ class KaraokeDetailsVC: UIViewController {
|
||||
LikeFavCommonFunc.shareInstance.removeFavourite(postID: showID, postType: postType, categoryID: 0, vc: self) { isDone in
|
||||
self.karaokeData?.markAsFavourite = false
|
||||
K.GVar.reloadMyList = true
|
||||
self.delegate?.updateRows(id: showID, type: .favourite, isFav: false, isLike: nil)
|
||||
self.delegate?.updateAudioRows(id: showID, type: .favourite, isFav: false, isLike: nil)
|
||||
self.initView()
|
||||
}
|
||||
}else{
|
||||
LikeFavCommonFunc.shareInstance.addFavourite(postID: showID, postType: postType, categoryID: 0, vc: self) { isDone in
|
||||
self.karaokeData?.markAsFavourite = true
|
||||
K.GVar.reloadMyList = true
|
||||
self.delegate?.updateRows(id: showID, type: .favourite, isFav: true, isLike: nil)
|
||||
self.delegate?.updateAudioRows(id: showID, type: .favourite, isFav: true, isLike: nil)
|
||||
self.initView()
|
||||
}
|
||||
}
|
||||
@@ -130,14 +137,14 @@ class KaraokeDetailsVC: UIViewController {
|
||||
LikeFavCommonFunc.shareInstance.unlikePost(postID: showID, postType: postType, vc: self) { isDone in
|
||||
self.karaokeData?.isLiked = false
|
||||
K.GVar.reloadMyList = true
|
||||
self.delegate?.updateRows(id: showID, type: .liked, isFav: nil, isLike: false)
|
||||
self.delegate?.updateAudioRows(id: showID, type: .liked, isFav: nil, isLike: false)
|
||||
self.initView()
|
||||
}
|
||||
}else{
|
||||
LikeFavCommonFunc.shareInstance.likePost(postID: showID, postType: postType, vc: self) { isDone in
|
||||
self.karaokeData?.isLiked = true
|
||||
K.GVar.reloadMyList = true
|
||||
self.delegate?.updateRows(id: showID, type: .liked, isFav: nil, isLike: true)
|
||||
self.delegate?.updateAudioRows(id: showID, type: .liked, isFav: nil, isLike: true)
|
||||
self.initView()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,8 @@ class KaraokeListingVC: UIViewController {
|
||||
|
||||
@IBOutlet weak var karaokeListingTableView: UITableView!
|
||||
@IBOutlet weak var tableHeight: NSLayoutConstraint!
|
||||
@IBOutlet weak var loadMoreBtn: LocalisedElementsButton!
|
||||
@IBOutlet weak var loadMoreActivityIndicator: UIActivityIndicatorView!
|
||||
|
||||
var vm = KaraokeListingVM()
|
||||
|
||||
@@ -56,6 +58,13 @@ class KaraokeListingVC: UIViewController {
|
||||
super.viewDidLayoutSubviews()
|
||||
vm.updateTableHeight()
|
||||
}
|
||||
|
||||
@IBAction func loadMoreBtnTapped(_ sender: LocalisedElementsButton) {
|
||||
loadMoreBtn.isHidden = true
|
||||
vm.pageNo += 1
|
||||
loadMoreActivityIndicator.startAnimating()
|
||||
vm.getKaraokeListing()
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - CollectionView Delegate and Data Source
|
||||
@@ -169,7 +178,7 @@ extension KaraokeListingVC : TableViewSRC{
|
||||
}
|
||||
|
||||
extension KaraokeListingVC : ReloadAudioBooksFavLike{
|
||||
func updateRows(id: Int, type: FavCellCLick, isFav: Bool?, isLike: Bool?) {
|
||||
func updateAudioRows(id: Int, type: FavCellCLick, isFav: Bool?, isLike: Bool?) {
|
||||
if let isFav{
|
||||
if let continueDataIndex = vm.continueWatchingData.firstIndex(where:{$0.id == id}) {
|
||||
vm.continueWatchingData[continueDataIndex].markAsFavourite = isFav
|
||||
|
||||
@@ -98,10 +98,10 @@
|
||||
<rect key="frame" x="0.0" y="116" width="414" height="532"/>
|
||||
<subviews>
|
||||
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="15" translatesAutoresizingMaskIntoConstraints="NO" id="WYB-AZ-whM">
|
||||
<rect key="frame" x="0.0" y="0.0" width="414" height="40"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="414" height="105"/>
|
||||
<subviews>
|
||||
<stackView hidden="YES" opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="CKh-Ui-Z3R">
|
||||
<rect key="frame" x="10" y="0.0" width="394" height="270"/>
|
||||
<rect key="frame" x="10" y="-270" width="394" height="270"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="SING AGAIN" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="pLt-VK-ajf" customClass="LocalisedElementsLabel" customModule="WOKA" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="394" height="40"/>
|
||||
@@ -149,6 +149,49 @@
|
||||
</tableView>
|
||||
</subviews>
|
||||
</stackView>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="za1-RR-su2">
|
||||
<rect key="frame" x="10" y="55" width="394" height="50"/>
|
||||
<subviews>
|
||||
<button hidden="YES" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="tailTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="ims-Sc-C3R" customClass="LocalisedElementsButton" customModule="WOKA" customModuleProvider="target">
|
||||
<rect key="frame" x="119.5" y="0.0" width="155" height="50"/>
|
||||
<color key="backgroundColor" red="0.36862745098039218" green="0.12156862745098039" blue="0.76862745098039209" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="50" id="1b8-Iq-uIU"/>
|
||||
<constraint firstAttribute="width" constant="155" id="l1r-Rg-TRh"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" name="Exo2-Bold" family="Exo 2" pointSize="18"/>
|
||||
<color key="tintColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<inset key="titleEdgeInsets" minX="5" minY="0.0" maxX="0.0" maxY="0.0"/>
|
||||
<inset key="imageEdgeInsets" minX="-10" minY="0.0" maxX="10" maxY="0.0"/>
|
||||
<state key="normal" title="LOAD MORE"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
|
||||
<integer key="value" value="25"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
<connections>
|
||||
<action selector="loadMoreBtnTapped:" destination="Y6W-OH-hqX" eventType="touchUpInside" id="jtf-4I-BTn"/>
|
||||
<action selector="playNowBtnTapped:" destination="fax-bi-Mb9" eventType="touchUpInside" id="bu2-m8-dfO"/>
|
||||
</connections>
|
||||
</button>
|
||||
<activityIndicatorView hidden="YES" opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" hidesWhenStopped="YES" style="medium" translatesAutoresizingMaskIntoConstraints="NO" id="OhD-ec-2sW">
|
||||
<rect key="frame" x="172" y="0.0" width="50" height="50"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" secondItem="OhD-ec-2sW" secondAttribute="height" multiplier="1:1" id="dva-fK-OUW"/>
|
||||
</constraints>
|
||||
<color key="color" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
|
||||
</activityIndicatorView>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstItem="ims-Sc-C3R" firstAttribute="top" secondItem="za1-RR-su2" secondAttribute="top" id="0AM-fH-QEM"/>
|
||||
<constraint firstItem="OhD-ec-2sW" firstAttribute="centerX" secondItem="za1-RR-su2" secondAttribute="centerX" id="REE-mu-rcw"/>
|
||||
<constraint firstAttribute="bottom" secondItem="ims-Sc-C3R" secondAttribute="bottom" id="dMT-GX-v3Z"/>
|
||||
<constraint firstItem="ims-Sc-C3R" firstAttribute="centerX" secondItem="za1-RR-su2" secondAttribute="centerX" id="iBj-MG-25D"/>
|
||||
<constraint firstAttribute="bottom" secondItem="OhD-ec-2sW" secondAttribute="bottom" id="tIx-Ac-OrU"/>
|
||||
<constraint firstItem="OhD-ec-2sW" firstAttribute="top" secondItem="za1-RR-su2" secondAttribute="top" id="xlJ-jO-zbq"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</subviews>
|
||||
<edgeInsets key="layoutMargins" top="0.0" left="10" bottom="0.0" right="10"/>
|
||||
</stackView>
|
||||
@@ -187,6 +230,8 @@
|
||||
<outlet property="headerTitleLabel" destination="fQH-gr-lSI" id="vjR-Yu-eZO"/>
|
||||
<outlet property="headerView" destination="V10-F3-AfA" id="gZb-F6-pQ2"/>
|
||||
<outlet property="karaokeListingTableView" destination="haV-Gw-hD2" id="1En-mN-yVg"/>
|
||||
<outlet property="loadMoreActivityIndicator" destination="OhD-ec-2sW" id="yfU-R6-UbS"/>
|
||||
<outlet property="loadMoreBtn" destination="ims-Sc-C3R" id="WEX-0M-lBp"/>
|
||||
<outlet property="scrollView" destination="5mW-wO-b1Z" id="vX8-Dp-fHu"/>
|
||||
<outlet property="selectedShowView" destination="JKB-7I-uN7" id="1hm-Jj-hg2"/>
|
||||
<outlet property="tableHeight" destination="X5Z-qL-DJr" id="4j9-E7-nL6"/>
|
||||
@@ -516,6 +561,7 @@
|
||||
<outlet property="likeView" destination="7yn-Pm-yFj" id="UmV-JD-fkM"/>
|
||||
<outlet property="releaseDate" destination="imq-Oe-kqw" id="WgI-LF-gx2"/>
|
||||
<outlet property="shareView" destination="D0l-lG-ZC6" id="P0S-7X-ToM"/>
|
||||
<outlet property="singNowBtn" destination="ULn-gu-noT" id="ktZ-LI-ODe"/>
|
||||
<outlet property="totalLikes" destination="lVK-jF-yhG" id="os1-on-OtU"/>
|
||||
<outlet property="watchingDesc" destination="bdm-wK-Ct6" id="Sps-Fk-4Nj"/>
|
||||
<outlet property="watchingImage" destination="ljT-wJ-GOw" id="SS0-yn-egm"/>
|
||||
@@ -535,17 +581,17 @@
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" translatesAutoresizingMaskIntoConstraints="NO" id="s55-L0-QBA" userLabel="PlayerView">
|
||||
<rect key="frame" x="0.0" y="330" width="418" height="250"/>
|
||||
<rect key="frame" x="0.0" y="330" width="414" height="250"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" translatesAutoresizingMaskIntoConstraints="NO" id="l7y-7N-uz2">
|
||||
<rect key="frame" x="0.0" y="0.0" width="418" height="250"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="414" height="250"/>
|
||||
<subviews>
|
||||
<view alpha="0.5" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="7Lc-Yp-x8G">
|
||||
<rect key="frame" x="0.0" y="0.0" width="418" height="250"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="414" height="250"/>
|
||||
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</view>
|
||||
<stackView opaque="NO" contentMode="scaleToFill" spacing="6" translatesAutoresizingMaskIntoConstraints="NO" id="Mhh-bR-zKm" userLabel="SliderStack">
|
||||
<rect key="frame" x="5" y="218" width="408" height="30"/>
|
||||
<rect key="frame" x="5" y="218" width="404" height="30"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="00:00:00" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" translatesAutoresizingMaskIntoConstraints="NO" id="PZq-WO-H32">
|
||||
<rect key="frame" x="0.0" y="0.0" width="50" height="30"/>
|
||||
@@ -557,12 +603,12 @@
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" minValue="0.0" maxValue="1" translatesAutoresizingMaskIntoConstraints="NO" id="VKq-Xn-4Nn">
|
||||
<rect key="frame" x="54" y="0.0" width="300" height="31"/>
|
||||
<rect key="frame" x="54" y="0.0" width="296" height="31"/>
|
||||
<color key="tintColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<color key="thumbTintColor" red="0.80000000000000004" green="0.29411764709999999" blue="0.1137254902" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</slider>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" usesAttributedText="YES" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" translatesAutoresizingMaskIntoConstraints="NO" id="0xZ-En-mzk">
|
||||
<rect key="frame" x="358" y="0.0" width="50" height="30"/>
|
||||
<rect key="frame" x="354" y="0.0" width="50" height="30"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="50" id="13R-ht-Ooc"/>
|
||||
</constraints>
|
||||
@@ -580,7 +626,7 @@
|
||||
</subviews>
|
||||
</stackView>
|
||||
<stackView opaque="NO" contentMode="scaleToFill" spacing="20" translatesAutoresizingMaskIntoConstraints="NO" id="6xv-b4-3da">
|
||||
<rect key="frame" x="114" y="100" width="190" height="50"/>
|
||||
<rect key="frame" x="112" y="100" width="190" height="50"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="M0h-b5-LXf">
|
||||
<rect key="frame" x="0.0" y="0.0" width="50" height="50"/>
|
||||
@@ -661,18 +707,19 @@
|
||||
</constraints>
|
||||
</view>
|
||||
<stackView opaque="NO" contentMode="scaleToFill" spacing="10" translatesAutoresizingMaskIntoConstraints="NO" id="hXe-Fv-Zk9">
|
||||
<rect key="frame" x="10" y="58" width="398" height="30"/>
|
||||
<rect key="frame" x="10" y="58" width="394" height="30"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="NA" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="alm-nS-A2I">
|
||||
<rect key="frame" x="0.0" y="0.0" width="358" height="30"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="354" height="30"/>
|
||||
<fontDescription key="fontDescription" name="Exo2-Bold" family="Exo 2" pointSize="18"/>
|
||||
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="jlb-0g-59l">
|
||||
<rect key="frame" x="368" y="0.0" width="30" height="30"/>
|
||||
<rect key="frame" x="364" y="0.0" width="30" height="30"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" secondItem="jlb-0g-59l" secondAttribute="height" multiplier="1:1" id="9KW-Ku-fD3"/>
|
||||
<constraint firstAttribute="width" secondItem="jlb-0g-59l" secondAttribute="height" multiplier="1:1" id="Ig1-El-cep"/>
|
||||
</constraints>
|
||||
<color key="tintColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
|
||||
@@ -683,18 +730,15 @@
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="jlb-0g-59l" firstAttribute="width" secondItem="jlb-0g-59l" secondAttribute="height" multiplier="1:1" id="Ig1-El-cep"/>
|
||||
</constraints>
|
||||
</stackView>
|
||||
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="15" translatesAutoresizingMaskIntoConstraints="NO" id="jTd-8Q-0y7">
|
||||
<rect key="frame" x="25" y="658" width="368" height="95"/>
|
||||
<rect key="frame" x="25" y="658" width="364" height="96"/>
|
||||
<subviews>
|
||||
<stackView opaque="NO" contentMode="scaleToFill" distribution="fillEqually" spacing="20" translatesAutoresizingMaskIntoConstraints="NO" id="gLz-mh-ln0">
|
||||
<rect key="frame" x="0.0" y="0.0" width="368" height="50"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="364" height="50"/>
|
||||
<subviews>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="tailTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="4KA-5y-qg7" customClass="LocalisedElementsButton" customModule="WOKA" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="174" height="50"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="172" height="50"/>
|
||||
<color key="backgroundColor" red="0.80000000000000004" green="0.29411764709999999" blue="0.1137254902" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="50" id="3ZS-GJ-VKY"/>
|
||||
@@ -714,7 +758,7 @@
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="249" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="tailTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="dz2-DJ-auS" customClass="LocalisedElementsButton" customModule="WOKA" customModuleProvider="target">
|
||||
<rect key="frame" x="194" y="0.0" width="174" height="50"/>
|
||||
<rect key="frame" x="192" y="0.0" width="172" height="50"/>
|
||||
<color key="backgroundColor" name="TextDarkBlue"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="50" id="7d9-YY-TdQ"/>
|
||||
@@ -737,7 +781,7 @@
|
||||
</subviews>
|
||||
</stackView>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="tailTruncation" hasAttributedTitle="YES" translatesAutoresizingMaskIntoConstraints="NO" id="k45-7s-jnN" customClass="LocalisedElementsButton" customModule="WOKA" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="65" width="368" height="30"/>
|
||||
<rect key="frame" x="0.0" y="65" width="364" height="31"/>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<color key="tintColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<inset key="titleEdgeInsets" minX="5" minY="0.0" maxX="0.0" maxY="0.0"/>
|
||||
@@ -746,7 +790,7 @@
|
||||
<attributedString key="attributedTitle">
|
||||
<fragment content="Download">
|
||||
<attributes>
|
||||
<font key="NSFont" size="16" name=".SFNS-Regular"/>
|
||||
<font key="NSFont" metaFont="system" size="16"/>
|
||||
<font key="NSOriginalFont" size="16" name="Farah"/>
|
||||
<paragraphStyle key="NSParagraphStyle" alignment="natural" lineBreakMode="wordWrapping" baseWritingDirection="natural" tighteningFactorForTruncation="0.0"/>
|
||||
</attributes>
|
||||
|
||||
@@ -14,7 +14,9 @@ class KaraokeListingVM{
|
||||
var karaokeListData = [KaraokeListingDM.KaraokeDatum]()
|
||||
var continueWatchingData = [KaraokeListingDM.KaraokeDatum]()
|
||||
var indexToLoad = 0
|
||||
|
||||
|
||||
var pageNo = 0
|
||||
|
||||
func initView(){
|
||||
setupCell()
|
||||
let color1 = #colorLiteral(red: 0.8, green: 0.6078431373, blue: 0.1098039216, alpha: 1)
|
||||
@@ -105,9 +107,11 @@ class KaraokeListingVM{
|
||||
}
|
||||
|
||||
func getKaraokeListing(){
|
||||
// Utilities.startProgressHUD()
|
||||
let headers : HTTPHeaders = ["access-token" : AuthFunc.shareInstance.getAccessToken()]
|
||||
NetworkManager.shareInstance.apiRequest(url: APIEndPoints.Karaoke.sing_karaoke_listing, method: .post,headers: headers) { [weak self](result : Result<BaseResponseModel<KaraokeListingDM>, NetworkManager.APIError>) in
|
||||
let params : Parameters = ["api_version" : "v2",
|
||||
"start" : pageNo,
|
||||
"limit": 10]
|
||||
NetworkManager.shareInstance.apiRequest(url: APIEndPoints.Karaoke.sing_karaoke_listing, method: .post,parameters: params,headers: headers) { [weak self](result : Result<BaseResponseModel<KaraokeListingDM>, NetworkManager.APIError>) in
|
||||
switch result{
|
||||
case .success(let data):
|
||||
guard let self else{
|
||||
@@ -124,14 +128,23 @@ class KaraokeListingVM{
|
||||
case 1:
|
||||
Utilities.dismissProgressHUD()
|
||||
guard let data = data.data?.karaokeData else{return}
|
||||
self.karaokeListData.removeAll()
|
||||
self.karaokeListData = data
|
||||
self.karaokeListData.append(contentsOf: data)
|
||||
self.vc.karaokeListingTableView.reloadData()
|
||||
self.vc.tableHeight.constant = self.vc.karaokeListingTableView.contentSize.height + 100
|
||||
self.vc.karaokeListingTableView.layoutIfNeeded()
|
||||
self.vc.tableHeight.constant = self.vc.karaokeListingTableView.contentSize.height
|
||||
self.vc.tableHeight.constant = self.vc.karaokeListingTableView.contentSize.height + 200
|
||||
setHeaderData()
|
||||
self.stopShimmer()
|
||||
|
||||
self.vc.loadMoreActivityIndicator.stopAnimating()
|
||||
self.vc.loadMoreActivityIndicator.hidesWhenStopped = true
|
||||
|
||||
if !self.karaokeListData.count.isMultiple(of: 10){
|
||||
// if not multiple of 10, means more data can be there, show more btn
|
||||
self.vc.loadMoreBtn.isHidden = false
|
||||
}else{
|
||||
self.vc.loadMoreBtn.isHidden = true
|
||||
}
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user