- Fixed TC 16, TC 17

- added activity indicators for more vm with retry handling
- fixed a issue where karaoke user view was not reflecting when the player closed
This commit is contained in:
Bilal
2024-08-23 20:34:08 +05:30
parent afbac0bd60
commit 945ae7f45c
17 changed files with 218 additions and 49 deletions

View File

@@ -1586,7 +1586,6 @@
52DAC64A2C2176CB00E2F85B /* ViewModel */,
52DAC6492C21767900E2F85B /* Controller */,
52DAC6472C21762900E2F85B /* WebSeries.storyboard */,
52AC2D262C29791500337473 /* JWPlayerManager.swift */,
52C8D8D32C2D9F3400CA72A6 /* LikeFavCommonFunc.swift */,
);
path = WebSeries;
@@ -1688,6 +1687,7 @@
9C27E1612BDB6F0F00EC1DA9 /* Main */ = {
isa = PBXGroup;
children = (
52AC2D262C29791500337473 /* JWPlayerManager.swift */,
52C1A4DF2C05B670007BAA50 /* Delegate */,
52FDBA792BFF26F9009D7AC7 /* AuthFunc */,
);
@@ -2773,6 +2773,7 @@
INFOPLIST_FILE = WOKA/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = WOKA;
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.entertainment";
INFOPLIST_KEY_NSMicrophoneUsageDescription = "Give Permissions for Karaoke";
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen.storyboard;
INFOPLIST_KEY_UIMainStoryboardFile = Main;
@@ -2812,6 +2813,7 @@
INFOPLIST_FILE = WOKA/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = WOKA;
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.entertainment";
INFOPLIST_KEY_NSMicrophoneUsageDescription = "Give Permissions for Karaoke";
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen.storyboard;
INFOPLIST_KEY_UIMainStoryboardFile = Main;

View File

@@ -96,7 +96,7 @@ class AudioBookHomeVM{
}else{
self.vc.continueWatchingStack.isHidden = false
}
self.continueWatchingData = data.reversed()
self.continueWatchingData = data
self.vc.continueWatchingCV.reloadData()
default:
break

View File

@@ -231,7 +231,7 @@ class GamesDetailVC: UIViewController {
vcPush.postID = gameData?.id
vcPush.orientation = self.gameData?.screenOrientation
vcPush.modalTransitionStyle = .crossDissolve
vcPush.modalPresentationStyle = .fullScreen
vcPush.modalPresentationStyle = .overFullScreen
self.present(vcPush, animated: true)
}

View File

@@ -24,6 +24,10 @@ class GamesWebViewVC: UIViewController, WKNavigationDelegate,UIGestureRecognizer
typealias btnTappedBlock = () -> Void
var btnTapped : btnTappedBlock?
override var prefersStatusBarHidden: Bool {
return true
}
deinit{
NotificationCenter.default.removeObserver(self,name: UIApplication.didEnterBackgroundNotification, object: nil)
NotificationCenter.default.removeObserver(self,name: UIApplication.willEnterForegroundNotification, object: nil)
@@ -63,6 +67,10 @@ class GamesWebViewVC: UIViewController, WKNavigationDelegate,UIGestureRecognizer
NotificationCenter.default.addObserver(self,selector: #selector(appWillEnterForeground),name: UIApplication.willEnterForegroundNotification,object: nil)
}
override func viewDidAppear(_ animated: Bool) {
setNeedsStatusBarAppearanceUpdate()
}
func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool {
return true
}

View File

@@ -537,17 +537,17 @@
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="UBq-Ug-nVj">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<subviews>
<wkWebView contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="k9t-dv-nhb">
<wkWebView contentMode="scaleToFill" allowsLinkPreview="NO" translatesAutoresizingMaskIntoConstraints="NO" id="k9t-dv-nhb">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<wkWebViewConfiguration key="configuration" allowsAirPlayForMediaPlayback="NO" allowsPictureInPictureMediaPlayback="NO">
<dataDetectorTypes key="dataDetectorTypes" none="YES"/>
<audiovisualMediaTypes key="mediaTypesRequiringUserActionForPlayback" none="YES"/>
<wkPreferences key="preferences"/>
<wkPreferences key="preferences" javaScriptCanOpenWindowsAutomatically="YES"/>
</wkWebViewConfiguration>
</wkWebView>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="k9t-dv-nhb" secondAttribute="trailing" id="280-OD-igM"/>
<constraint firstAttribute="bottom" secondItem="k9t-dv-nhb" secondAttribute="bottom" id="LwL-cf-cGz"/>
@@ -576,7 +576,7 @@
</button>
</subviews>
<viewLayoutGuide key="safeArea" id="UAe-my-8xP"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="UBq-Ug-nVj" firstAttribute="top" secondItem="8Dy-BS-4tC" secondAttribute="top" id="9CL-yd-6Hq"/>
<constraint firstItem="UBq-Ug-nVj" firstAttribute="leading" secondItem="UAe-my-8xP" secondAttribute="leading" id="9hb-Yg-ACx"/>

View File

@@ -588,7 +588,7 @@ extension MyListVC : CollectionViewSRC{
}
let sb = UIStoryboard(name: K.StoryBoard.Karaoke, bundle: nil)
let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.Karaoke.karaokeDetailsVC) as! KaraokeDetailsVC
vcPush.modalPresentationStyle = .overCurrentContext
vcPush.modalPresentationStyle = .fullScreen
vcPush.modalTransitionStyle = .crossDissolve
vcPush.karaokeData = karaokeData
vcPush.karaokeIndex = indexPath.row

View File

@@ -43,7 +43,5 @@
<string>audio</string>
<string>remote-notification</string>
</array>
<key>NSMicrophoneUsageDescription</key>
<string>Give Permissions for Karaoke</string>
</dict>
</plist>

View File

@@ -10,6 +10,68 @@ import AVKit
extension AVAsset {
// func writeAudioTrackToURL(_ url: URL, completion: @escaping (Bool, Error?, URL?) -> ()) {
// DispatchQueue.global(qos: .userInitiated).async { [weak self] in
// do {
// guard let audioAsset = try self?.audioAsset() else {
// completion(false, nil, nil)
// return
// }
// audioAsset.writeToURL(url, completion: completion)
// } catch let error as NSError {
// DispatchQueue.main.async {
// completion(false, error, nil)
// }
// }
// }
// }
//
// func writeToURL(_ url: URL, completion: @escaping (Bool, Error?, URL?) -> ()) {
// DispatchQueue.global(qos: .userInitiated).async {
// guard let exportSession = AVAssetExportSession(asset: self, presetName: AVAssetExportPresetAppleM4A) else {
// DispatchQueue.main.async {
// completion(false, nil, nil)
// }
// return
// }
//
// let audioMix = AVMutableAudioMix()
// var inputParameters = [AVMutableAudioMixInputParameters]()
// let volume: Float = 0.4
//
// for track in self.tracks(withMediaType: .audio) {
// let audioInputParams = AVMutableAudioMixInputParameters(track: track)
// audioInputParams.setVolume(volume, at: .zero)
// inputParameters.append(audioInputParams)
// }
//
// audioMix.inputParameters = inputParameters
// exportSession.audioMix = audioMix
// exportSession.outputFileType = .m4a
// exportSession.outputURL = url
//
// DispatchQueue.main.async {
// Utilities.startProgressHUD(msg: "Preparing")
// }
//
// exportSession.exportAsynchronously {
// DispatchQueue.main.async {
// switch exportSession.status {
// case .completed:
// Utilities.dismissProgressHUD()
// completion(true, nil, url)
// case .unknown, .waiting, .exporting, .failed, .cancelled:
// Utilities.dismissProgressHUD()
// completion(false, nil, nil)
// @unknown default:
// Utilities.dismissProgressHUD()
// completion(false, nil, nil)
// }
// }
// }
// }
// }
func writeAudioTrackToURL(_ url: URL, completion: @escaping (Bool, Error?, URL?) -> ()) {
do {
let audioAsset = try self.audioAsset()

View File

@@ -91,7 +91,7 @@ class KaraokeListingVM{
}else{
self.vc.continueWatchingStack.isHidden = false
}
self.continueWatchingData = data.reversed()
self.continueWatchingData = data
self.vc.continueWatchingCV.reloadData()
default:
break

View File

@@ -127,8 +127,7 @@ class JWPlayerManager {
.autostart(false)
.build()
}
DispatchQueue.main.async {
playerVC.videoIndex = startIndex
playerVC.contentType = contentType

View File

@@ -675,14 +675,80 @@
</stackView>
</subviews>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="7bh-PD-sIH">
<rect key="frame" x="164.5" y="441" width="85" height="20"/>
<subviews>
<activityIndicatorView hidden="YES" opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" hidesWhenStopped="YES" style="medium" translatesAutoresizingMaskIntoConstraints="NO" id="S8Q-xR-4aq">
<rect key="frame" x="0.0" y="0.0" width="85" height="20"/>
<color key="color" name="ImageDarkBlue"/>
</activityIndicatorView>
<button hidden="YES" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="aPf-ys-h6r" customClass="LocalisedElementsButton" customModule="WOKA" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="85" height="0.0"/>
<color key="tintColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<state key="normal" title="Button"/>
<buttonConfiguration key="configuration" style="plain">
<attributedString key="attributedTitle">
<fragment content="Retry?">
<attributes>
<font key="NSFont" size="18" name="Exo2-Bold"/>
<paragraphStyle key="NSParagraphStyle" alignment="natural" lineBreakMode="wordWrapping" baseWritingDirection="natural" tighteningFactorForTruncation="0.0"/>
</attributes>
</fragment>
</attributedString>
</buttonConfiguration>
<connections>
<action selector="retryBtnTapped:" destination="Faj-VN-SMZ" eventType="touchUpInside" id="Af9-fV-nFb"/>
<action selector="retryBtnTapped:" destination="GSM-1I-akm" eventType="touchUpInside" id="nuc-U3-aV5"/>
</connections>
</button>
</subviews>
<constraints>
<constraint firstAttribute="width" constant="85" id="73m-xm-vKV"/>
</constraints>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="xv5-81-JIV">
<rect key="frame" x="164.5" y="708.5" width="85" height="20"/>
<subviews>
<activityIndicatorView hidden="YES" opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" hidesWhenStopped="YES" style="medium" translatesAutoresizingMaskIntoConstraints="NO" id="dLn-zw-LM2">
<rect key="frame" x="0.0" y="0.0" width="85" height="20"/>
<color key="color" name="ImageDarkBlue"/>
</activityIndicatorView>
<button hidden="YES" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="zAr-x7-tdY" customClass="LocalisedElementsButton" customModule="WOKA" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="85" height="0.0"/>
<color key="tintColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<state key="normal" title="Button"/>
<buttonConfiguration key="configuration" style="plain">
<attributedString key="attributedTitle">
<fragment content="Retry?">
<attributes>
<font key="NSFont" size="18" name="Exo2-Bold"/>
<paragraphStyle key="NSParagraphStyle" alignment="natural" lineBreakMode="wordWrapping" baseWritingDirection="natural" tighteningFactorForTruncation="0.0"/>
</attributes>
</fragment>
</attributedString>
</buttonConfiguration>
<connections>
<action selector="retryBtnTapped:" destination="Faj-VN-SMZ" eventType="touchUpInside" id="UMU-eW-aCl"/>
<action selector="retryBtnTapped:" destination="GSM-1I-akm" eventType="touchUpInside" id="UXR-PQ-LK6"/>
</connections>
</button>
</subviews>
<constraints>
<constraint firstAttribute="width" constant="85" id="IS2-Ht-kXi"/>
</constraints>
</stackView>
</subviews>
<viewLayoutGuide key="safeArea" id="0M9-05-bMu"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="4W1-eK-C1H" firstAttribute="top" secondItem="5jA-W9-hbI" secondAttribute="top" id="7bL-Mb-hjL"/>
<constraint firstItem="xv5-81-JIV" firstAttribute="centerY" secondItem="31Z-fz-1ec" secondAttribute="centerY" id="GYf-qb-bnc"/>
<constraint firstAttribute="bottom" secondItem="4W1-eK-C1H" secondAttribute="bottom" id="WJm-Hb-YPE"/>
<constraint firstItem="g46-bK-0uI" firstAttribute="leading" secondItem="0M9-05-bMu" secondAttribute="leading" id="XVC-zW-BA2"/>
<constraint firstItem="7bh-PD-sIH" firstAttribute="centerX" secondItem="0M9-05-bMu" secondAttribute="centerX" id="bwb-To-eZF"/>
<constraint firstItem="0M9-05-bMu" firstAttribute="bottom" secondItem="g46-bK-0uI" secondAttribute="bottom" constant="5" id="cSM-FD-Dv0"/>
<constraint firstItem="7bh-PD-sIH" firstAttribute="centerY" secondItem="xup-gW-Kjh" secondAttribute="centerY" id="cno-SH-4xz"/>
<constraint firstItem="xv5-81-JIV" firstAttribute="centerX" secondItem="0M9-05-bMu" secondAttribute="centerX" id="hlZ-e3-0QB"/>
<constraint firstItem="g46-bK-0uI" firstAttribute="top" secondItem="0M9-05-bMu" secondAttribute="top" constant="10" id="jKz-c8-lw2"/>
<constraint firstItem="0M9-05-bMu" firstAttribute="trailing" secondItem="4W1-eK-C1H" secondAttribute="trailing" id="pKc-CH-QAE"/>
<constraint firstAttribute="trailing" secondItem="g46-bK-0uI" secondAttribute="trailing" id="r57-h3-NbE"/>
@@ -690,8 +756,14 @@
</constraints>
</view>
<connections>
<outlet property="blogActivityIndicator" destination="S8Q-xR-4aq" id="OwQ-jA-29E"/>
<outlet property="blogRetryBtn" destination="aPf-ys-h6r" id="fRu-AA-2ti"/>
<outlet property="blogRetryStack" destination="7bh-PD-sIH" id="F4y-Fk-af0"/>
<outlet property="blogsCollectionView" destination="xup-gW-Kjh" id="BO7-LF-aAg"/>
<outlet property="homeBtn" destination="4TT-Wr-ovV" id="mPm-rr-jvC"/>
<outlet property="songActivityIndicator" destination="dLn-zw-LM2" id="qZm-9Z-va8"/>
<outlet property="songRetry" destination="zAr-x7-tdY" id="0TO-oQ-fEw"/>
<outlet property="songRetryStack" destination="xv5-81-JIV" id="HNO-pe-3Gt"/>
<outlet property="songTableView" destination="31Z-fz-1ec" id="K2B-qg-URW"/>
</connections>
</viewController>
@@ -1330,7 +1402,7 @@
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
<systemColor name="systemBrownColor">
<color red="0.63529411764705879" green="0.51764705882352946" blue="0.36862745098039218" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color red="0.63529411759999999" green="0.51764705879999995" blue="0.36862745099999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor>
</resources>
</document>

View File

@@ -14,6 +14,13 @@ class MoreVC: UIViewController {
@IBOutlet weak var homeBtn: UIView!
@IBOutlet weak var songTableView: UITableView!
@IBOutlet weak var blogRetryStack: UIStackView!
@IBOutlet weak var blogActivityIndicator: UIActivityIndicatorView!
@IBOutlet weak var blogRetryBtn: LocalisedElementsButton!
@IBOutlet weak var songRetryStack: UIStackView!
@IBOutlet weak var songActivityIndicator: UIActivityIndicatorView!
@IBOutlet weak var songRetry: LocalisedElementsButton!
var vm = MoreVM()
var timeObserverToken: Any?
@@ -43,6 +50,8 @@ class MoreVC: UIViewController {
let item = JwPlayerItemCreate(url: APIEndPoints.StaticURLs.masilaUrl, poster: nil, titles: "Masila")
JWPlayerManager.shared.presentPlayer(from: self, playerItems: [item], contentType: .trailer, videoIDs: [0])
}
@IBAction func retryBtnTapped(_ sender: LocalisedElementsButton) {
}
}
// MARK: - TableView DataSource , Delegates

View File

@@ -9,7 +9,7 @@ import UIKit
import JWPlayerKit
import AVKit
class PlayerVC: JWPlayerViewController, JWPlayerViewControllerDelegate{
class PlayerVC: JWPlayerViewController, JWPlayerViewControllerDelegate {
@IBOutlet weak var backButton: UIButton!
var previousScale: CGFloat = 1.0
@@ -52,8 +52,8 @@ class PlayerVC: JWPlayerViewController, JWPlayerViewControllerDelegate{
override func viewDidLoad() {
super.viewDidLoad()
player.configurePlayer(with: config)
self.delegate = self
player.configurePlayer(with: config)
vm.vc = self
vm.initView()
//bring back button to the front
@@ -158,6 +158,7 @@ class PlayerVC: JWPlayerViewController, JWPlayerViewControllerDelegate{
}
if isDone{
Utilities.dismissProgressHUD()
K.GVar.reloadContinueAudioBooks = true
vm.handleBackAction()
}else{
Utilities.dismissProgressHUD()
@@ -230,7 +231,7 @@ class PlayerVC: JWPlayerViewController, JWPlayerViewControllerDelegate{
vm.updateUserView()
print("PlayList Over", vm.currentPlayingIndex)
}
override func jwplayer(_ player: any JWPlayer, didLoadPlaylist playlist: [JWPlayerItem]) {
super.jwplayer(player, didLoadPlaylist: playlist)
print("Playlist loaded")
@@ -246,15 +247,14 @@ class PlayerVC: JWPlayerViewController, JWPlayerViewControllerDelegate{
if let videoIndex,vm.currentPlayingIndex == -1 && (index != videoIndex){
return
}
}
if vm.currentPlayingIndex != -1 && vm.currentPlayingIndex != index{
// so update the loaded index and increase the current playing index
vm.updateUserView()
vm.currentPlayingIndex = Int(index)
}else{
vm.currentPlayingIndex = Int(index)
if vm.currentPlayingIndex != -1 && vm.currentPlayingIndex != index{
// so update the loaded index and increase the current playing index
vm.updateUserView()
vm.currentPlayingIndex = Int(index)
}else{
vm.currentPlayingIndex = Int(index)
}
}
}
@@ -295,7 +295,7 @@ class PlayerVC: JWPlayerViewController, JWPlayerViewControllerDelegate{
}
print("IsReady")
}
override func jwplayer(_ player: JWPlayer, failedWithSetupError code: UInt, message: String) {
super.jwplayer(player, failedWithSetupError: code, message: message)
print("Setup Error: \(code) - \(message)")

View File

@@ -189,14 +189,14 @@ extension ThemeOneVC{
// vm.playerItem.addObserver(self, forKeyPath: "isPlaybackLikelyToKeepUp", options: [.new, .old], context: nil)
}
override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {
override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?){
//this will oberver if player loads the url or fails
if keyPath == "status" {
if vm.playerItem.status == .readyToPlay {
print("Theme 2 Player is ready to play")
print("Theme 1 Player is ready to play")
vm.avPlayer.play()
} else if vm.playerItem.status == .failed {
print("Theme 2 Player failed to load")
print("Theme 1 Player failed to load")
vm.setupAvPlayer()
}
}
@@ -206,13 +206,13 @@ extension ThemeOneVC{
if let player = object as? AVPlayer {
switch player.timeControlStatus {
case .waitingToPlayAtSpecifiedRate:
print("Theme 2 Player Buffering...")
print("Theme 1 Player Buffering...")
vm.startStopActivity(isStart: true)
case .playing:
print("Theme 2 Player Playing")
print("Theme 1 Player Playing")
vm.startStopActivity(isStart: false)
case .paused:
print("Theme 2 Player Paused")
print("Theme 1 Player Paused")
// check if app is in background return it
if UIApplication.shared.applicationState == .background {return}
@@ -229,7 +229,7 @@ extension ThemeOneVC{
}
@unknown default:
print("Theme 2 Player Unknown status")
print("Theme 1 Player Unknown status")
}
}
}

View File

@@ -104,9 +104,10 @@ class MoreVM{
// MARK: - Get BLogs Data
func getBLogs(){
Utilities.startProgressHUD()
vc.blogActivityIndicator.startAnimating()
NetworkManager.shareInstance.apiRequest(url: APIEndPoints.Home.blogs, method: .get) { [weak self](result : Result<BaseResponseModel<BlogDM>, NetworkManager.APIError>) in
guard let self else{return}
Utilities.dismissProgressHUD()
switch result{
case .success(let data):
switch data.success{
@@ -114,26 +115,32 @@ class MoreVM{
/*
Error
*/
Utilities.dismissProgressHUD()
vc.toast(msg: data.message ?? "Unrecognised error" , time: 2)
vc.blogActivityIndicator.stopAnimating()
vc.blogRetryBtn.isHidden = false
vc.toast(msg: data.message ?? "Unrecognised error" , time: 1.5)
case 1:
Utilities.dismissProgressHUD()
vc.blogActivityIndicator.stopAnimating()
vc.blogRetryBtn.isHidden = true
guard let data = data.data?.blogs else{return}
blogData = data
vc.blogsCollectionView.reloadData()
default:
break
vc.blogActivityIndicator.stopAnimating()
vc.blogRetryBtn.isHidden = false
}
case .failure(let error):
Utilities.dismissProgressHUD()
vc.toast(msg: error.localizedDescription , time: 2)
vc.blogActivityIndicator.stopAnimating()
vc.blogRetryBtn.isHidden = false
vc.toast(msg: error.localizedDescription , time: 1.5)
}
}
}
func getSong(){
vc.songActivityIndicator.startAnimating()
NetworkManager.shareInstance.apiRequest(url: APIEndPoints.Home.song_listing, method: .post) { [weak self](result : Result<BaseResponseModel<SongBlogDM>, NetworkManager.APIError>) in
guard let self else{return}
Utilities.dismissProgressHUD()
switch result{
case .success(let data):
switch data.success{
@@ -141,20 +148,24 @@ class MoreVM{
/*
Error
*/
Utilities.dismissProgressHUD()
vc.toast(msg: data.message ?? "Unrecognised error" , time: 2)
vc.songActivityIndicator.stopAnimating()
vc.songRetry.isHidden = false
vc.toast(msg: data.message ?? "Unrecognised error" , time: 1.5)
case 1:
Utilities.dismissProgressHUD()
vc.songActivityIndicator.stopAnimating()
vc.songRetry.isHidden = true
guard let data = data.data?.paintData else{return}
songData = data
vc.songTableView.reloadData()
break
default:
break
vc.songActivityIndicator.stopAnimating()
vc.songRetry.isHidden = false
}
case .failure(let error):
Utilities.dismissProgressHUD()
vc.toast(msg: error.localizedDescription , time: 2)
vc.songActivityIndicator.stopAnimating()
vc.songRetry.isHidden = false
vc.toast(msg: error.localizedDescription , time: 1.5)
}
}
}

View File

@@ -138,6 +138,7 @@ class ThemeOneVM{
if let rootViewController = UIApplication.shared.mainKeyWindow?.rootViewController {
if let topVC = topVC(in: rootViewController) {
if topVC is HomeVC{
shouldAnimate = false
avPlayer.pause()
handleBackground()
} else {
@@ -155,7 +156,14 @@ class ThemeOneVM{
if let rootViewController = UIApplication.shared.mainKeyWindow?.rootViewController {
if let topVC = topVC(in: rootViewController) {
if topVC is HomeVC{
avPlayer.play()
shouldAnimate = true
DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) { [weak self] in
guard let self else{return}
moveLiveTVView()
}
if let player = avPlayer{
player.play()
}
handleBackground()
} else {
print("The top view controller is not HomeVC")

View File

@@ -146,7 +146,7 @@ class WebSeriesVM{
}else{
self.vc.continueWatchingStack.isHidden = false
}
self.continueWatchingData = data.reversed()
self.continueWatchingData = data
self.vc.continueWatchingCV.reloadData()
default:
break