- Added the trailer button to season episode. - Trailer language will be based on the category selected - Reversed data for continue watching - Added html text convert from response for showing description - Handled the fav and likes from episodes Screen
85 lines
3.4 KiB
Swift
85 lines
3.4 KiB
Swift
//
|
|
// ContinueWatchingVC.swift
|
|
// WOKA
|
|
//
|
|
// Created by MacBook Pro on 26/06/24.
|
|
//
|
|
|
|
import UIKit
|
|
|
|
class ContinueWatchingVC: UIViewController {
|
|
|
|
@IBOutlet weak var watchingImage: UIImageView!
|
|
@IBOutlet weak var watchingTitle: UILabel!
|
|
@IBOutlet weak var watchingDesc: UITextView!
|
|
|
|
var watchData : ContinueWatchingDM.ResultData?
|
|
|
|
// This ID is from webseries main screen, where user selectes
|
|
var categoryID : Int?
|
|
|
|
override func viewDidLoad() {
|
|
super.viewDidLoad()
|
|
if watchData != nil{
|
|
setData()
|
|
}
|
|
}
|
|
|
|
func setData(){
|
|
guard let watchData else{return}
|
|
|
|
if let url = watchData.thumbnailPath{
|
|
self.watchingImage.imageURL(url, color: .black)
|
|
}
|
|
|
|
if AuthFunc.shareInstance.getDefaultLanguage() == .english{
|
|
guard let englishData = watchData.contentMoreDetails?.filter({$0.languageMasterID == 1}).first else{return}
|
|
watchingTitle.text = englishData.title
|
|
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)!)
|
|
self.watchingDesc.attributedText = sizeText
|
|
}
|
|
}else{
|
|
guard let hindiData = watchData.contentMoreDetails?.filter({$0.languageMasterID == 2}).first else{return}
|
|
watchingTitle.text = hindiData.title
|
|
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)!)
|
|
self.watchingDesc.attributedText = sizeText
|
|
}
|
|
}
|
|
}
|
|
|
|
@IBAction func watchBtnTapped(_ sender: LocalisedElementsButton) {
|
|
guard let watchData else{return}
|
|
var playerItem = JwPlayerItemCreate(url: "", poster: "", titles: "")
|
|
playerItem.poster = watchData.thumbnailPath
|
|
if AuthFunc.shareInstance.getDefaultLanguage() == .english{
|
|
guard let englishData = watchData.contentMoreDetails?.filter({$0.languageMasterID == 1}).first else{return}
|
|
playerItem.titles = englishData.title
|
|
}else{
|
|
guard let hindiData = watchData.contentMoreDetails?.filter({$0.languageMasterID == 2}).first else{return}
|
|
playerItem.titles = hindiData.title
|
|
}
|
|
|
|
if categoryID == 1{
|
|
guard let englishData = watchData.contentMoreDetails?.filter({$0.languageMasterID == 1}).first, let url = englishData.contentHDURL else{return}
|
|
playerItem.url = url
|
|
|
|
}else if categoryID == 18{
|
|
guard let hindiData = watchData.contentMoreDetails?.filter({$0.languageMasterID == 2}).first, let url = hindiData.contentHDURL else{return}
|
|
playerItem.url = url
|
|
}
|
|
|
|
JWPlayerManager.shared.presentPlayer(from: self, playerItems: [playerItem], startIndex: 0, contentType: .continueWatching)
|
|
|
|
}
|
|
|
|
@IBAction func closeBtnTapped(_ sender: LocalisedElementsButton) {
|
|
self.dismiss(animated: true) {
|
|
|
|
}
|
|
}
|
|
}
|