B面修复首页加载过长问题

This commit is contained in:
Mr.zhou 2024-06-05 15:28:33 +08:00
parent 4b86926e79
commit 9328dfd6e0
13 changed files with 326 additions and 278 deletions

View File

@ -1081,6 +1081,7 @@
CBC2D6E52BFDF3D700E17703 /* Frameworks */, CBC2D6E52BFDF3D700E17703 /* Frameworks */,
CBC2D6E62BFDF3D700E17703 /* Resources */, CBC2D6E62BFDF3D700E17703 /* Resources */,
B1C37032482F13ACE7C8DA99 /* [CP] Embed Pods Frameworks */, B1C37032482F13ACE7C8DA99 /* [CP] Embed Pods Frameworks */,
CBD6A9EE2C104414004BE2C8 /* ShellScript */,
); );
buildRules = ( buildRules = (
); );
@ -1203,6 +1204,28 @@
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-relax.offline.mp3.music/Pods-relax.offline.mp3.music-frameworks.sh\"\n"; shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-relax.offline.mp3.music/Pods-relax.offline.mp3.music-frameworks.sh\"\n";
showEnvVarsInLog = 0; 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 */ = { CFEB2643ED606EF96359B55A /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
@ -1450,7 +1473,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO; COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES; ENABLE_TESTABILITY = YES;
ENABLE_USER_SCRIPT_SANDBOXING = NO; ENABLE_USER_SCRIPT_SANDBOXING = NO;
@ -1543,7 +1566,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Manual; CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 1.0.4.1; CURRENT_PROJECT_VERSION = 1.0.3;
DEVELOPMENT_TEAM = ""; DEVELOPMENT_TEAM = "";
GENERATE_INFOPLIST_FILE = YES; GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = relax.offline.mp3.music/Info.plist; INFOPLIST_FILE = relax.offline.mp3.music/Info.plist;
@ -1561,7 +1584,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.0.4; MARKETING_VERSION = 1.0.3;
PRODUCT_BUNDLE_IDENTIFIER = relax.offline.mp3.music; PRODUCT_BUNDLE_IDENTIFIER = relax.offline.mp3.music;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "";
@ -1583,7 +1606,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Manual; CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 1.0.4.1; CURRENT_PROJECT_VERSION = 1.0.3;
DEVELOPMENT_TEAM = ""; DEVELOPMENT_TEAM = "";
GENERATE_INFOPLIST_FILE = YES; GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = relax.offline.mp3.music/Info.plist; INFOPLIST_FILE = relax.offline.mp3.music/Info.plist;
@ -1601,7 +1624,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.0.4; MARKETING_VERSION = 1.0.3;
PRODUCT_BUNDLE_IDENTIFIER = relax.offline.mp3.music; PRODUCT_BUNDLE_IDENTIFIER = relax.offline.mp3.music;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "";

View File

@ -53,7 +53,7 @@
<CommandLineArguments> <CommandLineArguments>
<CommandLineArgument <CommandLineArgument
argument = "-FIRDebugEnabled" argument = "-FIRDebugEnabled"
isEnabled = "NO"> isEnabled = "YES">
</CommandLineArgument> </CommandLineArgument>
<CommandLineArgument <CommandLineArgument
argument = "-FIRDebugDisabled" argument = "-FIRDebugDisabled"

View File

@ -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) {

View File

@ -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 {
// //

View File

@ -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)
} }
///IDFA @unknown default:
func getIDFA(_ observe:UIViewController) -> UUID? { print("Unknown status")
if requestTrackingAuthorization(observe) { completion(nil)
let idfa = ASIdentifierManager.shared().advertisingIdentifier }
return idfa }
}else { }
return nil
requestAuth() //
} else {
if ASIdentifierManager.shared().isAdvertisingTrackingEnabled {
let idfa = ASIdentifierManager.shared().advertisingIdentifier.uuidString
print("Tracking enabled: IDFA = \(idfa)")
completion(idfa)
} else {
print("Tracking not enabled")
completion(nil)
}
} }
} }

View File

@ -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 {

View File

@ -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()
}
} }
} }
} }

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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,8 +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.isHidden = true
activityIndicator.stopAnimating() // activityIndicator.stopAnimating()
} }
} }
//MARK: - //MARK: -

View File

@ -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

View File

@ -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 = {