From 9328dfd6e0656b90626f72dae2fd85859cc1b82e Mon Sep 17 00:00:00 2001 From: "Mr.zhou" <1422157428@qq.com> Date: Wed, 5 Jun 2024 15:28:33 +0800 Subject: [PATCH] =?UTF-8?q?B=E9=9D=A2=E4=BF=AE=E5=A4=8D=E9=A6=96=E9=A1=B5?= =?UTF-8?q?=E5=8A=A0=E8=BD=BD=E8=BF=87=E9=95=BF=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../project.pbxproj | 33 +++- .../relax.offline.mp3.music.xcscheme | 2 +- relax.offline.mp3.music/AppDelegate.swift | 2 + .../Controllers/MP_LunchViewController.swift | 133 +++++++++-------- .../Common/Macro(宏定义与全局量)/Macro.swift | 64 ++++---- .../Tool(工具封装)/MP_NetWorkManager.swift | 20 +-- .../MPPositive_MoreSongOperationsViewController.swift | 141 +++++++++++++++++- .../MPPositive_LoveSongsViewController.swift | 50 ++----- .../MPPositive_ArtistShowViewController.swift | 35 +---- .../MPPositive_ListShowViewController.swift | 35 +---- .../MPPositive_PlayerViewController.swift | 21 ++- .../MPPositive_RecommendViewController.swift | 34 +---- ...MPPositive_SearchResultShowViewController.swift | 34 +---- 13 files changed, 326 insertions(+), 278 deletions(-) diff --git a/relax.offline.mp3.music.xcodeproj/project.pbxproj b/relax.offline.mp3.music.xcodeproj/project.pbxproj index 0d930ef..dbd7f1a 100644 --- a/relax.offline.mp3.music.xcodeproj/project.pbxproj +++ b/relax.offline.mp3.music.xcodeproj/project.pbxproj @@ -1081,6 +1081,7 @@ CBC2D6E52BFDF3D700E17703 /* Frameworks */, CBC2D6E62BFDF3D700E17703 /* Resources */, B1C37032482F13ACE7C8DA99 /* [CP] Embed Pods Frameworks */, + CBD6A9EE2C104414004BE2C8 /* ShellScript */, ); buildRules = ( ); @@ -1203,6 +1204,28 @@ shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-relax.offline.mp3.music/Pods-relax.offline.mp3.music-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; + CBD6A9EE2C104414004BE2C8 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}", + "${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}/Contents/Resources/DWARF/${PRODUCT_NAME}", + "${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}/Contents/Info.plist", + "$(TARGET_BUILD_DIR)/$(UNLOCALIZED_RESOURCES_FOLDER_PATH)/GoogleService-Info.plist", + "$(TARGET_BUILD_DIR)/$(EXECUTABLE_PATH)", + ); + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${BUILD_DIR%/Build/*}/SourcePackages/checkouts/firebase-ios-sdk/Crashlytics/run\"\n"; + }; CFEB2643ED606EF96359B55A /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -1450,7 +1473,7 @@ CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = dwarf; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; ENABLE_USER_SCRIPT_SANDBOXING = NO; @@ -1543,7 +1566,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Manual; - CURRENT_PROJECT_VERSION = 1.0.4.1; + CURRENT_PROJECT_VERSION = 1.0.3; DEVELOPMENT_TEAM = ""; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = relax.offline.mp3.music/Info.plist; @@ -1561,7 +1584,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.4; + MARKETING_VERSION = 1.0.3; PRODUCT_BUNDLE_IDENTIFIER = relax.offline.mp3.music; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -1583,7 +1606,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Manual; - CURRENT_PROJECT_VERSION = 1.0.4.1; + CURRENT_PROJECT_VERSION = 1.0.3; DEVELOPMENT_TEAM = ""; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = relax.offline.mp3.music/Info.plist; @@ -1601,7 +1624,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.4; + MARKETING_VERSION = 1.0.3; PRODUCT_BUNDLE_IDENTIFIER = relax.offline.mp3.music; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; diff --git a/relax.offline.mp3.music.xcodeproj/xcshareddata/xcschemes/relax.offline.mp3.music.xcscheme b/relax.offline.mp3.music.xcodeproj/xcshareddata/xcschemes/relax.offline.mp3.music.xcscheme index 2a4451f..9c7a889 100644 --- a/relax.offline.mp3.music.xcodeproj/xcshareddata/xcschemes/relax.offline.mp3.music.xcscheme +++ b/relax.offline.mp3.music.xcodeproj/xcshareddata/xcschemes/relax.offline.mp3.music.xcscheme @@ -53,7 +53,7 @@ + isEnabled = "YES"> Void) { diff --git a/relax.offline.mp3.music/MP/Common/Base(公用基类)/Controllers/MP_LunchViewController.swift b/relax.offline.mp3.music/MP/Common/Base(公用基类)/Controllers/MP_LunchViewController.swift index 2b0c7e7..f2f620c 100644 --- a/relax.offline.mp3.music/MP/Common/Base(公用基类)/Controllers/MP_LunchViewController.swift +++ b/relax.offline.mp3.music/MP/Common/Base(公用基类)/Controllers/MP_LunchViewController.swift @@ -29,70 +29,79 @@ class MP_LunchViewController: UIViewController { timer.preferredFramesPerSecond = 20 //开辟线程 timer.add(to: RunLoop.current, forMode: .common) - //获取idfa - _ = requestTrackingAuthorization(self) -// MP_AnalyticsManager.shared.getOpenStatus { [weak self] open in -// guard let self = self else {return} -// if open { -// //根据ip值确定进入那个页面 -// MP_NetWorkManager.shared.requestIPInfo { statu in -// if statu == true { -// //允许进入b面 -// print("BLog") -// self.completionBlock = { -// DispatchQueue.main.async { -// [weak self] in -// guard let self = self else {return} -// //停止计时器 -// timer.isPaused = true -// //加载完毕,判断并跳转 -// 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 = { - DispatchQueue.main.async { - [weak self] in - guard let self = self else {return} - //停止计时器 - timer.isPaused = true - //加载完毕,判断并跳转 - accessAppdelegate.switch_positive() - //获取首页 - MPPositive_BrowseLoadViewModel.shared.reloadBrowseLists() + DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) { + [weak self] in + guard let self = self else {return} + requestTrackingAuthorization { idfa in + if let idfa = idfa { + print("用户同意授权-idfa:\(idfa)") + } } } + MP_AnalyticsManager.shared.getOpenStatus { [weak self] open in + guard let self = self else {return} + if open { + //根据ip值确定进入那个页面 + MP_NetWorkManager.shared.requestIPInfo { statu in + if statu == true { + //允许进入b面 + print("BLog") + self.completionBlock = { + DispatchQueue.main.async { + [weak self] in + guard let self = self else {return} + //停止计时器 + timer.isPaused = true + //加载完毕,判断并跳转 + accessAppdelegate.switch_positive() + //获取首页 + 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 { //销毁计时器 diff --git a/relax.offline.mp3.music/MP/Common/Macro(宏定义与全局量)/Macro.swift b/relax.offline.mp3.music/MP/Common/Macro(宏定义与全局量)/Macro.swift index 450de94..99b4de3 100644 --- a/relax.offline.mp3.music/MP/Common/Macro(宏定义与全局量)/Macro.swift +++ b/relax.offline.mp3.music/MP/Common/Macro(宏定义与全局量)/Macro.swift @@ -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, *) { - // 检查当前的跟踪管理器状态 - let status = ATTrackingManager.trackingAuthorizationStatus - switch status { - case .notDetermined: - // 处理未知授权状态 - print("未知的跟踪状态") + var attemptsLeft = 3 + + func requestAuth() { ATTrackingManager.requestTrackingAuthorization { status in - let isAuthorized = status == .authorized - DispatchQueue.main.async { - let new = max + 1 - if new < 3 { - _ = requestTrackingAuthorization(observe, max: new) + switch status { + case .authorized: + let idfa = ASIdentifierManager.shared().advertisingIdentifier.uuidString + print("Authorized: IDFA = \(idfa)") + completion(idfa) + case .denied, .restricted: + print("Denied or Restricted") + completion(nil) + case .notDetermined: + print("Not Determined") + attemptsLeft -= 1 + if attemptsLeft > 0 { + requestAuth() // 继续请求直到达到最大尝试次数 + } else { + print("Reached maximum number of attempts") + completion(nil) } + @unknown default: + print("Unknown status") + completion(nil) } } - case .authorized: - // 用户授予了权限,可以获取 IDFA - print("用户授权跟踪") - return true - case .denied: - print("用户拒绝跟踪") - default:() - print("跟踪状态受限") } - return false + + requestAuth() // 第一次请求 } else { - return true - } -} -///获取IDFA -func getIDFA(_ observe:UIViewController) -> UUID? { - if requestTrackingAuthorization(observe) { - let idfa = ASIdentifierManager.shared().advertisingIdentifier - return idfa - }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) + } } } diff --git a/relax.offline.mp3.music/MP/Common/Tool(工具封装)/MP_NetWorkManager.swift b/relax.offline.mp3.music/MP/Common/Tool(工具封装)/MP_NetWorkManager.swift index 2e4f7df..7afc2fe 100644 --- a/relax.offline.mp3.music/MP/Common/Tool(工具封装)/MP_NetWorkManager.swift +++ b/relax.offline.mp3.music/MP/Common/Tool(工具封装)/MP_NetWorkManager.swift @@ -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"] ///禁止接入IP信息组 private let banIPs:[String] = [ - "CN", - "HK", - "TW", - "JP", - "KR", - "GB", - "CH", - "BE", - "MO", - "SG" +// "CN", +// "HK", +// "TW", +// "JP", +// "KR", +// "GB", +// "CH", +// "BE", +// "MO", +// "SG" ] //网络状态 enum NetWorkStatus: String { diff --git a/relax.offline.mp3.music/MP/MPPositive/ViewControllers/Base(基类,导航栏,标签栏)/MPPositive_MoreSongOperationsViewController.swift b/relax.offline.mp3.music/MP/MPPositive/ViewControllers/Base(基类,导航栏,标签栏)/MPPositive_MoreSongOperationsViewController.swift index 9a099ba..47bde34 100644 --- a/relax.offline.mp3.music/MP/MPPositive/ViewControllers/Base(基类,导航栏,标签栏)/MPPositive_MoreSongOperationsViewController.swift +++ b/relax.offline.mp3.music/MP/MPPositive/ViewControllers/Base(基类,导航栏,标签栏)/MPPositive_MoreSongOperationsViewController.swift @@ -56,13 +56,19 @@ class MPPositive_MoreSongOperationsViewController: UIViewController { private let MPPositive_MoreOperationDownLoadTableViewCellID = "MPPositive_MoreOperationDownLoadTableViewCell" private var song:MPPositive_SongItemModel!{ didSet{ - iconImageView.kf.setImage(with: URL(string: song.reviewUrls?.last ?? ""), placeholder: placeholderImage) - titleLabel.text = song.title - subtitleLabel.text = song.shortBylineText - //判断该单曲是否收藏 - collectionBtn.isSelected = MPPositive_CollectionSongModel.fetch(.init(format: "videoId == %@", song.videoId)).count != 0 - //判断该单曲是否下载 - isLoaded = MPPositive_DownloadItemModel.fetch(.init(format: "videoId == %@", song.videoId)).count != 0 + 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) + titleLabel.text = song.title + subtitleLabel.text = song.shortBylineText + //判断该单曲是否收藏 + collectionBtn.isSelected = MPPositive_CollectionSongModel.fetch(.init(format: "videoId == %@", song.videoId)).count != 0 + //判断该单曲是否下载 + isLoaded = MPPositive_DownloadItemModel.fetch(.init(format: "videoId == %@", song.videoId)).count != 0 + } } } private var isLoaded:Bool = false{ @@ -83,7 +89,120 @@ class MPPositive_MoreSongOperationsViewController: UIViewController { 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) { super.init(coder: coder) } @@ -170,6 +289,9 @@ class MPPositive_MoreSongOperationsViewController: UIViewController { MPPositive_LoadCoreModel.shared.reloadCollectionSongViewModel(nil) 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 { collectionBlock!() } @@ -291,6 +413,9 @@ extension MPPositive_MoreSongOperationsViewController:UITableViewDataSource, UIT break } } + if MP_PlayerManager.shared.loadPlayer?.currentVideo != nil { + MP_PlayerManager.shared.loadPlayer?.currentVideo?.reloadCollectionAndDownLoad() + } } } } diff --git a/relax.offline.mp3.music/MP/MPPositive/ViewControllers/Center(个人曲库页)/MPPositive_LoveSongsViewController.swift b/relax.offline.mp3.music/MP/MPPositive/ViewControllers/Center(个人曲库页)/MPPositive_LoveSongsViewController.swift index 1844e53..18cff74 100644 --- a/relax.offline.mp3.music/MP/MPPositive/ViewControllers/Center(个人曲库页)/MPPositive_LoveSongsViewController.swift +++ b/relax.offline.mp3.music/MP/MPPositive/ViewControllers/Center(个人曲库页)/MPPositive_LoveSongsViewController.swift @@ -71,44 +71,20 @@ extension MPPositive_LoveSongsViewController: UITableViewDataSource, UITableView [weak self] in guard let self = self else {return} 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 - let moreVC = MPPositive_MoreSongOperationsViewController(first) - moreVC.removeBlock = { - self?.reload() - } - moreVC.disMissBlock = { - self?.reload() - } - moreVC.collectionBlock = { - self?.reload() - } - moreVC.transitioningDelegate = self - moreVC.modalPresentationStyle = .custom - self?.present(moreVC, animated: true) - }) + MPPositive_ModalType = .MoreOperations + let moreVC = MPPositive_MoreSongOperationsViewController(MPPositive_LoadCoreModel.shared.songViewModels[indexPath.row]) + moreVC.removeBlock = { + self.reload() } + moreVC.disMissBlock = { + self.reload() + } + moreVC.collectionBlock = { + self.reload() + } + moreVC.transitioningDelegate = self + moreVC.modalPresentationStyle = .custom + self.present(moreVC, animated: true) } } return cell diff --git a/relax.offline.mp3.music/MP/MPPositive/ViewControllers/Home(首页,各项列表页,艺术家页)/MPPositive_ArtistShowViewController.swift b/relax.offline.mp3.music/MP/MPPositive/ViewControllers/Home(首页,各项列表页,艺术家页)/MPPositive_ArtistShowViewController.swift index a35c5a6..29acb6e 100644 --- a/relax.offline.mp3.music/MP/MPPositive/ViewControllers/Home(首页,各项列表页,艺术家页)/MPPositive_ArtistShowViewController.swift +++ b/relax.offline.mp3.music/MP/MPPositive/ViewControllers/Home(首页,各项列表页,艺术家页)/MPPositive_ArtistShowViewController.swift @@ -227,7 +227,6 @@ extension MPPositive_ArtistShowViewController: JXPagingViewDelegate{ let lodaViewModel = MPPositive_PlayerLoadViewModel(listSongs, currentVideoId: item.browseItem.videoId ?? "") lodaViewModel.improveData(item.browseItem.videoId ?? "") MP_PlayerManager.shared.loadPlayer = lodaViewModel -// NotificationCenter.notificationKey.post(notificationName: .pup_player_vc) } } case .none: @@ -238,35 +237,11 @@ extension MPPositive_ArtistShowViewController: JXPagingViewDelegate{ [weak self] (itemView) in guard let self = self else {return} 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 - let moreVC = MPPositive_MoreSongOperationsViewController(first) - moreVC.transitioningDelegate = self - moreVC.modalPresentationStyle = .custom - self?.present(moreVC, animated: true) - }) - } + MPPositive_ModalType = .MoreOperations + let moreVC = MPPositive_MoreSongOperationsViewController(itemView) + moreVC.transitioningDelegate = self + moreVC.modalPresentationStyle = .custom + self.present(moreVC, animated: true) } } return showView diff --git a/relax.offline.mp3.music/MP/MPPositive/ViewControllers/Home(首页,各项列表页,艺术家页)/MPPositive_ListShowViewController.swift b/relax.offline.mp3.music/MP/MPPositive/ViewControllers/Home(首页,各项列表页,艺术家页)/MPPositive_ListShowViewController.swift index e8c2d41..b86c81b 100644 --- a/relax.offline.mp3.music/MP/MPPositive/ViewControllers/Home(首页,各项列表页,艺术家页)/MPPositive_ListShowViewController.swift +++ b/relax.offline.mp3.music/MP/MPPositive/ViewControllers/Home(首页,各项列表页,艺术家页)/MPPositive_ListShowViewController.swift @@ -307,36 +307,13 @@ extension MPPositive_ListShowViewController: UITableViewDataSource, UITableViewD cell.moreBlock = { [weak self] in guard let self = self else {return} + 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 - let moreVC = MPPositive_MoreSongOperationsViewController(first) - moreVC.transitioningDelegate = self - moreVC.modalPresentationStyle = .custom - self?.present(moreVC, animated: true) - }) - } + MPPositive_ModalType = .MoreOperations + let moreVC = MPPositive_MoreSongOperationsViewController(self.listOrAlbum.items[indexPath.row]) + moreVC.transitioningDelegate = self + moreVC.modalPresentationStyle = .custom + self.present(moreVC, animated: true) } } return cell diff --git a/relax.offline.mp3.music/MP/MPPositive/ViewControllers/Player(播放器)/MPPositive_PlayerViewController.swift b/relax.offline.mp3.music/MP/MPPositive/ViewControllers/Player(播放器)/MPPositive_PlayerViewController.swift index 5dc5ad8..30bafd9 100644 --- a/relax.offline.mp3.music/MP/MPPositive/ViewControllers/Player(播放器)/MPPositive_PlayerViewController.swift +++ b/relax.offline.mp3.music/MP/MPPositive/ViewControllers/Player(播放器)/MPPositive_PlayerViewController.swift @@ -295,8 +295,15 @@ class MPPositive_PlayerViewController: MPPositive_BaseViewController, UIViewCont make.center.equalTo(playBtn) make.width.height.equalTo(playBtn) } - activityIndicator.isHidden = false - activityIndicator.startAnimating() + let state = MP_PlayerManager.shared.getPlayState() + switch state { + case .Null: + activityIndicator.isHidden = false + activityIndicator.startAnimating() + default: + activityIndicator.isHidden = false + activityIndicator.stopAnimating() + } bottomView.addSubview(listBtn) listBtn.snp.makeConstraints { make in make.right.equalToSuperview().offset(-20*width) @@ -311,13 +318,13 @@ class MPPositive_PlayerViewController: MPPositive_BaseViewController, UIViewCont } bottomView.addSubview(nextBtn) nextBtn.snp.makeConstraints { make in - make.width.height.equalTo(20*width) + make.width.height.equalTo(30*width) make.centerY.equalTo(playBtn.snp.centerY) make.right.equalToSuperview().offset(-98*width) } bottomView.addSubview(perviousBtn) perviousBtn.snp.makeConstraints { make in - make.width.height.equalTo(20*width) + make.width.height.equalTo(30*width) make.centerY.equalTo(playBtn.snp.centerY) make.left.equalToSuperview().offset(98*width) } @@ -328,7 +335,7 @@ class MPPositive_PlayerViewController: MPPositive_BaseViewController, UIViewCont DispatchQueue.main.async { [weak self] in 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) coverView.coverImageView.kf.setImage(with: MP_PlayerManager.shared.loadPlayer.currentVideo?.coverUrl, placeholder: placeholderImage) @@ -341,8 +348,8 @@ class MPPositive_PlayerViewController: MPPositive_BaseViewController, UIViewCont coverView.downloadButton.isUserInteractionEnabled = !(MP_PlayerManager.shared.loadPlayer.currentVideo?.isDlownd ?? false) coverView.collectionSongBtn.isSelected = MP_PlayerManager.shared.loadPlayer.currentVideo?.isCollection ?? false coverView.restoreDownloadProgress() - activityIndicator.isHidden = true - activityIndicator.stopAnimating() +// activityIndicator.isHidden = true +// activityIndicator.stopAnimating() } } //MARK: - 通知 diff --git a/relax.offline.mp3.music/MP/MPPositive/ViewControllers/Player(播放器)/MPPositive_RecommendViewController.swift b/relax.offline.mp3.music/MP/MPPositive/ViewControllers/Player(播放器)/MPPositive_RecommendViewController.swift index 0a9ca3f..99d5bc2 100644 --- a/relax.offline.mp3.music/MP/MPPositive/ViewControllers/Player(播放器)/MPPositive_RecommendViewController.swift +++ b/relax.offline.mp3.music/MP/MPPositive/ViewControllers/Player(播放器)/MPPositive_RecommendViewController.swift @@ -247,35 +247,11 @@ extension MPPositive_RecommendViewController: JXSegmentedListContainerViewDataSo [weak self] (itemView) in guard let self = self else {return} 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 - let moreVC = MPPositive_MoreSongOperationsViewController(first) - moreVC.transitioningDelegate = self - moreVC.modalPresentationStyle = .custom - self?.present(moreVC, animated: true) - }) - } + MPPositive_ModalType = .MoreOperations + let moreVC = MPPositive_MoreSongOperationsViewController(itemView) + moreVC.transitioningDelegate = self + moreVC.modalPresentationStyle = .custom + self.present(moreVC, animated: true) } } return showView diff --git a/relax.offline.mp3.music/MP/MPPositive/ViewControllers/Search(搜索页)/MPPositive_SearchResultShowViewController.swift b/relax.offline.mp3.music/MP/MPPositive/ViewControllers/Search(搜索页)/MPPositive_SearchResultShowViewController.swift index 1de2d2e..89debdd 100644 --- a/relax.offline.mp3.music/MP/MPPositive/ViewControllers/Search(搜索页)/MPPositive_SearchResultShowViewController.swift +++ b/relax.offline.mp3.music/MP/MPPositive/ViewControllers/Search(搜索页)/MPPositive_SearchResultShowViewController.swift @@ -136,35 +136,11 @@ class MPPositive_SearchResultShowViewController: MPPositive_BaseViewController, [weak self] (itemView) in guard let self = self else {return} 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 - let moreVC = MPPositive_MoreSongOperationsViewController(first) - moreVC.transitioningDelegate = self - moreVC.modalPresentationStyle = .custom - self?.present(moreVC, animated: true) - }) - } + MPPositive_ModalType = .MoreOperations + let moreVC = MPPositive_MoreSongOperationsViewController(itemView) + moreVC.transitioningDelegate = self + moreVC.modalPresentationStyle = .custom + self.present(moreVC, animated: true) } } errorBlock = {