This commit is contained in:
2024-07-10 20:01:20 +05:30
parent 15fa04ceb9
commit 1b51d7950a
5 changed files with 43 additions and 30 deletions

View File

@@ -157,7 +157,7 @@ class KaraokeDetailsVC: UIViewController {
print("share")
}
}
@IBAction func playNowBtnTapped(_ sender: LocalisedElementsButton) {
// let sb = UIStoryboard(name: K.StoryBoard.Karaoke, bundle: nil)
@@ -207,7 +207,7 @@ class KaraokeDetailsVC: UIViewController {
.build()
vc.config = config
// vc.dismissTapped = self.tapped
// vc.dismissTapped = self.tapped
vc.modalPresentationStyle = .overFullScreen
vc.modalTransitionStyle = .crossDissolve
vc.documentAudioUrl = url

View File

@@ -63,7 +63,7 @@ class KaraokeListingVC: UIViewController {
loadMoreBtn.isHidden = true
vm.pageNo += 1
loadMoreActivityIndicator.startAnimating()
vm.getKaraokeListing()
vm.getKaraokeListing(isBtnClick: true)
}
}
@@ -93,7 +93,7 @@ extension KaraokeListingVC : CollectionViewSRC{
/*
Updated the top header data
*/
vm.indexToLoad = vm.karaokeListData.firstIndex(where: {$0.id == data.id}) ?? 0
vm.headerData = data
vm.setHeaderData()
let sb = UIStoryboard(name: K.StoryBoard.Karaoke, bundle: nil)
@@ -159,14 +159,14 @@ extension KaraokeListingVC : TableViewSRC{
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let data = vm.karaokeListData[indexPath.row]
/*
Updated the top header data
*/
vm.indexToLoad = indexPath.row
vm.headerData = data
vm.setHeaderData()
let data = vm.karaokeListData[indexPath.row]
let sb = UIStoryboard(name: K.StoryBoard.Karaoke, bundle: nil)
let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.Karaoke.karaokeDetailsVC) as! KaraokeDetailsVC
vcPush.modalPresentationStyle = .overCurrentContext

View File

@@ -581,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"/>
@@ -603,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>
@@ -626,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"/>
@@ -707,16 +707,16 @@
</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"/>
@@ -732,13 +732,13 @@
</subviews>
</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="96"/>
<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"/>
@@ -758,11 +758,10 @@
</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"/>
<constraint firstAttribute="width" constant="135" id="DlE-SG-wUQ"/>
</constraints>
<fontDescription key="fontDescription" name="Exo2-Bold" family="Exo 2" pointSize="16"/>
<color key="tintColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
@@ -781,7 +780,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="31"/>
<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"/>

View File

@@ -13,9 +13,11 @@ class KaraokeListingVM{
weak var vc : KaraokeListingVC!
var karaokeListData = [KaraokeListingDM.KaraokeDatum]()
var continueWatchingData = [KaraokeListingDM.KaraokeDatum]()
var indexToLoad = 0
var headerData : KaraokeListingDM.KaraokeDatum?
var pageNo = 0
var stopFetch = false
func initView(){
setupCell()
@@ -45,7 +47,7 @@ class KaraokeListingVM{
}
func setHeaderData(){
let data = karaokeListData[indexToLoad]
guard let data = self.headerData else{return}
if let url = data.thumbnailPath{
self.vc.headerImage.imageURL(url, color: .white)
@@ -106,7 +108,7 @@ class KaraokeListingVM{
}
}
func getKaraokeListing(){
func getKaraokeListing(isBtnClick : Bool = false){
let headers : HTTPHeaders = ["access-token" : AuthFunc.shareInstance.getAccessToken()]
let params : Parameters = ["api_version" : "v2",
"start" : pageNo,
@@ -124,7 +126,11 @@ class KaraokeListingVM{
Error
*/
Utilities.dismissProgressHUD()
vc.toast(msg: data.message ?? "Unrecognised error" , time: 2)
self.stopFetch = true
self.vc.loadMoreBtn.isHidden = true
self.vc.loadMoreActivityIndicator.stopAnimating()
self.vc.loadMoreActivityIndicator.hidesWhenStopped = true
// vc.toast(msg: data.message ?? "Unrecognised error" , time: 2)
case 1:
Utilities.dismissProgressHUD()
guard let data = data.data?.karaokeData else{return}
@@ -133,13 +139,18 @@ class KaraokeListingVM{
self.vc.tableHeight.constant = self.vc.karaokeListingTableView.contentSize.height + 100
self.vc.karaokeListingTableView.layoutIfNeeded()
self.vc.tableHeight.constant = self.vc.karaokeListingTableView.contentSize.height + 200
setHeaderData()
if !isBtnClick{
self.headerData = self.karaokeListData.first
setHeaderData()
}
self.stopShimmer()
self.vc.loadMoreActivityIndicator.stopAnimating()
self.vc.loadMoreActivityIndicator.hidesWhenStopped = true
if !self.karaokeListData.count.isMultiple(of: 10){
if self.karaokeListData.count.isMultiple(of: 10) && !self.stopFetch{
// if not multiple of 10, means more data can be there, show more btn
self.vc.loadMoreBtn.isHidden = false
}else{

View File

@@ -188,7 +188,8 @@ class WebSeriesSeasonVM{
if AuthFunc.shareInstance.getDefaultLanguage() == .english{
let englishData = data.seasonMoreDetails?.filter({$0.languageMasterID == 1}).first
vc.seasonTitle.text = (englishData?.title ?? "NA") + "\n" + (data.seasonNumber ?? "NA")
self.vc.title = (englishData?.title ?? "Show")
if let desc = englishData?.description?.replacingOccurrences(of: "<br>", with: "").htmlToAttributedString{
let sizeText = NSMutableAttributedString(attributedString: desc)
sizeText.setFontFace(font: FontCustom.shareInstance.customFont(fontName: .Exo2_Regular, size: 15),color: UIColor.appColor(.TextDarkBlue)!)
@@ -197,6 +198,8 @@ class WebSeriesSeasonVM{
}else{
let hindiData = data.seasonMoreDetails?.filter({$0.languageMasterID == 2}).first
vc.seasonTitle.text = (hindiData?.title ?? "NA") + "\n" + (data.seasonNumber ?? "NA")
self.vc.title = (hindiData?.title ?? "Show")
if let desc = hindiData?.description?.replacingOccurrences(of: "<br>", with: "").htmlToAttributedString{
let sizeText = NSMutableAttributedString(attributedString: desc)
sizeText.setFontFace(font: FontCustom.shareInstance.customFont(fontName: .Exo2_Regular, size: 15),color: UIColor.appColor(.TextDarkBlue)!)