Merge branch 'main' of ssh://git.zhenbs.com:2222/3-group-ios/Music_Player3
# Conflicts: # relax.offline.mp3.music.xcodeproj/project.pbxproj
This commit is contained in:
commit
a9c62a68f6
@ -53,7 +53,7 @@
|
|||||||
<CommandLineArguments>
|
<CommandLineArguments>
|
||||||
<CommandLineArgument
|
<CommandLineArgument
|
||||||
argument = "-FIRDebugEnabled"
|
argument = "-FIRDebugEnabled"
|
||||||
isEnabled = "NO">
|
isEnabled = "YES">
|
||||||
</CommandLineArgument>
|
</CommandLineArgument>
|
||||||
<CommandLineArgument
|
<CommandLineArgument
|
||||||
argument = "-FIRDebugDisabled"
|
argument = "-FIRDebugDisabled"
|
||||||
|
|||||||
@ -39,6 +39,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
|||||||
switch_lunch()
|
switch_lunch()
|
||||||
//执行用户启动事件日志
|
//执行用户启动事件日志
|
||||||
MP_AnalyticsManager.shared.user_launchAction()
|
MP_AnalyticsManager.shared.user_launchAction()
|
||||||
|
// let numbers = [0]
|
||||||
|
// let _ = numbers[1]
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
func application(_ application: UIApplication, handleEventsForBackgroundURLSession identifier: String, completionHandler: @escaping () -> Void) {
|
func application(_ application: UIApplication, handleEventsForBackgroundURLSession identifier: String, completionHandler: @escaping () -> Void) {
|
||||||
|
|||||||
@ -29,58 +29,23 @@ class MP_LunchViewController: UIViewController {
|
|||||||
timer.preferredFramesPerSecond = 20
|
timer.preferredFramesPerSecond = 20
|
||||||
//开辟线程
|
//开辟线程
|
||||||
timer.add(to: RunLoop.current, forMode: .common)
|
timer.add(to: RunLoop.current, forMode: .common)
|
||||||
//获取idfa
|
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
|
||||||
_ = requestTrackingAuthorization(self)
|
[weak self] in
|
||||||
// MP_AnalyticsManager.shared.getOpenStatus { [weak self] open in
|
guard let self = self else {return}
|
||||||
// guard let self = self else {return}
|
requestTrackingAuthorization { idfa in
|
||||||
// if open {
|
if let idfa = idfa {
|
||||||
// //根据ip值确定进入那个页面
|
print("用户同意授权-idfa:\(idfa)")
|
||||||
// MP_NetWorkManager.shared.requestIPInfo { statu in
|
}
|
||||||
// if statu == true {
|
}
|
||||||
// //允许进入b面
|
}
|
||||||
// print("BLog")
|
MP_AnalyticsManager.shared.getOpenStatus { [weak self] open in
|
||||||
// self.completionBlock = {
|
guard let self = self else {return}
|
||||||
// DispatchQueue.main.async {
|
if open {
|
||||||
// [weak self] in
|
//根据ip值确定进入那个页面
|
||||||
// guard let self = self else {return}
|
MP_NetWorkManager.shared.requestIPInfo { statu in
|
||||||
// //停止计时器
|
if statu == true {
|
||||||
// timer.isPaused = true
|
//允许进入b面
|
||||||
// //加载完毕,判断并跳转
|
print("BLog")
|
||||||
// accessAppdelegate.switch_positive()
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }else {
|
|
||||||
// print("ALog")
|
|
||||||
// //打开A面
|
|
||||||
// self.completionBlock = {
|
|
||||||
// DispatchQueue.main.async {
|
|
||||||
// [weak self] in
|
|
||||||
// guard let self = self else {return}
|
|
||||||
// //停止计时器
|
|
||||||
// timer.isPaused = true
|
|
||||||
// //加载完毕,判断并跳转
|
|
||||||
// accessAppdelegate.switch_aSide()
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }else {
|
|
||||||
// print("ALog")
|
|
||||||
// //打开A面
|
|
||||||
// completionBlock = {
|
|
||||||
// DispatchQueue.main.async {
|
|
||||||
// [weak self] in
|
|
||||||
// guard let self = self else {return}
|
|
||||||
// //停止计时器
|
|
||||||
// timer.isPaused = true
|
|
||||||
// //加载完毕,判断并跳转
|
|
||||||
// accessAppdelegate.switch_aSide()
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//启动计时器
|
|
||||||
timer.isPaused = false
|
|
||||||
self.completionBlock = {
|
self.completionBlock = {
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
[weak self] in
|
[weak self] in
|
||||||
@ -93,6 +58,50 @@ class MP_LunchViewController: UIViewController {
|
|||||||
MPPositive_BrowseLoadViewModel.shared.reloadBrowseLists()
|
MPPositive_BrowseLoadViewModel.shared.reloadBrowseLists()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}else {
|
||||||
|
print("ALog")
|
||||||
|
//打开A面
|
||||||
|
self.completionBlock = {
|
||||||
|
DispatchQueue.main.async {
|
||||||
|
[weak self] in
|
||||||
|
guard let self = self else {return}
|
||||||
|
//停止计时器
|
||||||
|
timer.isPaused = true
|
||||||
|
//加载完毕,判断并跳转
|
||||||
|
accessAppdelegate.switch_aSide()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
print("ALog")
|
||||||
|
//打开A面
|
||||||
|
completionBlock = {
|
||||||
|
DispatchQueue.main.async {
|
||||||
|
[weak self] in
|
||||||
|
guard let self = self else {return}
|
||||||
|
//停止计时器
|
||||||
|
timer.isPaused = true
|
||||||
|
//加载完毕,判断并跳转
|
||||||
|
accessAppdelegate.switch_aSide()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//启动计时器
|
||||||
|
timer.isPaused = false
|
||||||
|
// self.completionBlock = {
|
||||||
|
// DispatchQueue.main.async {
|
||||||
|
// [weak self] in
|
||||||
|
// guard let self = self else {return}
|
||||||
|
// //停止计时器
|
||||||
|
// timer.isPaused = true
|
||||||
|
// //加载完毕,判断并跳转
|
||||||
|
// accessAppdelegate.switch_positive()
|
||||||
|
// //获取首页
|
||||||
|
// MPPositive_BrowseLoadViewModel.shared.reloadBrowseLists()
|
||||||
|
// }
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
deinit {
|
deinit {
|
||||||
//销毁计时器
|
//销毁计时器
|
||||||
|
|||||||
@ -177,43 +177,45 @@ func switchPlayTypeBtnIcon(_ btn:UIButton) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
///请求广告授权
|
///请求广告授权
|
||||||
func requestTrackingAuthorization(_ observe:UIViewController,max:Int = 0) -> Bool {
|
func requestTrackingAuthorization(completion: @escaping (String?) -> Void) {
|
||||||
if #available(iOS 14, *) {
|
if #available(iOS 14, *) {
|
||||||
// 检查当前的跟踪管理器状态
|
var attemptsLeft = 3
|
||||||
let status = ATTrackingManager.trackingAuthorizationStatus
|
|
||||||
switch status {
|
func requestAuth() {
|
||||||
case .notDetermined:
|
|
||||||
// 处理未知授权状态
|
|
||||||
print("未知的跟踪状态")
|
|
||||||
ATTrackingManager.requestTrackingAuthorization { status in
|
ATTrackingManager.requestTrackingAuthorization { status in
|
||||||
let isAuthorized = status == .authorized
|
switch status {
|
||||||
DispatchQueue.main.async {
|
|
||||||
let new = max + 1
|
|
||||||
if new < 3 {
|
|
||||||
_ = requestTrackingAuthorization(observe, max: new)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
case .authorized:
|
case .authorized:
|
||||||
// 用户授予了权限,可以获取 IDFA
|
let idfa = ASIdentifierManager.shared().advertisingIdentifier.uuidString
|
||||||
print("用户授权跟踪")
|
print("Authorized: IDFA = \(idfa)")
|
||||||
return true
|
completion(idfa)
|
||||||
case .denied:
|
case .denied, .restricted:
|
||||||
print("用户拒绝跟踪")
|
print("Denied or Restricted")
|
||||||
default:()
|
completion(nil)
|
||||||
print("跟踪状态受限")
|
case .notDetermined:
|
||||||
}
|
print("Not Determined")
|
||||||
return false
|
attemptsLeft -= 1
|
||||||
|
if attemptsLeft > 0 {
|
||||||
|
requestAuth() // 继续请求直到达到最大尝试次数
|
||||||
} else {
|
} else {
|
||||||
return true
|
print("Reached maximum number of attempts")
|
||||||
|
completion(nil)
|
||||||
|
}
|
||||||
|
@unknown default:
|
||||||
|
print("Unknown status")
|
||||||
|
completion(nil)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
///获取IDFA
|
}
|
||||||
func getIDFA(_ observe:UIViewController) -> UUID? {
|
|
||||||
if requestTrackingAuthorization(observe) {
|
requestAuth() // 第一次请求
|
||||||
let idfa = ASIdentifierManager.shared().advertisingIdentifier
|
|
||||||
return idfa
|
|
||||||
} else {
|
} else {
|
||||||
return nil
|
if ASIdentifierManager.shared().isAdvertisingTrackingEnabled {
|
||||||
|
let idfa = ASIdentifierManager.shared().advertisingIdentifier.uuidString
|
||||||
|
print("Tracking enabled: IDFA = \(idfa)")
|
||||||
|
completion(idfa)
|
||||||
|
} else {
|
||||||
|
print("Tracking not enabled")
|
||||||
|
completion(nil)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -63,16 +63,16 @@ class MP_NetWorkManager: NSObject {
|
|||||||
private let youTubeKeys:[String] = ["MUSIC_VIDEO_TYPE_ATV","MUSIC_VIDEO_TYPE_OMV","MUSIC_PAGE_TYPE_ALBUM","MUSIC_PAGE_TYPE_ARTIST","MUSIC_PAGE_TYPE_PLAYLIST","MUSIC_PAGE_TYPE_TRACK_LYRICS","MUSIC_PAGE_TYPE_TRACK_RELATED"]
|
private let youTubeKeys:[String] = ["MUSIC_VIDEO_TYPE_ATV","MUSIC_VIDEO_TYPE_OMV","MUSIC_PAGE_TYPE_ALBUM","MUSIC_PAGE_TYPE_ARTIST","MUSIC_PAGE_TYPE_PLAYLIST","MUSIC_PAGE_TYPE_TRACK_LYRICS","MUSIC_PAGE_TYPE_TRACK_RELATED"]
|
||||||
///禁止接入IP信息组
|
///禁止接入IP信息组
|
||||||
private let banIPs:[String] = [
|
private let banIPs:[String] = [
|
||||||
"CN",
|
// "CN",
|
||||||
"HK",
|
// "HK",
|
||||||
"TW",
|
// "TW",
|
||||||
"JP",
|
// "JP",
|
||||||
"KR",
|
// "KR",
|
||||||
"GB",
|
// "GB",
|
||||||
"CH",
|
// "CH",
|
||||||
"BE",
|
// "BE",
|
||||||
"MO",
|
// "MO",
|
||||||
"SG"
|
// "SG"
|
||||||
]
|
]
|
||||||
//网络状态
|
//网络状态
|
||||||
enum NetWorkStatus: String {
|
enum NetWorkStatus: String {
|
||||||
|
|||||||
@ -56,6 +56,11 @@ class MPPositive_MoreSongOperationsViewController: UIViewController {
|
|||||||
private let MPPositive_MoreOperationDownLoadTableViewCellID = "MPPositive_MoreOperationDownLoadTableViewCell"
|
private let MPPositive_MoreOperationDownLoadTableViewCellID = "MPPositive_MoreOperationDownLoadTableViewCell"
|
||||||
private var song:MPPositive_SongItemModel!{
|
private var song:MPPositive_SongItemModel!{
|
||||||
didSet{
|
didSet{
|
||||||
|
DispatchQueue.main.async {
|
||||||
|
[weak self] in
|
||||||
|
guard let self = self else {return}
|
||||||
|
// MP_HUD.hideNow()
|
||||||
|
view.isUserInteractionEnabled = true
|
||||||
iconImageView.kf.setImage(with: URL(string: song.reviewUrls?.last ?? ""), placeholder: placeholderImage)
|
iconImageView.kf.setImage(with: URL(string: song.reviewUrls?.last ?? ""), placeholder: placeholderImage)
|
||||||
titleLabel.text = song.title
|
titleLabel.text = song.title
|
||||||
subtitleLabel.text = song.shortBylineText
|
subtitleLabel.text = song.shortBylineText
|
||||||
@ -65,6 +70,7 @@ class MPPositive_MoreSongOperationsViewController: UIViewController {
|
|||||||
isLoaded = MPPositive_DownloadItemModel.fetch(.init(format: "videoId == %@", song.videoId)).count != 0
|
isLoaded = MPPositive_DownloadItemModel.fetch(.init(format: "videoId == %@", song.videoId)).count != 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
private var isLoaded:Bool = false{
|
private var isLoaded:Bool = false{
|
||||||
didSet{
|
didSet{
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
@ -83,7 +89,120 @@ class MPPositive_MoreSongOperationsViewController: UIViewController {
|
|||||||
self?.song = song
|
self?.song = song
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//通过browseViewModel加载更多框
|
||||||
|
init(_ browseViewModel:MPPositive_BrowseItemViewModel) {
|
||||||
|
super.init(nibName: nil, bundle: nil)
|
||||||
|
view.isUserInteractionEnabled = false
|
||||||
|
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
|
||||||
|
[weak self] in
|
||||||
|
guard let self = self else {return}
|
||||||
|
// MP_HUD.loading()
|
||||||
|
//发起网络请求补全数据
|
||||||
|
MP_NetWorkManager.shared.requestNextList("", videoId: browseViewModel.browseItem.videoId ?? "") { [weak self] listSongs in
|
||||||
|
guard let first = listSongs.first else {return}
|
||||||
|
let group = DispatchGroup()
|
||||||
|
group.enter()
|
||||||
|
improveDataforLycirsAndRelated(first) {[weak self] (result) in
|
||||||
|
first.lyricsID = result.0
|
||||||
|
first.relatedID = result.1
|
||||||
|
group.leave()
|
||||||
|
}
|
||||||
|
group.enter()
|
||||||
|
//补全资源路径组和封面路径组
|
||||||
|
improveDataforResouceAndCover(first) {[weak self] resourceUrls, coverUrls in
|
||||||
|
if let resourceUrls = resourceUrls {
|
||||||
|
first.resourceUrls = resourceUrls.0
|
||||||
|
first.itags = resourceUrls.1
|
||||||
|
first.mimeTypes = resourceUrls.2
|
||||||
|
}
|
||||||
|
first.coverUrls = coverUrls
|
||||||
|
group.leave()
|
||||||
|
}
|
||||||
|
group.notify(queue: .main, execute: {
|
||||||
|
[weak self] in
|
||||||
|
//补全了数据
|
||||||
|
guard let self = self else {return}
|
||||||
|
song = first
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//通过SearchResultItemViewModel加载更多框
|
||||||
|
init(_ searchResultItemViewModel:MPPositive_SearchResultItemViewModel) {
|
||||||
|
super.init(nibName: nil, bundle: nil)
|
||||||
|
view.isUserInteractionEnabled = false
|
||||||
|
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
|
||||||
|
[weak self] in
|
||||||
|
guard let self = self else {return}
|
||||||
|
// MP_HUD.loading()
|
||||||
|
//发起网络请求补全数据
|
||||||
|
MP_NetWorkManager.shared.requestNextList("", videoId: searchResultItemViewModel.item.videoId ?? "") { [weak self] listSongs in
|
||||||
|
guard let first = listSongs.first else {return}
|
||||||
|
let group = DispatchGroup()
|
||||||
|
group.enter()
|
||||||
|
improveDataforLycirsAndRelated(first) {[weak self] (result) in
|
||||||
|
first.lyricsID = result.0
|
||||||
|
first.relatedID = result.1
|
||||||
|
group.leave()
|
||||||
|
}
|
||||||
|
group.enter()
|
||||||
|
//补全资源路径组和封面路径组
|
||||||
|
improveDataforResouceAndCover(first) {[weak self] resourceUrls, coverUrls in
|
||||||
|
if let resourceUrls = resourceUrls {
|
||||||
|
first.resourceUrls = resourceUrls.0
|
||||||
|
first.itags = resourceUrls.1
|
||||||
|
first.mimeTypes = resourceUrls.2
|
||||||
|
}
|
||||||
|
first.coverUrls = coverUrls
|
||||||
|
group.leave()
|
||||||
|
}
|
||||||
|
group.notify(queue: .main, execute: {
|
||||||
|
[weak self] in
|
||||||
|
//补全了数据
|
||||||
|
guard let self = self else {return}
|
||||||
|
song = first
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//通过collectionSongViewModel加载更多框
|
||||||
|
init(_ collectionSongViewModel:MPPositive_CollectionSongViewModel) {
|
||||||
|
super.init(nibName: nil, bundle: nil)
|
||||||
|
view.isUserInteractionEnabled = false
|
||||||
|
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
|
||||||
|
[weak self] in
|
||||||
|
guard let self = self else {return}
|
||||||
|
// MP_HUD.loading()
|
||||||
|
//发起网络请求补全数据
|
||||||
|
MP_NetWorkManager.shared.requestNextList("", videoId: collectionSongViewModel.collectionSong.videoId ?? ""){ [weak self] listSongs in
|
||||||
|
guard let first = listSongs.first else {return}
|
||||||
|
let group = DispatchGroup()
|
||||||
|
group.enter()
|
||||||
|
improveDataforLycirsAndRelated(first) {[weak self] (result) in
|
||||||
|
first.lyricsID = result.0
|
||||||
|
first.relatedID = result.1
|
||||||
|
group.leave()
|
||||||
|
}
|
||||||
|
group.enter()
|
||||||
|
//补全资源路径组和封面路径组
|
||||||
|
improveDataforResouceAndCover(first) {[weak self] resourceUrls, coverUrls in
|
||||||
|
if let resourceUrls = resourceUrls {
|
||||||
|
first.resourceUrls = resourceUrls.0
|
||||||
|
first.itags = resourceUrls.1
|
||||||
|
first.mimeTypes = resourceUrls.2
|
||||||
|
}
|
||||||
|
first.coverUrls = coverUrls
|
||||||
|
group.leave()
|
||||||
|
}
|
||||||
|
group.notify(queue: .main, execute: {
|
||||||
|
[weak self] in
|
||||||
|
//补全了数据
|
||||||
|
guard let self = self else {return}
|
||||||
|
song = first
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
required init?(coder: NSCoder) {
|
required init?(coder: NSCoder) {
|
||||||
super.init(coder: coder)
|
super.init(coder: coder)
|
||||||
}
|
}
|
||||||
@ -170,6 +289,9 @@ class MPPositive_MoreSongOperationsViewController: UIViewController {
|
|||||||
MPPositive_LoadCoreModel.shared.reloadCollectionSongViewModel(nil)
|
MPPositive_LoadCoreModel.shared.reloadCollectionSongViewModel(nil)
|
||||||
MP_AnalyticsManager.shared.player_b_love_clickAction(song.videoId, videoname: song.title ?? "", artistname: song.shortBylineText ?? "")
|
MP_AnalyticsManager.shared.player_b_love_clickAction(song.videoId, videoname: song.title ?? "", artistname: song.shortBylineText ?? "")
|
||||||
}
|
}
|
||||||
|
if MP_PlayerManager.shared.loadPlayer?.currentVideo != nil {
|
||||||
|
MP_PlayerManager.shared.loadPlayer?.currentVideo?.reloadCollectionAndDownLoad()
|
||||||
|
}
|
||||||
if collectionBlock != nil {
|
if collectionBlock != nil {
|
||||||
collectionBlock!()
|
collectionBlock!()
|
||||||
}
|
}
|
||||||
@ -291,6 +413,9 @@ extension MPPositive_MoreSongOperationsViewController:UITableViewDataSource, UIT
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if MP_PlayerManager.shared.loadPlayer?.currentVideo != nil {
|
||||||
|
MP_PlayerManager.shared.loadPlayer?.currentVideo?.reloadCollectionAndDownLoad()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -71,44 +71,20 @@ extension MPPositive_LoveSongsViewController: UITableViewDataSource, UITableView
|
|||||||
[weak self] in
|
[weak self] in
|
||||||
guard let self = self else {return}
|
guard let self = self else {return}
|
||||||
MPPositive_Debouncer.shared.call {
|
MPPositive_Debouncer.shared.call {
|
||||||
MP_NetWorkManager.shared.requestNextList("", videoId: MPPositive_LoadCoreModel.shared.songViewModels[indexPath.row].collectionSong.videoId ?? ""){ [weak self] listSongs in
|
|
||||||
guard let first = listSongs.first else {return}
|
|
||||||
let group = DispatchGroup()
|
|
||||||
group.enter()
|
|
||||||
improveDataforLycirsAndRelated(first) {[weak self] (result) in
|
|
||||||
first.lyricsID = result.0
|
|
||||||
first.relatedID = result.1
|
|
||||||
group.leave()
|
|
||||||
}
|
|
||||||
group.enter()
|
|
||||||
//补全资源路径组和封面路径组
|
|
||||||
improveDataforResouceAndCover(first) {[weak self] resourceUrls, coverUrls in
|
|
||||||
if let resourceUrls = resourceUrls {
|
|
||||||
first.resourceUrls = resourceUrls.0
|
|
||||||
first.itags = resourceUrls.1
|
|
||||||
first.mimeTypes = resourceUrls.2
|
|
||||||
}
|
|
||||||
first.coverUrls = coverUrls
|
|
||||||
group.leave()
|
|
||||||
}
|
|
||||||
group.notify(queue: .main, execute: {
|
|
||||||
[weak self] in
|
|
||||||
MPPositive_ModalType = .MoreOperations
|
MPPositive_ModalType = .MoreOperations
|
||||||
let moreVC = MPPositive_MoreSongOperationsViewController(first)
|
let moreVC = MPPositive_MoreSongOperationsViewController(MPPositive_LoadCoreModel.shared.songViewModels[indexPath.row])
|
||||||
moreVC.removeBlock = {
|
moreVC.removeBlock = {
|
||||||
self?.reload()
|
self.reload()
|
||||||
}
|
}
|
||||||
moreVC.disMissBlock = {
|
moreVC.disMissBlock = {
|
||||||
self?.reload()
|
self.reload()
|
||||||
}
|
}
|
||||||
moreVC.collectionBlock = {
|
moreVC.collectionBlock = {
|
||||||
self?.reload()
|
self.reload()
|
||||||
}
|
}
|
||||||
moreVC.transitioningDelegate = self
|
moreVC.transitioningDelegate = self
|
||||||
moreVC.modalPresentationStyle = .custom
|
moreVC.modalPresentationStyle = .custom
|
||||||
self?.present(moreVC, animated: true)
|
self.present(moreVC, animated: true)
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return cell
|
return cell
|
||||||
|
|||||||
@ -227,7 +227,6 @@ extension MPPositive_ArtistShowViewController: JXPagingViewDelegate{
|
|||||||
let lodaViewModel = MPPositive_PlayerLoadViewModel(listSongs, currentVideoId: item.browseItem.videoId ?? "")
|
let lodaViewModel = MPPositive_PlayerLoadViewModel(listSongs, currentVideoId: item.browseItem.videoId ?? "")
|
||||||
lodaViewModel.improveData(item.browseItem.videoId ?? "")
|
lodaViewModel.improveData(item.browseItem.videoId ?? "")
|
||||||
MP_PlayerManager.shared.loadPlayer = lodaViewModel
|
MP_PlayerManager.shared.loadPlayer = lodaViewModel
|
||||||
// NotificationCenter.notificationKey.post(notificationName: .pup_player_vc)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case .none:
|
case .none:
|
||||||
@ -238,35 +237,11 @@ extension MPPositive_ArtistShowViewController: JXPagingViewDelegate{
|
|||||||
[weak self] (itemView) in
|
[weak self] (itemView) in
|
||||||
guard let self = self else {return}
|
guard let self = self else {return}
|
||||||
MPPositive_Debouncer.shared.call {
|
MPPositive_Debouncer.shared.call {
|
||||||
MP_NetWorkManager.shared.requestNextList("", videoId: itemView.browseItem.videoId ?? ""){ [weak self] listSongs in
|
|
||||||
guard let first = listSongs.first else {return}
|
|
||||||
let group = DispatchGroup()
|
|
||||||
group.enter()
|
|
||||||
improveDataforLycirsAndRelated(first) {[weak self] (result) in
|
|
||||||
first.lyricsID = result.0
|
|
||||||
first.relatedID = result.1
|
|
||||||
group.leave()
|
|
||||||
}
|
|
||||||
group.enter()
|
|
||||||
//补全资源路径组和封面路径组
|
|
||||||
improveDataforResouceAndCover(first) {[weak self] resourceUrls, coverUrls in
|
|
||||||
if let resourceUrls = resourceUrls {
|
|
||||||
first.resourceUrls = resourceUrls.0
|
|
||||||
first.itags = resourceUrls.1
|
|
||||||
first.mimeTypes = resourceUrls.2
|
|
||||||
}
|
|
||||||
first.coverUrls = coverUrls
|
|
||||||
group.leave()
|
|
||||||
}
|
|
||||||
group.notify(queue: .main, execute: {
|
|
||||||
[weak self] in
|
|
||||||
MPPositive_ModalType = .MoreOperations
|
MPPositive_ModalType = .MoreOperations
|
||||||
let moreVC = MPPositive_MoreSongOperationsViewController(first)
|
let moreVC = MPPositive_MoreSongOperationsViewController(itemView)
|
||||||
moreVC.transitioningDelegate = self
|
moreVC.transitioningDelegate = self
|
||||||
moreVC.modalPresentationStyle = .custom
|
moreVC.modalPresentationStyle = .custom
|
||||||
self?.present(moreVC, animated: true)
|
self.present(moreVC, animated: true)
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return showView
|
return showView
|
||||||
|
|||||||
@ -307,36 +307,13 @@ extension MPPositive_ListShowViewController: UITableViewDataSource, UITableViewD
|
|||||||
cell.moreBlock = {
|
cell.moreBlock = {
|
||||||
[weak self] in
|
[weak self] in
|
||||||
guard let self = self else {return}
|
guard let self = self else {return}
|
||||||
|
|
||||||
MPPositive_Debouncer.shared.call {
|
MPPositive_Debouncer.shared.call {
|
||||||
MP_NetWorkManager.shared.requestNextList("", videoId: self.listOrAlbum.items[indexPath.row].browseItem.videoId ?? ""){ [weak self] listSongs in
|
|
||||||
guard let first = listSongs.first else {return}
|
|
||||||
let group = DispatchGroup()
|
|
||||||
group.enter()
|
|
||||||
improveDataforLycirsAndRelated(first) {[weak self] (result) in
|
|
||||||
first.lyricsID = result.0
|
|
||||||
first.relatedID = result.1
|
|
||||||
group.leave()
|
|
||||||
}
|
|
||||||
group.enter()
|
|
||||||
//补全资源路径组和封面路径组
|
|
||||||
improveDataforResouceAndCover(first) {[weak self] resourceUrls, coverUrls in
|
|
||||||
if let resourceUrls = resourceUrls {
|
|
||||||
first.resourceUrls = resourceUrls.0
|
|
||||||
first.itags = resourceUrls.1
|
|
||||||
first.mimeTypes = resourceUrls.2
|
|
||||||
}
|
|
||||||
first.coverUrls = coverUrls
|
|
||||||
group.leave()
|
|
||||||
}
|
|
||||||
group.notify(queue: .main, execute: {
|
|
||||||
[weak self] in
|
|
||||||
MPPositive_ModalType = .MoreOperations
|
MPPositive_ModalType = .MoreOperations
|
||||||
let moreVC = MPPositive_MoreSongOperationsViewController(first)
|
let moreVC = MPPositive_MoreSongOperationsViewController(self.listOrAlbum.items[indexPath.row])
|
||||||
moreVC.transitioningDelegate = self
|
moreVC.transitioningDelegate = self
|
||||||
moreVC.modalPresentationStyle = .custom
|
moreVC.modalPresentationStyle = .custom
|
||||||
self?.present(moreVC, animated: true)
|
self.present(moreVC, animated: true)
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return cell
|
return cell
|
||||||
|
|||||||
@ -295,8 +295,15 @@ class MPPositive_PlayerViewController: MPPositive_BaseViewController, UIViewCont
|
|||||||
make.center.equalTo(playBtn)
|
make.center.equalTo(playBtn)
|
||||||
make.width.height.equalTo(playBtn)
|
make.width.height.equalTo(playBtn)
|
||||||
}
|
}
|
||||||
|
let state = MP_PlayerManager.shared.getPlayState()
|
||||||
|
switch state {
|
||||||
|
case .Null:
|
||||||
activityIndicator.isHidden = false
|
activityIndicator.isHidden = false
|
||||||
activityIndicator.startAnimating()
|
activityIndicator.startAnimating()
|
||||||
|
default:
|
||||||
|
activityIndicator.isHidden = false
|
||||||
|
activityIndicator.stopAnimating()
|
||||||
|
}
|
||||||
bottomView.addSubview(listBtn)
|
bottomView.addSubview(listBtn)
|
||||||
listBtn.snp.makeConstraints { make in
|
listBtn.snp.makeConstraints { make in
|
||||||
make.right.equalToSuperview().offset(-20*width)
|
make.right.equalToSuperview().offset(-20*width)
|
||||||
@ -311,13 +318,13 @@ class MPPositive_PlayerViewController: MPPositive_BaseViewController, UIViewCont
|
|||||||
}
|
}
|
||||||
bottomView.addSubview(nextBtn)
|
bottomView.addSubview(nextBtn)
|
||||||
nextBtn.snp.makeConstraints { make in
|
nextBtn.snp.makeConstraints { make in
|
||||||
make.width.height.equalTo(20*width)
|
make.width.height.equalTo(30*width)
|
||||||
make.centerY.equalTo(playBtn.snp.centerY)
|
make.centerY.equalTo(playBtn.snp.centerY)
|
||||||
make.right.equalToSuperview().offset(-98*width)
|
make.right.equalToSuperview().offset(-98*width)
|
||||||
}
|
}
|
||||||
bottomView.addSubview(perviousBtn)
|
bottomView.addSubview(perviousBtn)
|
||||||
perviousBtn.snp.makeConstraints { make in
|
perviousBtn.snp.makeConstraints { make in
|
||||||
make.width.height.equalTo(20*width)
|
make.width.height.equalTo(30*width)
|
||||||
make.centerY.equalTo(playBtn.snp.centerY)
|
make.centerY.equalTo(playBtn.snp.centerY)
|
||||||
make.left.equalToSuperview().offset(98*width)
|
make.left.equalToSuperview().offset(98*width)
|
||||||
}
|
}
|
||||||
@ -328,7 +335,7 @@ class MPPositive_PlayerViewController: MPPositive_BaseViewController, UIViewCont
|
|||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
[weak self] in
|
[weak self] in
|
||||||
guard let self = self else {return}
|
guard let self = self else {return}
|
||||||
print("\(MP_PlayerManager.shared.loadPlayer.currentVideo.title ?? "")刷新了页面")
|
print("\(MP_PlayerManager.shared.loadPlayer?.currentVideo?.title ?? "")刷新了页面")
|
||||||
//填充数据
|
//填充数据
|
||||||
backImageView.kf.setImage(with: MP_PlayerManager.shared.loadPlayer.currentVideo?.coverUrl, placeholder: placeholderImage)
|
backImageView.kf.setImage(with: MP_PlayerManager.shared.loadPlayer.currentVideo?.coverUrl, placeholder: placeholderImage)
|
||||||
coverView.coverImageView.kf.setImage(with: MP_PlayerManager.shared.loadPlayer.currentVideo?.coverUrl, placeholder: placeholderImage)
|
coverView.coverImageView.kf.setImage(with: MP_PlayerManager.shared.loadPlayer.currentVideo?.coverUrl, placeholder: placeholderImage)
|
||||||
@ -341,6 +348,8 @@ class MPPositive_PlayerViewController: MPPositive_BaseViewController, UIViewCont
|
|||||||
coverView.downloadButton.isUserInteractionEnabled = !(MP_PlayerManager.shared.loadPlayer.currentVideo?.isDlownd ?? false)
|
coverView.downloadButton.isUserInteractionEnabled = !(MP_PlayerManager.shared.loadPlayer.currentVideo?.isDlownd ?? false)
|
||||||
coverView.collectionSongBtn.isSelected = MP_PlayerManager.shared.loadPlayer.currentVideo?.isCollection ?? false
|
coverView.collectionSongBtn.isSelected = MP_PlayerManager.shared.loadPlayer.currentVideo?.isCollection ?? false
|
||||||
coverView.restoreDownloadProgress()
|
coverView.restoreDownloadProgress()
|
||||||
|
// activityIndicator.isHidden = true
|
||||||
|
// activityIndicator.stopAnimating()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//MARK: - 通知
|
//MARK: - 通知
|
||||||
|
|||||||
@ -247,35 +247,11 @@ extension MPPositive_RecommendViewController: JXSegmentedListContainerViewDataSo
|
|||||||
[weak self] (itemView) in
|
[weak self] (itemView) in
|
||||||
guard let self = self else {return}
|
guard let self = self else {return}
|
||||||
MPPositive_Debouncer.shared.call {
|
MPPositive_Debouncer.shared.call {
|
||||||
MP_NetWorkManager.shared.requestNextList("", videoId: itemView.browseItem.videoId ?? ""){ [weak self] listSongs in
|
|
||||||
guard let first = listSongs.first else {return}
|
|
||||||
let group = DispatchGroup()
|
|
||||||
group.enter()
|
|
||||||
improveDataforLycirsAndRelated(first) {[weak self] (result) in
|
|
||||||
first.lyricsID = result.0
|
|
||||||
first.relatedID = result.1
|
|
||||||
group.leave()
|
|
||||||
}
|
|
||||||
group.enter()
|
|
||||||
//补全资源路径组和封面路径组
|
|
||||||
improveDataforResouceAndCover(first) {[weak self] resourceUrls, coverUrls in
|
|
||||||
if let resourceUrls = resourceUrls {
|
|
||||||
first.resourceUrls = resourceUrls.0
|
|
||||||
first.itags = resourceUrls.1
|
|
||||||
first.mimeTypes = resourceUrls.2
|
|
||||||
}
|
|
||||||
first.coverUrls = coverUrls
|
|
||||||
group.leave()
|
|
||||||
}
|
|
||||||
group.notify(queue: .main, execute: {
|
|
||||||
[weak self] in
|
|
||||||
MPPositive_ModalType = .MoreOperations
|
MPPositive_ModalType = .MoreOperations
|
||||||
let moreVC = MPPositive_MoreSongOperationsViewController(first)
|
let moreVC = MPPositive_MoreSongOperationsViewController(itemView)
|
||||||
moreVC.transitioningDelegate = self
|
moreVC.transitioningDelegate = self
|
||||||
moreVC.modalPresentationStyle = .custom
|
moreVC.modalPresentationStyle = .custom
|
||||||
self?.present(moreVC, animated: true)
|
self.present(moreVC, animated: true)
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return showView
|
return showView
|
||||||
|
|||||||
@ -136,35 +136,11 @@ class MPPositive_SearchResultShowViewController: MPPositive_BaseViewController,
|
|||||||
[weak self] (itemView) in
|
[weak self] (itemView) in
|
||||||
guard let self = self else {return}
|
guard let self = self else {return}
|
||||||
MPPositive_Debouncer.shared.call {
|
MPPositive_Debouncer.shared.call {
|
||||||
MP_NetWorkManager.shared.requestNextList("", videoId: itemView.item.videoId ?? ""){ [weak self] listSongs in
|
|
||||||
guard let first = listSongs.first else {return}
|
|
||||||
let group = DispatchGroup()
|
|
||||||
group.enter()
|
|
||||||
improveDataforLycirsAndRelated(first) {[weak self] (result) in
|
|
||||||
first.lyricsID = result.0
|
|
||||||
first.relatedID = result.1
|
|
||||||
group.leave()
|
|
||||||
}
|
|
||||||
group.enter()
|
|
||||||
//补全资源路径组和封面路径组
|
|
||||||
improveDataforResouceAndCover(first) {[weak self] resourceUrls, coverUrls in
|
|
||||||
if let resourceUrls = resourceUrls {
|
|
||||||
first.resourceUrls = resourceUrls.0
|
|
||||||
first.itags = resourceUrls.1
|
|
||||||
first.mimeTypes = resourceUrls.2
|
|
||||||
}
|
|
||||||
first.coverUrls = coverUrls
|
|
||||||
group.leave()
|
|
||||||
}
|
|
||||||
group.notify(queue: .main, execute: {
|
|
||||||
[weak self] in
|
|
||||||
MPPositive_ModalType = .MoreOperations
|
MPPositive_ModalType = .MoreOperations
|
||||||
let moreVC = MPPositive_MoreSongOperationsViewController(first)
|
let moreVC = MPPositive_MoreSongOperationsViewController(itemView)
|
||||||
moreVC.transitioningDelegate = self
|
moreVC.transitioningDelegate = self
|
||||||
moreVC.modalPresentationStyle = .custom
|
moreVC.modalPresentationStyle = .custom
|
||||||
self?.present(moreVC, animated: true)
|
self.present(moreVC, animated: true)
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
errorBlock = {
|
errorBlock = {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user