updated or release
This commit is contained in:
@@ -10,20 +10,24 @@ import SDWebImage
|
||||
|
||||
enum ImageType{
|
||||
case homeAvatar
|
||||
case ads
|
||||
case none
|
||||
}
|
||||
extension UIImageView {
|
||||
|
||||
func imageURL(_ url: String, color : UIColor = UIColor.appColor(.TextDarkBlue)!, type : ImageType = .none) {
|
||||
func imageURL(_ url: String, color : UIColor = UIColor.appColor(.TextDarkBlue)!, type : ImageType = .none, completionHandler: ((Bool) -> Void)? = nil) {
|
||||
let customIndicator = SDWebImageActivityIndicator.medium
|
||||
customIndicator.indicatorView.color = color
|
||||
self.sd_imageIndicator = customIndicator
|
||||
|
||||
self.sd_setImage(with: URL(string: url.replacingOccurrences(of: " ", with: "%20"))) { [weak self] (image, error, cacheType, url) in
|
||||
if error != nil{
|
||||
completionHandler?(false)
|
||||
// do a placeholder image here
|
||||
guard let self else{return}
|
||||
handlePlaceHolder(type: type)
|
||||
}else{
|
||||
completionHandler?(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -34,10 +38,10 @@ extension UIImageView {
|
||||
switch type{
|
||||
case .homeAvatar:
|
||||
self.image = UIImage(named: "DefaultAvatar")
|
||||
case .ads:
|
||||
break
|
||||
case .none:
|
||||
self.image = UIImage(named: "EpisodePlaceHolder")
|
||||
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -45,43 +45,51 @@ class MyListVM{
|
||||
|
||||
// check if ads data contains LocalAD for webseries
|
||||
if let advertisement = myListAd.advertisement,let bannerImage = advertisement.bannerImage{
|
||||
// vc.imageAdView.imageURL(bannerImage, color: .white)
|
||||
// vc.imageAdView.alpha = 0
|
||||
let height = UIScreen.main.bounds.width * 0.192
|
||||
vc.adHeight.constant = height
|
||||
|
||||
let imageView = UIImageView()
|
||||
|
||||
// Set the image you want to display
|
||||
imageView.imageURL(bannerImage, color: .white)
|
||||
|
||||
// Enable auto-layout
|
||||
imageView.translatesAutoresizingMaskIntoConstraints = false
|
||||
|
||||
// Add the UIImageView to the view
|
||||
vc.adView.addSubview(imageView)
|
||||
|
||||
// Set UIImageView to match the size of the parent UIView
|
||||
NSLayoutConstraint.activate([
|
||||
imageView.leadingAnchor.constraint(equalTo: vc.adView.leadingAnchor),
|
||||
imageView.trailingAnchor.constraint(equalTo: vc.adView.trailingAnchor),
|
||||
imageView.topAnchor.constraint(equalTo: vc.adView.topAnchor),
|
||||
imageView.bottomAnchor.constraint(equalTo: vc.adView.bottomAnchor)
|
||||
])
|
||||
imageView.contentMode = .scaleAspectFit
|
||||
UIView.animate(withDuration: 0.2, animations: { [weak self] in
|
||||
imageView.imageURL(bannerImage, color: .textDarkBlue,type: .ads) { [weak self] isDone in
|
||||
guard let self else{return}
|
||||
vc.adView.alpha = 1
|
||||
})
|
||||
|
||||
vc.adView.addTapGesture {
|
||||
if let adID = myListAd.id{
|
||||
PersistentStorage.shared.addAdsCount(adID: adID ,clicks: 1)
|
||||
}
|
||||
if let adLink = myListAd.advertisement?.adLink ,let url = URL(string: adLink), UIApplication.shared.canOpenURL(url) {
|
||||
UIApplication.shared.open(url)
|
||||
// if image gives error hide the ad banner
|
||||
if isDone == false{
|
||||
vc.adView.isHidden = true
|
||||
}else{
|
||||
let height = UIScreen.main.bounds.width * 0.192
|
||||
vc.adHeight.constant = height
|
||||
// Set the image you want to display
|
||||
imageView.imageURL(bannerImage, color: .white)
|
||||
|
||||
// Enable auto-layout
|
||||
imageView.translatesAutoresizingMaskIntoConstraints = false
|
||||
|
||||
// Add the UIImageView to the view
|
||||
vc.adView.addSubview(imageView)
|
||||
|
||||
// Set UIImageView to match the size of the parent UIView
|
||||
NSLayoutConstraint.activate([
|
||||
imageView.leadingAnchor.constraint(equalTo: vc.adView.leadingAnchor),
|
||||
imageView.trailingAnchor.constraint(equalTo: vc.adView.trailingAnchor),
|
||||
imageView.topAnchor.constraint(equalTo: vc.adView.topAnchor),
|
||||
imageView.bottomAnchor.constraint(equalTo: vc.adView.bottomAnchor)
|
||||
])
|
||||
imageView.contentMode = .scaleAspectFit
|
||||
UIView.animate(withDuration: 0.2, animations: { [weak self] in
|
||||
guard let self else{return}
|
||||
vc.adView.alpha = 1
|
||||
})
|
||||
|
||||
vc.adView.addTapGesture {
|
||||
if let adID = myListAd.id{
|
||||
PersistentStorage.shared.addAdsCount(adID: adID ,clicks: 1)
|
||||
}
|
||||
if let adLink = myListAd.advertisement?.adLink ,let url = URL(string: adLink), UIApplication.shared.canOpenURL(url) {
|
||||
UIApplication.shared.open(url)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}else if myListAd.googleAd != nil{
|
||||
//setup google banner ads.
|
||||
vc.adHeight.constant = 90
|
||||
|
||||
@@ -19,10 +19,24 @@ struct APIEndPoints {
|
||||
// Private init to prevent external initialization
|
||||
private init() {}
|
||||
|
||||
// Helper method to construct full URL from base URL and path
|
||||
private static func makeURL(path: String) -> URL {
|
||||
guard let baseURL = baseURLForCurrentEnvironment() else {
|
||||
fatalError("Base URL not configured for current environment")
|
||||
}
|
||||
return baseURL.appendingPathComponent(path)
|
||||
}
|
||||
|
||||
// Helper method to get base URL based on current environment
|
||||
private static func baseURLForCurrentEnvironment() -> URL? {
|
||||
// Determine environment (e.g., staging, production, development) and return appropriate base URL
|
||||
return URL(string: BaseURL.production)
|
||||
}
|
||||
|
||||
struct BaseURL {
|
||||
static let staging = "https://wokaland.com/secret-panel-10102023/hidden-admin-portal-20092023/api/"
|
||||
static let development = "https://wokanative.betadelivery.com/api/"
|
||||
static let production = ""
|
||||
static let production = "https://wokaland.com/secret-panel-10102023/hidden-admin-portal-20092023/api/"
|
||||
|
||||
static let appUrl = "https://apps.apple.com/in/app/woka/id6465305185"
|
||||
}
|
||||
@@ -163,17 +177,5 @@ struct APIEndPoints {
|
||||
static let unique_click_store = makeURL(path: "unique_click_store")
|
||||
}
|
||||
|
||||
// Helper method to construct full URL from base URL and path
|
||||
private static func makeURL(path: String) -> URL {
|
||||
guard let baseURL = baseURLForCurrentEnvironment() else {
|
||||
fatalError("Base URL not configured for current environment")
|
||||
}
|
||||
return baseURL.appendingPathComponent(path)
|
||||
}
|
||||
|
||||
// Helper method to get base URL based on current environment
|
||||
private static func baseURLForCurrentEnvironment() -> URL? {
|
||||
// Determine environment (e.g., staging, production, development) and return appropriate base URL
|
||||
return URL(string: BaseURL.development)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ class NetworkManager{
|
||||
switch response.result {
|
||||
case .success(let value):
|
||||
/*
|
||||
if Sucess == 4 menas user has logined in some other device, logout that user by saying session timeout
|
||||
if Sucess == 4 mea23ns user has logined in some other device, logout that user by saying session timeout
|
||||
*/
|
||||
if value.success == 4{
|
||||
if let topController = UIApplication.topViewController() {
|
||||
|
||||
@@ -76,13 +76,8 @@ class ThemeOneVC: UIViewController {
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
vm.vc = self
|
||||
vm.initView()
|
||||
|
||||
if MyListDataTemp.shareInstance.favListingData?.showData == nil {
|
||||
MyListDataTemp.shareInstance.favListingData = FavouriteListingDM.ResultData(totalRecords: nil, showData: FavouriteListingDM.ResultData.ShowData(hindi: [],english: []),videoData: [],gameData: [],singKaraokeData: [],audioData: [])
|
||||
}
|
||||
vm.initView()
|
||||
vm.setupAvPlayer()
|
||||
|
||||
}
|
||||
|
||||
override func viewWillAppear(_ animated: Bool) {
|
||||
|
||||
@@ -50,6 +50,11 @@ class ThemeOneVM{
|
||||
}
|
||||
|
||||
func initView(){
|
||||
// Make sure to initialize a blank listing
|
||||
if MyListDataTemp.shareInstance.favListingData?.showData == nil {
|
||||
MyListDataTemp.shareInstance.favListingData = FavouriteListingDM.ResultData(totalRecords: nil, showData: FavouriteListingDM.ResultData.ShowData(hindi: [],english: []),videoData: [],gameData: [],singKaraokeData: [],audioData: [])
|
||||
}
|
||||
|
||||
// Update user Data on UI
|
||||
setUserData()
|
||||
|
||||
@@ -62,7 +67,6 @@ class ThemeOneVM{
|
||||
// start the time for moitoring time change.
|
||||
startInitialTimer()
|
||||
|
||||
// moveCloudView()
|
||||
//Handle tap gesutres
|
||||
handleTaps()
|
||||
|
||||
@@ -72,6 +76,7 @@ class ThemeOneVM{
|
||||
//add tap gesutre to the moving live tv
|
||||
addTapGestureToMovingView()
|
||||
|
||||
// to fit the hello and name in center properly without space
|
||||
vc.nameLabel.setContentHuggingPriority(.fittingSizeLevel, for: .horizontal)
|
||||
vc.nameLabel.setContentCompressionResistancePriority(.fittingSizeLevel, for: .horizontal)
|
||||
|
||||
@@ -91,8 +96,15 @@ class ThemeOneVM{
|
||||
if let adsData = AuthFunc.shareInstance.adsData{
|
||||
// check if ads data contains ad for webseries
|
||||
if let themeOneAd = adsData.result?.filter({$0.slug == AdsEnum.themeOne.rawValue}).first, let bannerImage = themeOneAd.advertisement?.bannerImage{
|
||||
vc.adBanner.imageURL(bannerImage, color: .textDarkBlue)
|
||||
vc.adBanner.isHidden = false
|
||||
vc.adBanner.imageURL(bannerImage, color: .textDarkBlue,type: .ads) { [weak self] isDone in
|
||||
guard let self else{return}
|
||||
// if image gives error hide the ad banner
|
||||
if isDone == false{
|
||||
vc.adBanner.isHidden = true
|
||||
}else{
|
||||
vc.adBanner.isHidden = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -542,23 +554,6 @@ class ThemeOneVM{
|
||||
.title(title)
|
||||
.build()
|
||||
|
||||
// Create a JWPlayerConfiguration.
|
||||
// if let adsData = AuthFunc.shareInstance.adsData, let liveTVAd = adsData.result?.filter({$0.slug == AdsEnum.liveTvAd.rawValue}).first, liveTVAd.googleAd != nil, let adConfig = JWAdsBuilder.shareInstace.createAds(adsData: [AdBreakItemStruct(adUrl: URL(string: "https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/single_preroll_skippable&sz=640x480&ciu_szs=300x250%2C728x90&gdfp_req=1&output=vast&unviewed_position_start=1&env=vp&impl=s&correlator=90")!, offset: .preroll())]){
|
||||
// let config = try JWPlayerConfigurationBuilder()
|
||||
// .playlist(items: [item])
|
||||
// .autostart(true)
|
||||
// .advertising(adConfig)
|
||||
// .build()
|
||||
//
|
||||
// vc.config = config
|
||||
// }else{
|
||||
// let config = try JWPlayerConfigurationBuilder()
|
||||
// .playlist(items: [item])
|
||||
// .autostart(true)
|
||||
// .build()
|
||||
//
|
||||
// vc.config = config
|
||||
// }
|
||||
let config = try JWPlayerConfigurationBuilder()
|
||||
.playlist(items: [item])
|
||||
.autostart(true)
|
||||
|
||||
@@ -39,42 +39,85 @@ class UserNotificationVM{
|
||||
|
||||
// check if ads data contains LocalAD for webseries
|
||||
if let advertisement = notificatonAd.advertisement,let bannerImage = advertisement.bannerImage{
|
||||
let height = UIScreen.main.bounds.width * 0.192
|
||||
vc.adViewHeight.constant = height
|
||||
vc.adView.alpha = 0
|
||||
let imageView = UIImageView()
|
||||
|
||||
// Set the image you want to display
|
||||
imageView.imageURL(bannerImage, color: .white)
|
||||
|
||||
// Enable auto-layout
|
||||
imageView.translatesAutoresizingMaskIntoConstraints = false
|
||||
|
||||
// Add the UIImageView to the view
|
||||
vc.adView.addSubview(imageView)
|
||||
|
||||
// Set UIImageView to match the size of the parent UIView
|
||||
NSLayoutConstraint.activate([
|
||||
imageView.leadingAnchor.constraint(equalTo: vc.adView.leadingAnchor),
|
||||
imageView.trailingAnchor.constraint(equalTo: vc.adView.trailingAnchor),
|
||||
imageView.topAnchor.constraint(equalTo: vc.adView.topAnchor),
|
||||
imageView.bottomAnchor.constraint(equalTo: vc.adView.bottomAnchor)
|
||||
])
|
||||
imageView.contentMode = .scaleAspectFit
|
||||
UIView.animate(withDuration: 0.2, animations: { [weak self] in
|
||||
imageView.imageURL(bannerImage, color: .textDarkBlue,type: .ads) { [weak self] isDone in
|
||||
guard let self else{return}
|
||||
vc.adView.alpha = 1
|
||||
vc.adView.isHidden = false
|
||||
})
|
||||
|
||||
vc.adView.addTapGesture {
|
||||
if let adID = notificatonAd.id{
|
||||
PersistentStorage.shared.addAdsCount(adID: adID ,clicks: 1)
|
||||
}
|
||||
if let adLink = notificatonAd.advertisement?.adLink ,let url = URL(string: adLink), UIApplication.shared.canOpenURL(url) {
|
||||
UIApplication.shared.open(url)
|
||||
// if image gives error hide the ad banner
|
||||
if isDone == false{
|
||||
vc.adView.isHidden = true
|
||||
}else{
|
||||
let height = UIScreen.main.bounds.width * 0.192
|
||||
vc.adViewHeight.constant = height
|
||||
// Set the image you want to display
|
||||
imageView.imageURL(bannerImage, color: .white)
|
||||
|
||||
// Enable auto-layout
|
||||
imageView.translatesAutoresizingMaskIntoConstraints = false
|
||||
|
||||
// Add the UIImageView to the view
|
||||
vc.adView.addSubview(imageView)
|
||||
|
||||
// Set UIImageView to match the size of the parent UIView
|
||||
NSLayoutConstraint.activate([
|
||||
imageView.leadingAnchor.constraint(equalTo: vc.adView.leadingAnchor),
|
||||
imageView.trailingAnchor.constraint(equalTo: vc.adView.trailingAnchor),
|
||||
imageView.topAnchor.constraint(equalTo: vc.adView.topAnchor),
|
||||
imageView.bottomAnchor.constraint(equalTo: vc.adView.bottomAnchor)
|
||||
])
|
||||
imageView.contentMode = .scaleAspectFit
|
||||
UIView.animate(withDuration: 0.2, animations: { [weak self] in
|
||||
guard let self else{return}
|
||||
vc.adView.alpha = 1
|
||||
})
|
||||
|
||||
vc.adView.addTapGesture {
|
||||
if let adID = notificatonAd.id{
|
||||
PersistentStorage.shared.addAdsCount(adID: adID ,clicks: 1)
|
||||
}
|
||||
if let adLink = notificatonAd.advertisement?.adLink ,let url = URL(string: adLink), UIApplication.shared.canOpenURL(url) {
|
||||
UIApplication.shared.open(url)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
// let height = UIScreen.main.bounds.width * 0.192
|
||||
// vc.adViewHeight.constant = height
|
||||
// vc.adView.alpha = 0
|
||||
// let imageView = UIImageView()
|
||||
//
|
||||
// // Set the image you want to display
|
||||
// imageView.imageURL(bannerImage, color: .white)
|
||||
//
|
||||
// // Enable auto-layout
|
||||
// imageView.translatesAutoresizingMaskIntoConstraints = false
|
||||
//
|
||||
// // Add the UIImageView to the view
|
||||
// vc.adView.addSubview(imageView)
|
||||
//
|
||||
// // Set UIImageView to match the size of the parent UIView
|
||||
// NSLayoutConstraint.activate([
|
||||
// imageView.leadingAnchor.constraint(equalTo: vc.adView.leadingAnchor),
|
||||
// imageView.trailingAnchor.constraint(equalTo: vc.adView.trailingAnchor),
|
||||
// imageView.topAnchor.constraint(equalTo: vc.adView.topAnchor),
|
||||
// imageView.bottomAnchor.constraint(equalTo: vc.adView.bottomAnchor)
|
||||
// ])
|
||||
// imageView.contentMode = .scaleAspectFit
|
||||
// UIView.animate(withDuration: 0.2, animations: { [weak self] in
|
||||
// guard let self else{return}
|
||||
// vc.adView.alpha = 1
|
||||
// vc.adView.isHidden = false
|
||||
// })
|
||||
//
|
||||
// vc.adView.addTapGesture {
|
||||
// if let adID = notificatonAd.id{
|
||||
// PersistentStorage.shared.addAdsCount(adID: adID ,clicks: 1)
|
||||
// }
|
||||
// if let adLink = notificatonAd.advertisement?.adLink ,let url = URL(string: adLink), UIApplication.shared.canOpenURL(url) {
|
||||
// UIApplication.shared.open(url)
|
||||
// }
|
||||
// }
|
||||
}else if notificatonAd.googleAd != nil{
|
||||
/*
|
||||
Show google ads with dispatch queue.
|
||||
|
||||
@@ -171,6 +171,11 @@ class WokaFMVC: UIViewController {
|
||||
activityIndicator.stopAnimating()
|
||||
playBtn.setImage(UIImage(named: "Reload"), for: .normal)
|
||||
playBtn.isEnabled = true
|
||||
|
||||
// Check if no internet prompt user
|
||||
if CheckReachability.reachability?.isReachable == false{
|
||||
self.toast(msg: K.ConstantString.noInternet, time: 1.6)
|
||||
}
|
||||
}
|
||||
} else if keyPath == "timeControlStatus" {
|
||||
switch vm.player.timeControlStatus {
|
||||
|
||||
@@ -163,24 +163,50 @@ class WokaFMVM{
|
||||
|
||||
// check if ads data contains LocalAD for webseries
|
||||
if let advertisement = fmAd.advertisement,let bannerImage = advertisement.bannerImage{
|
||||
vc.imageAdView.imageURL(bannerImage, color: .white)
|
||||
vc.imageAdView.alpha = 0
|
||||
let height = UIScreen.main.bounds.width * 0.192
|
||||
vc.imageAdHeight.constant = height
|
||||
UIView.animate(withDuration: 0.2, animations: { [weak self] in
|
||||
vc.imageAdView.imageURL(bannerImage, color: .textDarkBlue,type: .ads) { [weak self] isDone in
|
||||
guard let self else{return}
|
||||
vc.imageAdView.alpha = 1
|
||||
vc.imageAdView.isHidden = false
|
||||
})
|
||||
|
||||
vc.imageAdView.addTapGesture {
|
||||
if let adID = fmAd.id{
|
||||
PersistentStorage.shared.addAdsCount(adID: adID ,clicks: 1)
|
||||
}
|
||||
if let adLink = fmAd.advertisement?.adLink ,let url = URL(string: adLink), UIApplication.shared.canOpenURL(url) {
|
||||
UIApplication.shared.open(url)
|
||||
// if image gives error hide the ad banner
|
||||
if isDone == false{
|
||||
vc.imageAdView.isHidden = true
|
||||
}else{
|
||||
vc.imageAdView.isHidden = false
|
||||
vc.imageAdView.alpha = 0
|
||||
let height = UIScreen.main.bounds.width * 0.192
|
||||
vc.imageAdHeight.constant = height
|
||||
UIView.animate(withDuration: 0.2, animations: { [weak self] in
|
||||
guard let self else{return}
|
||||
vc.imageAdView.alpha = 1
|
||||
vc.imageAdView.isHidden = false
|
||||
})
|
||||
|
||||
vc.imageAdView.addTapGesture {
|
||||
if let adID = fmAd.id{
|
||||
PersistentStorage.shared.addAdsCount(adID: adID ,clicks: 1)
|
||||
}
|
||||
if let adLink = fmAd.advertisement?.adLink ,let url = URL(string: adLink), UIApplication.shared.canOpenURL(url) {
|
||||
UIApplication.shared.open(url)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// vc.imageAdView.imageURL(bannerImage, color: .white)
|
||||
// vc.imageAdView.alpha = 0
|
||||
// let height = UIScreen.main.bounds.width * 0.192
|
||||
// vc.imageAdHeight.constant = height
|
||||
// UIView.animate(withDuration: 0.2, animations: { [weak self] in
|
||||
// guard let self else{return}
|
||||
// vc.imageAdView.alpha = 1
|
||||
// vc.imageAdView.isHidden = false
|
||||
// })
|
||||
//
|
||||
// vc.imageAdView.addTapGesture {
|
||||
// if let adID = fmAd.id{
|
||||
// PersistentStorage.shared.addAdsCount(adID: adID ,clicks: 1)
|
||||
// }
|
||||
// if let adLink = fmAd.advertisement?.adLink ,let url = URL(string: adLink), UIApplication.shared.canOpenURL(url) {
|
||||
// UIApplication.shared.open(url)
|
||||
// }
|
||||
// }
|
||||
}else{
|
||||
/*
|
||||
Show google ads with dispatch queue.
|
||||
|
||||
Reference in New Issue
Block a user