diff --git a/relax.offline.mp3.music/Assets.xcassets/SideA/Center/Clear Cache.imageset/Contents.json b/relax.offline.mp3.music/Assets.xcassets/SideA/Center/Clear Cache.imageset/Contents.json index 25e56f5..6348443 100644 --- a/relax.offline.mp3.music/Assets.xcassets/SideA/Center/Clear Cache.imageset/Contents.json +++ b/relax.offline.mp3.music/Assets.xcassets/SideA/Center/Clear Cache.imageset/Contents.json @@ -5,12 +5,12 @@ "scale" : "1x" }, { - "filename" : "Frame_34543@2x.png", + "filename" : "img_v3_02cu_f53bc5b8-c70c-4922-a61f-60dfcff9008g.png", "idiom" : "universal", "scale" : "2x" }, { - "filename" : "Frame_34543@3x.png", + "filename" : "img_v3_02cu_840d98d2-1a22-4b2e-adf3-d3557c9aad4g.png", "idiom" : "universal", "scale" : "3x" } diff --git a/relax.offline.mp3.music/Assets.xcassets/SideA/Center/Clear Cache.imageset/Frame_34543@2x.png b/relax.offline.mp3.music/Assets.xcassets/SideA/Center/Clear Cache.imageset/Frame_34543@2x.png deleted file mode 100644 index 20c94da..0000000 Binary files a/relax.offline.mp3.music/Assets.xcassets/SideA/Center/Clear Cache.imageset/Frame_34543@2x.png and /dev/null differ diff --git a/relax.offline.mp3.music/Assets.xcassets/SideA/Center/Clear Cache.imageset/Frame_34543@3x.png b/relax.offline.mp3.music/Assets.xcassets/SideA/Center/Clear Cache.imageset/Frame_34543@3x.png deleted file mode 100644 index 66761f7..0000000 Binary files a/relax.offline.mp3.music/Assets.xcassets/SideA/Center/Clear Cache.imageset/Frame_34543@3x.png and /dev/null differ diff --git a/relax.offline.mp3.music/Assets.xcassets/SideA/Center/Clear Cache.imageset/img_v3_02cu_840d98d2-1a22-4b2e-adf3-d3557c9aad4g.png b/relax.offline.mp3.music/Assets.xcassets/SideA/Center/Clear Cache.imageset/img_v3_02cu_840d98d2-1a22-4b2e-adf3-d3557c9aad4g.png new file mode 100644 index 0000000..e1fb0b8 Binary files /dev/null and b/relax.offline.mp3.music/Assets.xcassets/SideA/Center/Clear Cache.imageset/img_v3_02cu_840d98d2-1a22-4b2e-adf3-d3557c9aad4g.png differ diff --git a/relax.offline.mp3.music/Assets.xcassets/SideA/Center/Clear Cache.imageset/img_v3_02cu_f53bc5b8-c70c-4922-a61f-60dfcff9008g.png b/relax.offline.mp3.music/Assets.xcassets/SideA/Center/Clear Cache.imageset/img_v3_02cu_f53bc5b8-c70c-4922-a61f-60dfcff9008g.png new file mode 100644 index 0000000..952393d Binary files /dev/null and b/relax.offline.mp3.music/Assets.xcassets/SideA/Center/Clear Cache.imageset/img_v3_02cu_f53bc5b8-c70c-4922-a61f-60dfcff9008g.png differ diff --git a/relax.offline.mp3.music/MP/Common/Tool(工具封装)/MP_AdMobManager.swift b/relax.offline.mp3.music/MP/Common/Tool(工具封装)/MP_AdMobManager.swift index 556bf72..a197ffb 100644 --- a/relax.offline.mp3.music/MP/Common/Tool(工具封装)/MP_AdMobManager.swift +++ b/relax.offline.mp3.music/MP/Common/Tool(工具封装)/MP_AdMobManager.swift @@ -369,6 +369,7 @@ class MP_AdMobManager: NSObject, GADAudioVideoManagerDelegate, GADFullScreenCont case .ICE: guard level <= (OpenICEID.count-1) else { print("冷启动广告组已经全部加载失败,停止继续加载") + MP_AnalyticsManager.shared.cold_ads_showFailureAction("No Ads Fill") completion(false) return } @@ -376,6 +377,7 @@ class MP_AdMobManager: NSObject, GADAudioVideoManagerDelegate, GADFullScreenCont case .HOST: guard level <= (OpenHOSTID.count-1) else { print("热启动广告组已经全部加载失败,停止继续加载") + MP_AnalyticsManager.shared.hot_ads_showFailureAction("No Ads Fill") completion(false) return } @@ -617,6 +619,7 @@ class MP_AdMobManager: NSObject, GADAudioVideoManagerDelegate, GADFullScreenCont guard openAdStatus else {return} guard level <= (SearchINSERTID.count-1) else { print("搜索插页广告组已经全部加载失败,停止继续加载") + MP_AnalyticsManager.shared.search_ads_showFailureAction("No Ads Fill") //开始加载全局插页 loadGlobalInterstitialAd { status in completion(status) @@ -722,6 +725,7 @@ class MP_AdMobManager: NSObject, GADAudioVideoManagerDelegate, GADFullScreenCont guard openAdStatus else {return} guard level <= (PlayerINSERTID.count-1) else { print("播放插页广告组已经全部加载失败,停止继续加载") + MP_AnalyticsManager.shared.play_ads_showFailureAction("No Ads Fill") //开始加载全局插页 loadGlobalInterstitialAd { status in completion(status) @@ -828,6 +832,7 @@ class MP_AdMobManager: NSObject, GADAudioVideoManagerDelegate, GADFullScreenCont guard openAdStatus else {return} guard level <= (SwitchINSERTID.count-1) else { print("切歌插页广告组已经全部加载失败,停止继续加载") + MP_AnalyticsManager.shared.cut_ads_showFailureAction("No Ads Fill") //开始加载全局插页 loadGlobalInterstitialAd { status in completion(status) @@ -933,6 +938,7 @@ class MP_AdMobManager: NSObject, GADAudioVideoManagerDelegate, GADFullScreenCont guard openAdStatus else {return} guard level <= (LoadINSERTID.count-1) else { print("下载插页广告组已经全部加载失败,停止继续加载") + MP_AnalyticsManager.shared.dl_ads_showFailureAction("No Ads Fill") //开始加载全局插页 loadGlobalInterstitialAd { status in completion(status) @@ -1163,6 +1169,7 @@ class MP_AdMobManager: NSObject, GADAudioVideoManagerDelegate, GADFullScreenCont guard openAdStatus else {return} guard level <= (LibraryINSERTID.count-1) else { print("曲库插页广告组已经全部加载失败,停止继续加载") + MP_AnalyticsManager.shared.listclk_ads_showFailureAction("No Ads Fill") //开始加载全局插页 loadGlobalInterstitialAd { status in completion(status) diff --git a/relax.offline.mp3.music/MP/Common/Tool(工具封装)/MP_HUD.swift b/relax.offline.mp3.music/MP/Common/Tool(工具封装)/MP_HUD.swift index 7e0579f..c054ace 100644 --- a/relax.offline.mp3.music/MP/Common/Tool(工具封装)/MP_HUD.swift +++ b/relax.offline.mp3.music/MP/Common/Tool(工具封装)/MP_HUD.swift @@ -112,10 +112,12 @@ class MP_HUD: NSObject { }else { switch status { case .success: + SVProgressHUD.setBackgroundColor(.init(hex: "#80F988", alpha: 0.1)) SVProgressHUD.showSuccess(withStatus: text) SVProgressHUD.setMinimumSize(CGSize(width: 100 * width, height: 80 * width)) SVProgressHUD.show(UIImage(), status: text) case .error: + SVProgressHUD.setBackgroundColor(.init(hex: "#80F988", alpha: 0.1)) SVProgressHUD.showError(withStatus: text) case .onlyText: SVProgressHUD.setMinimumSize(CGSize(width: 100 * width, height: 40 * width)) 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 e81f0c7..6bce9b2 100644 --- a/relax.offline.mp3.music/MP/Common/Tool(工具封装)/MP_NetWorkManager.swift +++ b/relax.offline.mp3.music/MP/Common/Tool(工具封装)/MP_NetWorkManager.swift @@ -25,8 +25,8 @@ class MP_NetWorkManager: NSObject { private lazy var MPSession:Session = { let configuration = URLSessionConfiguration.af.default //最多同时执行4条 - configuration.timeoutIntervalForRequest = 30 - configuration.timeoutIntervalForResource = 30 + configuration.timeoutIntervalForRequest = 20 + configuration.timeoutIntervalForResource = 20 return Alamofire.Session(configuration: configuration, interceptor: MP_CustomRetrier()) }() ///播放资源会话实例 @@ -68,11 +68,11 @@ class MP_NetWorkManager: NSObject { private var playerVersion:String! ///禁止接入IP信息组 private let banIPs:[String] = [ -// "CN", -// "HK", -// "TW", -// "JP", -// "KR" + "CN", + "HK", + "TW", + "JP", + "KR" ] ///允许访问的区域Code(对部分内容进行塞选) private let codes:[String] = [ @@ -1235,6 +1235,11 @@ extension MP_NetWorkManager { } //请求搜索预览结果 private func requestPostSearchPreviewResults(_ url:URL, parameters:Parameters, completion:@escaping (([MPPositive_SearchResultListViewModel]) -> Void)) { + guard netWorkStatu != .notReachable else { + completion([]) + handleError(url, error: nil) + return + } //发送post请求 MPSession.request(url, method: .post, parameters: parameters, encoding: JSONEncoding.default).responseDecodable(of: JsonSearchPreviewResults.self) { [weak self] (response) in guard let self = self else {return} diff --git a/relax.offline.mp3.music/MP/Common/Tool(工具封装)/MP_PlayerManager.swift b/relax.offline.mp3.music/MP/Common/Tool(工具封装)/MP_PlayerManager.swift index 3d524f1..9ec99da 100644 --- a/relax.offline.mp3.music/MP/Common/Tool(工具封装)/MP_PlayerManager.swift +++ b/relax.offline.mp3.music/MP/Common/Tool(工具封装)/MP_PlayerManager.swift @@ -438,9 +438,9 @@ class MP_PlayerManager:NSObject{ @objc private func netWorkReachableAction(_ sender:Notification) { //监听到网络状态恢复,检索当前播放器是否正在播放 if loadPlayer?.currentVideo != nil { - if playState == .Playing { + if playState == .Playing, let currentItem = loadPlayer?.currentVideo?.resourcePlayerItem { //有音乐播放,获取当前播放进度 - let currentTime = loadPlayer?.currentVideo?.resourcePlayerItem?.currentTime() ?? .zero + let currentTime = currentItem.currentTime() //手动调整播放时间点,以此重启播放器缓存 player.seek(to: currentTime) player.play() @@ -666,7 +666,7 @@ class MP_PlayerManager:NSObject{ } } default: - guard let songVideos = loadPlayer.songVideos, songVideos.count != 1 else { + guard let songVideos = loadPlayer?.songVideos, songVideos.count != 1 else { player.seek(to: .zero) playState = .Playing player.play() diff --git a/relax.offline.mp3.music/MP/MPPositive/ViewControllers/Center(个人曲库页)/MPPositive_OfflineSongsViewController.swift b/relax.offline.mp3.music/MP/MPPositive/ViewControllers/Center(个人曲库页)/MPPositive_OfflineSongsViewController.swift index d024f55..23bc80a 100644 --- a/relax.offline.mp3.music/MP/MPPositive/ViewControllers/Center(个人曲库页)/MPPositive_OfflineSongsViewController.swift +++ b/relax.offline.mp3.music/MP/MPPositive/ViewControllers/Center(个人曲库页)/MPPositive_OfflineSongsViewController.swift @@ -126,7 +126,7 @@ extension MPPositive_OfflineSongsViewController: UITableViewDataSource, UITableV MP_DownloadManager.shared.deleteFileDocuments(videoId) { videoId in MP_HUD.progress("Loading...", delay: 0.5) { MP_HUD.text("Removed", delay: 1.0, completion: nil) - tableView.reloadData() + self.reload() } } } @@ -145,7 +145,7 @@ extension MPPositive_OfflineSongsViewController: UITableViewDataSource, UITableV //确定取消 MP_DownloadManager.shared.cancelDownloadTask(videoId) { videoId in MP_HUD.text("Canceled", delay: 1.0, completion: nil) - tableView.reloadData() + self.reload() } } alertController.addAction(sure) diff --git a/relax.offline.mp3.music/MP/MPPositive/ViewControllers/Search(搜索页)/MPPositive_SearchViewController.swift b/relax.offline.mp3.music/MP/MPPositive/ViewControllers/Search(搜索页)/MPPositive_SearchViewController.swift index 13e2c9c..31a0aeb 100644 --- a/relax.offline.mp3.music/MP/MPPositive/ViewControllers/Search(搜索页)/MPPositive_SearchViewController.swift +++ b/relax.offline.mp3.music/MP/MPPositive/ViewControllers/Search(搜索页)/MPPositive_SearchViewController.swift @@ -68,9 +68,10 @@ class MPPositive_SearchViewController: MPPositive_BaseViewController { [weak self] in guard let self = self else {return} historyCollectionView.reloadData() + historyCollectionView.layoutIfNeeded() guard let layout = historyCollectionView.collectionViewLayout as? MPPositive_TagFlowLayout, let height = layout.layoutAttributeds.last?.frame.maxY else {return} historyCollectionView.snp.updateConstraints { make in - make.height.equalTo(height) + make.height.equalTo(height*width) } } grideCollectionView.reloadData() @@ -82,6 +83,7 @@ class MPPositive_SearchViewController: MPPositive_BaseViewController { deinit{ NotificationCenter.default.removeObserver(self) } + //配置 private func configure() { let searchView = createSearchView() @@ -163,13 +165,17 @@ class MPPositive_SearchViewController: MPPositive_BaseViewController { MPPositive_SearchTagModel.fetchAll { [weak self] items in guard let self = self else {return} items.forEach({(MPPositive_SearchTagModel.delete($0))}) + guard let layout = historyCollectionView.collectionViewLayout as? MPPositive_TagFlowLayout else {return} layout.originxArray.removeAll() layout.originyArray.removeAll() layout.layoutAttributeds.removeAll() - historyCollectionView.reloadData() - historyCollectionView.snp.updateConstraints { make in - make.height.equalTo(10) + MPPositive_LoadCoreModel.shared.reloadSearchTags { + [weak self] in + self?.historyCollectionView.reloadData() + self?.historyCollectionView.snp.updateConstraints { make in + make.height.equalTo(10) + } } } } diff --git a/relax.offline.mp3.music/MP/MPPositive/Views/Search/MPPositive_SearchSuggestionsView.swift b/relax.offline.mp3.music/MP/MPPositive/Views/Search/MPPositive_SearchSuggestionsView.swift index f11e6d2..a48e6a3 100644 --- a/relax.offline.mp3.music/MP/MPPositive/Views/Search/MPPositive_SearchSuggestionsView.swift +++ b/relax.offline.mp3.music/MP/MPPositive/Views/Search/MPPositive_SearchSuggestionsView.swift @@ -52,9 +52,13 @@ extension MPPositive_SearchSuggestionsView:UITableViewDataSource, UITableViewDel return cell } func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { - if selectedTextBlock != nil { - let text = suggestions[indexPath.row].string - selectedTextBlock!(text) + MPPositive_Debouncer.shared.call { + [weak self] in + guard let self = self else {return} + if selectedTextBlock != nil { + let text = suggestions[indexPath.row].string + selectedTextBlock!(text) + } } } }