对B面1.0.2的一次小优化

This commit is contained in:
Mr.zhou 2024-06-03 15:34:16 +08:00
parent ef6c18838a
commit da3177eb27
21 changed files with 200 additions and 111 deletions

View File

@ -496,13 +496,13 @@
CBAFCA042C0A10500054500E /* Extension(扩展) */ = {
isa = PBXGroup;
children = (
CBAFCA022C0A10500054500E /* String.swift */,
CBAFC9FC2C0A10500054500E /* AVPlayerItem.swift */,
CBAFC9FD2C0A10500054500E /* DateTime.swift */,
CBAFC9FE2C0A10500054500E /* HexColor.swift */,
CBAFC9FF2C0A10500054500E /* ImagePicker.swift */,
CBAFCA002C0A10500054500E /* LayoutConstraint.swift */,
CBAFCA012C0A10500054500E /* Notification.swift */,
CBAFCA022C0A10500054500E /* String.swift */,
CBAFCA032C0A10500054500E /* TableView.swift */,
);
path = "Extension(扩展)";
@ -702,10 +702,10 @@
isa = PBXGroup;
children = (
CBAFCA602C0A10500054500E /* MPPositive_BaseViewController.swift */,
CBAFCA612C0A10500054500E /* MPPositive_MoreSongOperationsViewController.swift */,
CBAFCA622C0A10500054500E /* MPPositive_NavigationController.swift */,
CBAFCA632C0A10500054500E /* MPPositive_PresentationController.swift */,
CBAFCA642C0A10500054500E /* MPPositive_TabBarController.swift */,
CBAFCA632C0A10500054500E /* MPPositive_PresentationController.swift */,
CBAFCA612C0A10500054500E /* MPPositive_MoreSongOperationsViewController.swift */,
);
path = "Base基类导航栏标签栏";
sourceTree = "<group>";
@ -724,10 +724,10 @@
CBAFCA6F2C0A10500054500E /* Home首页各项列表页艺术家页 */ = {
isa = PBXGroup;
children = (
CBAFCA6B2C0A10500054500E /* MPPositive_ArtistShowViewController.swift */,
CBAFCA6C2C0A10500054500E /* MPPositive_HomeViewController.swift */,
CBAFCA6D2C0A10500054500E /* MPPositive_ListShowViewController.swift */,
CBAFCA6E2C0A10500054500E /* MPPositive_MoreContentViewController.swift */,
CBAFCA6D2C0A10500054500E /* MPPositive_ListShowViewController.swift */,
CBAFCA6B2C0A10500054500E /* MPPositive_ArtistShowViewController.swift */,
);
path = "Home首页各项列表页艺术家页";
sourceTree = "<group>";
@ -735,8 +735,8 @@
CBAFCA732C0A10500054500E /* Player播放器 */ = {
isa = PBXGroup;
children = (
CBAFCA702C0A10500054500E /* MPPositive_PlayerListShowViewController.swift */,
CBAFCA712C0A10500054500E /* MPPositive_PlayerViewController.swift */,
CBAFCA702C0A10500054500E /* MPPositive_PlayerListShowViewController.swift */,
CBAFCA722C0A10500054500E /* MPPositive_RecommendViewController.swift */,
);
path = "Player播放器";
@ -745,8 +745,8 @@
CBAFCA762C0A10500054500E /* Search搜索页 */ = {
isa = PBXGroup;
children = (
CBAFCA742C0A10500054500E /* MPPositive_SearchResultShowViewController.swift */,
CBAFCA752C0A10500054500E /* MPPositive_SearchViewController.swift */,
CBAFCA742C0A10500054500E /* MPPositive_SearchResultShowViewController.swift */,
);
path = "Search搜索页";
sourceTree = "<group>";
@ -755,10 +755,10 @@
isa = PBXGroup;
children = (
CBAFCA652C0A10500054500E /* Base基类导航栏标签栏 */,
CBAFCA6A2C0A10500054500E /* Center个人曲库页 */,
CBAFCA6F2C0A10500054500E /* Home首页各项列表页艺术家页 */,
CBAFCA732C0A10500054500E /* Player播放器 */,
CBAFCA762C0A10500054500E /* Search搜索页 */,
CBAFCA6A2C0A10500054500E /* Center个人曲库页 */,
);
path = ViewControllers;
sourceTree = "<group>";
@ -766,10 +766,10 @@
CBAFCA7D2C0A10500054500E /* Base */ = {
isa = PBXGroup;
children = (
CBAFCA782C0A10500054500E /* MPPositive_BottomShowView.swift */,
CBAFCA792C0A10500054500E /* MPPositive_CustomTabBar.swift */,
CBAFCA7A2C0A10500054500E /* MPPositive_CustomTabBarItem.swift */,
CBAFCA7B2C0A10500054500E /* MPPositive_CustomTabBarView.swift */,
CBAFCA782C0A10500054500E /* MPPositive_BottomShowView.swift */,
CBAFCA7C2C0A10500054500E /* MPPositive_MoreOperationDownLoadTableViewCell.swift */,
);
path = Base;
@ -787,21 +787,21 @@
CBAFCA902C0A10500054500E /* Home */ = {
isa = PBXGroup;
children = (
CBAFCA8D2C0A10500054500E /* MPPositive_HomeShowTableViewCell.swift */,
CBAFCA892C0A10500054500E /* MPPositive_HomeListFirstCollectionViewCell.swift */,
CBAFCA8C2C0A10500054500E /* MPPositive_HomeListThirdCollectionViewCell.swift */,
CBAFCA8B2C0A10500054500E /* MPPositive_HomeListSecondCollectionViewCell.swift */,
CBAFCA8A2C0A10500054500E /* MPPositive_HomeListFourthCollectionViewCell.swift */,
CBAFCA882C0A10500054500E /* MPPositive_HomeListFifthCollectionViewCell.swift */,
CBAFCA8F2C0A10500054500E /* MPPositive_MusicItemShowTableViewCell.swift */,
CBAFCA8E2C0A10500054500E /* MPPositive_MoreListContentCollectionViewCell.swift */,
CBAFCA832C0A10500054500E /* MPPositive_ArtistShowHeaderView.swift */,
CBAFCA872C0A10500054500E /* MPPositive_ArtistShowTypeView.swift */,
CBAFCA812C0A10500054500E /* MPPositive_ArtistDescriptionTableViewCell.swift */,
CBAFCA822C0A10500054500E /* MPPositive_ArtistShowCollectionViewCell.swift */,
CBAFCA832C0A10500054500E /* MPPositive_ArtistShowHeaderView.swift */,
CBAFCA842C0A10500054500E /* MPPositive_ArtistShowListableViewCell.swift */,
CBAFCA852C0A10500054500E /* MPPositive_ArtistShowListCollectionViewCell.swift */,
CBAFCA862C0A10500054500E /* MPPositive_ArtistShowSongTableViewCell.swift */,
CBAFCA872C0A10500054500E /* MPPositive_ArtistShowTypeView.swift */,
CBAFCA882C0A10500054500E /* MPPositive_HomeListFifthCollectionViewCell.swift */,
CBAFCA892C0A10500054500E /* MPPositive_HomeListFirstCollectionViewCell.swift */,
CBAFCA8A2C0A10500054500E /* MPPositive_HomeListFourthCollectionViewCell.swift */,
CBAFCA8B2C0A10500054500E /* MPPositive_HomeListSecondCollectionViewCell.swift */,
CBAFCA8C2C0A10500054500E /* MPPositive_HomeListThirdCollectionViewCell.swift */,
CBAFCA8D2C0A10500054500E /* MPPositive_HomeShowTableViewCell.swift */,
CBAFCA8E2C0A10500054500E /* MPPositive_MoreListContentCollectionViewCell.swift */,
CBAFCA8F2C0A10500054500E /* MPPositive_MusicItemShowTableViewCell.swift */,
);
path = Home;
sourceTree = "<group>";
@ -810,9 +810,9 @@
isa = PBXGroup;
children = (
CBAFCA912C0A10500054500E /* MPPositive_PlayerCoverView.swift */,
CBAFCA922C0A10500054500E /* MPPositive_PlayerListShowTableViewCell.swift */,
CBAFCA932C0A10500054500E /* MPPositive_PlayerLyricView.swift */,
CBAFCA942C0A10500054500E /* MPPositive_PlayerSilder.swift */,
CBAFCA922C0A10500054500E /* MPPositive_PlayerListShowTableViewCell.swift */,
CBAFCA952C0A10500054500E /* MPPositive_RecommendMemberCollectionViewCell.swift */,
CBAFCA962C0A10500054500E /* MPPositive_RecommendShowTypeView.swift */,
);
@ -837,10 +837,10 @@
isa = PBXGroup;
children = (
CBAFCA7D2C0A10500054500E /* Base */,
CBAFCA802C0A10500054500E /* Center */,
CBAFCA902C0A10500054500E /* Home */,
CBAFCA972C0A10500054500E /* Player */,
CBAFCA9F2C0A10500054500E /* Search */,
CBAFCA802C0A10500054500E /* Center */,
);
path = Views;
sourceTree = "<group>";
@ -848,9 +848,9 @@
CBAFCAA12C0A10500054500E /* MPPositive */ = {
isa = PBXGroup;
children = (
CBAFCA5F2C0A10500054500E /* Models */,
CBAFCA772C0A10500054500E /* ViewControllers */,
CBAFCAA02C0A10500054500E /* Views */,
CBAFCA5F2C0A10500054500E /* Models */,
);
path = MPPositive;
sourceTree = "<group>";
@ -912,22 +912,22 @@
CBAFCAC12C0A10500054500E /* Center个人资源 */ = {
isa = PBXGroup;
children = (
CBAFCAB12C0A10500054500E /* MPSideA_AboutViewController.swift */,
CBAFCAB22C0A10500054500E /* MPSideA_AboutViewController.xib */,
CBAFCAB32C0A10500054500E /* MPSideA_CenterViewController.swift */,
CBAFCAB42C0A10500054500E /* MPSideA_CenterViewController.xib */,
CBAFCAB52C0A10500054500E /* MPSideA_DeleteViewController.swift */,
CBAFCAB62C0A10500054500E /* MPSideA_DeleteViewController.xib */,
CBAFCAB72C0A10500054500E /* MPSideA_MoreViewController.swift */,
CBAFCAB82C0A10500054500E /* MPSideA_MoreViewController.xib */,
CBAFCAB92C0A10500054500E /* MPSideA_PrivacyViewController.swift */,
CBAFCABA2C0A10500054500E /* MPSideA_PrivacyViewController.xib */,
CBAFCABB2C0A10500054500E /* MPSideA_RenameViewController.swift */,
CBAFCABC2C0A10500054500E /* MPSideA_RenameViewController.xib */,
CBAFCABD2C0A10500054500E /* MPSideA_ServiceViewController.swift */,
CBAFCABE2C0A10500054500E /* MPSideA_ServiceViewController.xib */,
CBAFCAB52C0A10500054500E /* MPSideA_DeleteViewController.swift */,
CBAFCAB62C0A10500054500E /* MPSideA_DeleteViewController.xib */,
CBAFCABF2C0A10500054500E /* MPSideA_SettingViewController.swift */,
CBAFCAC02C0A10500054500E /* MPSideA_SettingViewController.xib */,
CBAFCAB12C0A10500054500E /* MPSideA_AboutViewController.swift */,
CBAFCAB22C0A10500054500E /* MPSideA_AboutViewController.xib */,
CBAFCAB92C0A10500054500E /* MPSideA_PrivacyViewController.swift */,
CBAFCABA2C0A10500054500E /* MPSideA_PrivacyViewController.xib */,
CBAFCABD2C0A10500054500E /* MPSideA_ServiceViewController.swift */,
CBAFCABE2C0A10500054500E /* MPSideA_ServiceViewController.xib */,
);
path = "Center个人资源";
sourceTree = "<group>";
@ -948,10 +948,10 @@
CBAFCAC92C0A10500054500E /* ViewControllers */ = {
isa = PBXGroup;
children = (
CBAFCAAB2C0A10500054500E /* Add(新增资源) */,
CBAFCAB02C0A10500054500E /* Base(基类-导航栏-标签栏-计时器-播放器) */,
CBAFCAC12C0A10500054500E /* Center个人资源 */,
CBAFCAC82C0A10500054500E /* Home(音乐资源列表) */,
CBAFCAAB2C0A10500054500E /* Add(新增资源) */,
CBAFCAC12C0A10500054500E /* Center个人资源 */,
);
path = ViewControllers;
sourceTree = "<group>";
@ -1018,9 +1018,9 @@
CBAFCAE32C0A10500054500E /* MPSideA */ = {
isa = PBXGroup;
children = (
CBAFCAA82C0A10500054500E /* Models */,
CBAFCAC92C0A10500054500E /* ViewControllers */,
CBAFCAE22C0A10500054500E /* Views */,
CBAFCAA82C0A10500054500E /* Models */,
);
path = MPSideA;
sourceTree = "<group>";

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
uuid = "B2D42C7E-B789-40F0-8339-B70A223A3889"
type = "0"
version = "2.0">
</Bucket>

View File

@ -81,6 +81,18 @@ class MP_LunchViewController: UIViewController {
}
//
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 {
//

View File

@ -18,8 +18,10 @@ extension JXPagingListContainerView: JXSegmentedViewListContainer {}
let screen_Width = UIScreen.main.bounds.width
///
let screen_Height = UIScreen.main.bounds.height
///
///
let width = screen_Width / 375
///
let height = screen_Height / 667
///
#if __IPHONE_13_0
let statusBarHeight:CGFloat = UIApplication.shared.windows.first?.windowScene?.statusBarManager?.statusBarFrame.size.height
@ -39,7 +41,15 @@ let Phone_Model = UIDevice.current.model
///
let System_Version = UIDevice.current.systemVersion
///
let Language_first_local = NSLocale.preferredLanguages.first!
var Language_first_local:String {
let first = Locale.preferredLanguages.first!
let languageCode = Locale(identifier: first).languageCode
if let code = languageCode {
return code
} else {
return "en"
}
}
///
var app_Version:String{
if let version = Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String {

View File

@ -15,7 +15,7 @@ class MPPositive_Debouncer: NSObject {
private var delay: TimeInterval
private override init() {
delay = 0.5
delay = 0.2
super.init()
}
deinit {

View File

@ -82,7 +82,7 @@ class MP_NetWorkManager: NSObject {
//
private lazy var currTimeDate:String = (Date().timeZone() - 7.days).toString(.custom("YYYYMMdd"))
///
private var locaton:String?
private var locaton:String? = "HK"
//
private var continuationAndItct:(String?,String?){
willSet{
@ -110,7 +110,7 @@ class MP_NetWorkManager: NSObject {
//
"hl":Language_first_local,
//
"gl":locaton ?? ""
"gl":locaton ?? "HK"
]
]
]
@ -291,6 +291,9 @@ extension MP_NetWorkManager {
parsingBrowseContinuationContents(continuationContents)
}else {
print("Failed to parse browses content")
//
handleError(url, error: nil)
browseQueque = nil
}
case .failure(let error):
//
@ -1050,9 +1053,9 @@ extension MP_NetWorkManager {
}
}
///
private func handleError(_ url: URL, error:AFError) {
private func handleError(_ url: URL, error:AFError?) {
//
if let statusCode = error.responseCode {
if let statusCode = error?.responseCode {
switch statusCode {
case 400...499:
print("\(url)请求错误,错误码: \(statusCode)")
@ -1061,7 +1064,7 @@ extension MP_NetWorkManager {
default:
print("\(url)其他 HTTP 错误,错误码: \(statusCode)")
}
} else if let underlyingError = error.underlyingError as? URLError {
} else if let underlyingError = error?.underlyingError as? URLError {
switch underlyingError.code {
case .notConnectedToInternet:
print("\(url)网络连接不可用,请检查你的网络设置。")
@ -1071,7 +1074,7 @@ extension MP_NetWorkManager {
print("\(url)NSURL 错误,错误码: \(underlyingError.code.rawValue)")
}
} else {
print("\(url)未知错误: \(error.localizedDescription)")
print("\(url)未知错误: \(error?.localizedDescription ?? "")")
}
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
//

View File

@ -77,6 +77,7 @@ class MP_PlayerManager:NSObject{
//load
NotificationCenter.notificationKey.post(notificationName: .player_delete_list)
playState = .Null
player.pause()
}
}
}
@ -145,6 +146,8 @@ class MP_PlayerManager:NSObject{
cacheLoadTimes()
//
let currentDuration = CMTimeGetSeconds(time)
//
updateProgress(currentDuration)
//
let maxDuration = getMusicDuration()
if maxDuration.isNaN == false {
@ -164,6 +167,8 @@ class MP_PlayerManager:NSObject{
center?.pauseCommand.removeTarget(self)
center?.nextTrackCommand.removeTarget(self)
center?.previousTrackCommand.removeTarget(self)
timer?.cancel()
timer = nil
}
///
/// - Parameters:
@ -646,5 +651,15 @@ class MP_PlayerManager:NSObject{
}
}
}
//
private func updateProgress(_ time:TimeInterval) {
if var nowPlayingInfo = MPNowPlayingInfoCenter.default().nowPlayingInfo {
nowPlayingInfo[MPNowPlayingInfoPropertyElapsedPlaybackTime] = time
DispatchQueue.main.async {
//
MPNowPlayingInfoCenter.default().nowPlayingInfo = nowPlayingInfo
}
}
}
}

View File

@ -19,6 +19,8 @@ class MPPositive_TabBarController: UITabBarController, UIViewControllerTransitio
}
}
}
//Push
private var isPush:Bool = false
override func viewDidLoad() {
super.viewDidLoad()
self.setValue(customTabBar, forKey: "tabBar")
@ -75,7 +77,6 @@ class MPPositive_TabBarController: UITabBarController, UIViewControllerTransitio
func presentationController(forPresented presented: UIViewController, presenting: UIViewController?, source: UIViewController) -> UIPresentationController? {
return MPPositive_PresentationController(presentedViewController: presented, presenting: presenting)
}
//
}
//MARK: -
@ -90,15 +91,22 @@ extension MPPositive_TabBarController {
DispatchQueue.main.async {
[weak self] in
//load
if MP_PlayerManager.shared.loadPlayer != nil{
let playerVC = MPPositive_PlayerViewController()
playerVC.modalPresentationStyle = .fullScreen
playerVC.recommendBlock = {
let recommendVC = MPPositive_RecommendViewController(MP_PlayerManager.shared.loadPlayer.currentVideo.song.relatedID)
self?.viewControllers![self?.selectedIndex ?? 0].children[0].navigationController?.pushViewController(recommendVC, animated: true)
}
self?.present(playerVC, animated: true)
// if MP_PlayerManager.shared.loadPlayer != nil{
// let playerVC = MPPositive_PlayerViewController()
// playerVC.modalPresentationStyle = .fullScreen
// playerVC.recommendBlock = {
// let recommendVC = MPPositive_RecommendViewController(MP_PlayerManager.shared.loadPlayer.currentVideo.song.relatedID)
// self?.viewControllers![self?.selectedIndex ?? 0].children[0].navigationController?.pushViewController(recommendVC, animated: true)
// }
// self?.present(playerVC, animated: true)
// }
let playerVC = MPPositive_PlayerViewController()
playerVC.modalPresentationStyle = .fullScreen
playerVC.recommendBlock = {
let recommendVC = MPPositive_RecommendViewController(MP_PlayerManager.shared.loadPlayer.currentVideo.song.relatedID)
self?.viewControllers![self?.selectedIndex ?? 0].children[0].navigationController?.pushViewController(recommendVC, animated: true)
}
self?.present(playerVC, animated: true)
}
}
//
@ -112,7 +120,7 @@ extension MPPositive_TabBarController {
guard let self = self else { return }
if state {
//
bottomView.transform = .init(translationX: 0, y: -145*width)
bottomView.transform = .init(translationX: 0, y: isPush ? -82*width:-145*width)
}else {
//
bottomView.transform = .identity
@ -121,6 +129,7 @@ extension MPPositive_TabBarController {
}
//push
@objc private func pushAction(_ sender:Notification) {
isPush = true
//
if isbottomShow == true {
//bottomView83
@ -132,6 +141,7 @@ extension MPPositive_TabBarController {
}
}
@objc private func popAction(_ sender:Notification) {
isPush = false
//
if isbottomShow == true {
//bottomView83

View File

@ -112,6 +112,10 @@ extension MPPositive_LoveSongsViewController: UITableViewDataSource, UITableView
MPPositive_Debouncer.shared.call {
[weak self] in
guard let self = self else {return}
//
NotificationCenter.notificationKey.post(notificationName: .pup_player_vc)
//
MP_PlayerManager.shared.loadPlayer = nil
//
var array:[MPPositive_SongItemModel] = []
for (index,song) in MPPositive_LoadCoreModel.shared.songViewModels.enumerated() {
@ -129,7 +133,7 @@ extension MPPositive_LoveSongsViewController: UITableViewDataSource, UITableView
let lodaViewModel = MPPositive_PlayerLoadViewModel(array, currentVideoId: MPPositive_LoadCoreModel.shared.songViewModels[indexPath.row].collectionSong.videoId ?? "")
lodaViewModel.improveData(MPPositive_LoadCoreModel.shared.songViewModels[indexPath.row].collectionSong.videoId ?? "")
MP_PlayerManager.shared.loadPlayer = lodaViewModel
NotificationCenter.notificationKey.post(notificationName: .pup_player_vc)
// NotificationCenter.notificationKey.post(notificationName: .pup_player_vc)
}
}
func presentationController(forPresented presented: UIViewController, presenting: UIViewController?, source: UIViewController) -> UIPresentationController? {

View File

@ -99,6 +99,10 @@ extension MPPositive_OfflineSongsViewController: UITableViewDataSource, UITableV
MPPositive_Debouncer.shared.call {
[weak self] in
guard let self = self else {return}
//
NotificationCenter.notificationKey.post(notificationName: .pup_player_vc)
//
MP_PlayerManager.shared.loadPlayer = nil
//
var array:[MPPositive_SongItemModel] = []
for (index, song) in MPPositive_LoadCoreModel.shared.loadViewModels.enumerated() {
@ -119,7 +123,7 @@ extension MPPositive_OfflineSongsViewController: UITableViewDataSource, UITableV
let lodaViewModel = MPPositive_PlayerLoadViewModel(array, currentVideoId: MPPositive_LoadCoreModel.shared.loadViewModels[indexPath.row].loadItem.videoId ?? "")
lodaViewModel.improveData(MPPositive_LoadCoreModel.shared.loadViewModels[indexPath.row].loadItem.videoId ?? "")
MP_PlayerManager.shared.loadPlayer = lodaViewModel
NotificationCenter.notificationKey.post(notificationName: .pup_player_vc)
// NotificationCenter.notificationKey.post(notificationName: .pup_player_vc)
}
}
func presentationController(forPresented presented: UIViewController, presenting: UIViewController?, source: UIViewController) -> UIPresentationController? {

View File

@ -216,6 +216,10 @@ extension MPPositive_ArtistShowViewController: JXPagingViewDelegate{
[weak self] in
guard let self = self else {return}
///
//
NotificationCenter.notificationKey.post(notificationName: .pup_player_vc)
//
MP_PlayerManager.shared.loadPlayer = nil
//next
MP_NetWorkManager.shared.requestNextList(item.browseItem.playListId ?? "", videoId: item.browseItem.videoId ?? ""){ [weak self] listSongs in
guard let self = self else {return}
@ -223,7 +227,7 @@ 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)
// NotificationCenter.notificationKey.post(notificationName: .pup_player_vc)
}
}
case .none:

View File

@ -40,8 +40,8 @@ class MPPositive_HomeViewController: MPPositive_BaseViewController{
super.viewDidLoad()
setTitle("Musiclax")
confirgue()
//
MPPositive_BrowseLoadViewModel.shared.reloadBrowseLists()
// //
// MPPositive_BrowseLoadViewModel.shared.reloadBrowseLists()
NotificationCenter.notificationKey.add(observer: self, selector: #selector(reloadAction(_ :)), notificationName: .positive_browses_reload)
MP_HUD.loading()
errorBlock = {
@ -158,6 +158,10 @@ extension MPPositive_HomeViewController: UITableViewDataSource, UITableViewDeleg
MPPositive_Debouncer.shared.call {
[weak self] in
guard let self = self else {return}
//
NotificationCenter.notificationKey.post(notificationName: .pup_player_vc)
//
MP_PlayerManager.shared.loadPlayer = nil
//next
MP_NetWorkManager.shared.requestNextList(item.browseItem.playListId ?? "", videoId: item.browseItem.videoId ?? ""){ [weak self] listSongs in
guard let self = self else {return}
@ -165,7 +169,7 @@ extension MPPositive_HomeViewController: UITableViewDataSource, UITableViewDeleg
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)
// NotificationCenter.notificationKey.post(notificationName: .pup_player_vc)
}
}
case .list:

View File

@ -253,6 +253,10 @@ class MPPositive_ListShowViewController: MPPositive_BaseViewController, UIViewCo
MPPositive_Debouncer.shared.call {
[weak self] in
guard let self = self, let item = listOrAlbum.items.randomElement() else {return}
//
NotificationCenter.notificationKey.post(notificationName: .pup_player_vc)
//
MP_PlayerManager.shared.loadPlayer = nil
//next
MP_NetWorkManager.shared.requestNextList(item.browseItem.playListId ?? "", videoId: item.browseItem.videoId ?? ""){ [weak self] listSongs in
guard let self = self else {return}
@ -260,8 +264,8 @@ class MPPositive_ListShowViewController: MPPositive_BaseViewController, UIViewCo
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)
//
// NotificationCenter.notificationKey.post(notificationName: .pup_player_vc)
}
}
}
@ -339,6 +343,8 @@ extension MPPositive_ListShowViewController: UITableViewDataSource, UITableViewD
MPPositive_Debouncer.shared.call {
[weak self] in
guard let self = self else {return}
//
NotificationCenter.notificationKey.post(notificationName: .pup_player_vc)
//next
MP_NetWorkManager.shared.requestNextList(listOrAlbum.items[indexPath.row].browseItem.playListId ?? "", videoId: listOrAlbum.items[indexPath.row].browseItem.videoId ?? ""){ [weak self] listSongs in
guard let self = self else {return}
@ -347,7 +353,7 @@ extension MPPositive_ListShowViewController: UITableViewDataSource, UITableViewD
lodaViewModel.improveData(listOrAlbum.items[indexPath.row].browseItem.videoId ?? "")
MP_PlayerManager.shared.loadPlayer = lodaViewModel
//
NotificationCenter.notificationKey.post(notificationName: .pup_player_vc)
// NotificationCenter.notificationKey.post(notificationName: .pup_player_vc)
}
}
}

View File

@ -12,19 +12,23 @@ class MPPositive_MoreContentViewController: MPPositive_BaseViewController {
enum MoreShowType: Int {
case Single = 0
case List = 1
case Video = 2
//Layout
var layout:UICollectionViewFlowLayout{
let layout = UICollectionViewFlowLayout()
layout.sectionInset = .init(top: 0, left: 18*width, bottom: 50*width, right: 16*width)
switch self {
case .Single:
layout.itemSize = .init(width: 339*width, height: 237*width)
layout.itemSize = .init(width: 168*width, height: 134*width)
layout.minimumInteritemSpacing = 5*width
layout.minimumLineSpacing = 32*width
case .List:
layout.itemSize = .init(width: 162*width, height: 210*width)
layout.minimumLineSpacing = 32*width
layout.minimumInteritemSpacing = 15*width
case .Video:
layout.itemSize = .init(width: 339*width, height: 237*width)
layout.minimumLineSpacing = 32*width
}
return layout
}
@ -43,12 +47,14 @@ class MPPositive_MoreContentViewController: MPPositive_BaseViewController {
collectionView.backgroundColor = .clear
collectionView.dataSource = self
collectionView.delegate = self
collectionView.register(MPPositive_HomeListFirstCollectionViewCell.self, forCellWithReuseIdentifier: MPPositive_HomeListFirstCollectionViewCellID)
collectionView.register(MPPositive_MoreListContentCollectionViewCell.self, forCellWithReuseIdentifier: MPPositive_MoreListContentCollectionViewCellID)
collectionView.register(MPPositive_HomeListFifthCollectionViewCell.self, forCellWithReuseIdentifier: MPPositive_HomeListFifthCollectionViewCellID)
collectionView.contentInset = .init(top: 0, left: 0, bottom: 70*width, right: 0)
return collectionView
}()
//cell
private let MPPositive_HomeListFirstCollectionViewCellID = "MPPositive_HomeListFirstCollectionViewCell"
private let MPPositive_MoreListContentCollectionViewCellID = "MPPositive_MoreListContentCollectionViewCell"
//cell
private let MPPositive_HomeListFifthCollectionViewCellID = "MPPositive_HomeListFifthCollectionViewCell"
@ -86,23 +92,31 @@ extension MPPositive_MoreContentViewController: UICollectionViewDataSource, UICo
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
switch showType {
case .Single:
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: MPPositive_HomeListFifthCollectionViewCellID, for: indexPath) as! MPPositive_HomeListFifthCollectionViewCell
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: MPPositive_HomeListFirstCollectionViewCellID, for: indexPath) as! MPPositive_HomeListFirstCollectionViewCell
cell.itemViewModel = browseModuleList.items[indexPath.row]
return cell
case .List:
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: MPPositive_MoreListContentCollectionViewCellID, for: indexPath) as! MPPositive_MoreListContentCollectionViewCell
cell.itemViewModel = browseModuleList.items[indexPath.row]
return cell
case .Video:
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: MPPositive_HomeListFifthCollectionViewCellID, for: indexPath) as! MPPositive_HomeListFifthCollectionViewCell
cell.itemViewModel = browseModuleList.items[indexPath.row]
return cell
}
}
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
MP_AnalyticsManager.shared.home_b_module_clickAction(browseModuleList.title)
switch showType {
case .Single:
case .Single, .Video:
///
MPPositive_Debouncer.shared.call {
[weak self] in
guard let self = self else {return}
//
NotificationCenter.notificationKey.post(notificationName: .pup_player_vc)
//
MP_PlayerManager.shared.loadPlayer = nil
//next
MP_NetWorkManager.shared.requestNextList(browseModuleList.items[indexPath.row].browseItem.playListId ?? "", videoId: browseModuleList.items[indexPath.row].browseItem.videoId ?? ""){ [weak self] listSongs in
guard let self = self else {return}
@ -110,7 +124,7 @@ extension MPPositive_MoreContentViewController: UICollectionViewDataSource, UICo
let lodaViewModel = MPPositive_PlayerLoadViewModel(listSongs, currentVideoId: browseModuleList.items[indexPath.row].browseItem.videoId ?? "")
lodaViewModel.improveData(browseModuleList.items[indexPath.row].browseItem.videoId ?? "")
MP_PlayerManager.shared.loadPlayer = lodaViewModel
NotificationCenter.notificationKey.post(notificationName: .pup_player_vc)
// NotificationCenter.notificationKey.post(notificationName: .pup_player_vc)
}
}
default:

View File

@ -7,6 +7,7 @@
import UIKit
import Kingfisher
///b
class MPPositive_PlayerViewController: MPPositive_BaseViewController, UIViewControllerTransitioningDelegate {
//
@ -54,6 +55,7 @@ class MPPositive_PlayerViewController: MPPositive_BaseViewController, UIViewCont
//
private lazy var backImageView:UIImageView = {
let imageView:UIImageView = .init()
imageView.image = placeholderImage
imageView.contentMode = .scaleAspectFill
return imageView
}()
@ -166,7 +168,7 @@ class MPPositive_PlayerViewController: MPPositive_BaseViewController, UIViewCont
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
//
if MP_PlayerManager.shared.loadPlayer.currentVideo != nil {
if MP_PlayerManager.shared.loadPlayer?.currentVideo != nil {
uploadUI()
}
}
@ -200,21 +202,6 @@ class MPPositive_PlayerViewController: MPPositive_BaseViewController, UIViewCont
backBlurView.snp.makeConstraints { make in
make.left.right.top.bottom.equalToSuperview()
}
//
view.addSubview(lyricsView)
lyricsView.snp.makeConstraints { make in
make.top.equalTo(navView.snp.bottom)
make.left.right.equalToSuperview()
make.height.equalTo(480*width)
}
lyricsView.isHidden = true
view.addSubview(coverView)
coverView.snp.makeConstraints { make in
make.top.equalTo(navView.snp.bottom)
make.left.right.equalToSuperview()
make.height.equalTo(480*width)
}
coverView.isHidden = false
let bottomImageView:UIImageView = .init(image: .init(named: "Player_Bottom'mask"))
bottomImageView.contentMode = .scaleAspectFill
bottomImageView.isUserInteractionEnabled = false
@ -230,6 +217,21 @@ class MPPositive_PlayerViewController: MPPositive_BaseViewController, UIViewCont
make.left.right.bottom.equalToSuperview()
make.height.equalTo(200*width)
}
//
view.addSubview(lyricsView)
lyricsView.snp.makeConstraints { make in
make.top.equalTo(navView.snp.bottom)
make.left.right.equalToSuperview()
make.height.equalTo(480*width)
}
lyricsView.isHidden = true
view.addSubview(coverView)
coverView.snp.makeConstraints { make in
make.top.equalTo(navView.snp.bottom)
make.left.right.equalToSuperview()
make.height.equalTo(480*width)
}
coverView.isHidden = false
}
//View
private func createSwitchActionView() -> UIView {
@ -274,18 +276,19 @@ class MPPositive_PlayerViewController: MPPositive_BaseViewController, UIViewCont
bottomView.addSubview(playBtn)
playBtn.snp.makeConstraints { make in
make.width.height.equalTo(66*width)
make.center.equalToSuperview()
make.centerX.equalToSuperview()
make.centerY.equalToSuperview().multipliedBy(1.1)
}
bottomView.addSubview(listBtn)
listBtn.snp.makeConstraints { make in
make.right.equalToSuperview().offset(-20*width)
make.centerY.equalToSuperview()
make.centerY.equalTo(playBtn)
make.width.height.equalTo(24*width)
}
bottomView.addSubview(typeBtn)
typeBtn.snp.makeConstraints { make in
make.left.equalToSuperview().offset(20*width)
make.centerY.equalToSuperview()
make.centerY.equalTo(playBtn)
make.width.height.equalTo(24*width)
}
bottomView.addSubview(nextBtn)
@ -309,13 +312,13 @@ class MPPositive_PlayerViewController: MPPositive_BaseViewController, UIViewCont
guard let self = self else {return}
print("\(MP_PlayerManager.shared.loadPlayer.currentVideo.title ?? "")刷新了页面")
//
backImageView.kf.setImage(with: MP_PlayerManager.shared.loadPlayer.currentVideo?.coverUrl)
coverView.coverImageView.kf.setImage(with: MP_PlayerManager.shared.loadPlayer.currentVideo?.coverUrl)
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.titleLabel.text = MP_PlayerManager.shared.loadPlayer.currentVideo?.title
coverView.subtitleLabel.text = MP_PlayerManager.shared.loadPlayer.currentVideo?.subtitle
lyricsView.titleLabel.text = MP_PlayerManager.shared.loadPlayer.currentVideo?.title
lyricsView.subtitleLabel.text = MP_PlayerManager.shared.loadPlayer.currentVideo?.subtitle
lyricsView.lyricsLabel.text = MP_PlayerManager.shared.loadPlayer.currentVideo?.lyrics?.isEmpty == true ? "No Lyrics":MP_PlayerManager.shared.loadPlayer.currentVideo?.lyrics
lyricsView.lyricsLabel.text = (MP_PlayerManager.shared.loadPlayer.currentVideo?.lyrics ?? "").isEmpty == true ? "No Lyrics":MP_PlayerManager.shared.loadPlayer.currentVideo?.lyrics
coverView.downloadButton.state = (MPPositive_DownloadItemModel.fetch(.init(format: "videoId == %@", MP_PlayerManager.shared.loadPlayer.currentVideo?.song.videoId ?? "")).count != 0) ? .downloaded:.startDownload
coverView.downloadButton.isUserInteractionEnabled = !(MP_PlayerManager.shared.loadPlayer.currentVideo?.isDlownd ?? false)
coverView.collectionSongBtn.isSelected = MP_PlayerManager.shared.loadPlayer.currentVideo?.isCollection ?? false

View File

@ -114,6 +114,10 @@ class MPPositive_SearchResultShowViewController: MPPositive_BaseViewController,
[weak self] in
guard let self = self else {return}
///
//
NotificationCenter.notificationKey.post(notificationName: .pup_player_vc)
//
MP_PlayerManager.shared.loadPlayer = nil
//next
MP_NetWorkManager.shared.requestNextList(item.item.playListId ?? "", videoId: item.item.videoId ?? ""){ [weak self] listSongs in
guard let self = self else {return}
@ -121,7 +125,7 @@ class MPPositive_SearchResultShowViewController: MPPositive_BaseViewController,
let lodaViewModel = MPPositive_PlayerLoadViewModel(listSongs, currentVideoId: item.item.videoId ?? "")
lodaViewModel.improveData(item.item.videoId ?? "")
MP_PlayerManager.shared.loadPlayer = lodaViewModel
NotificationCenter.notificationKey.post(notificationName: .pup_player_vc)
// NotificationCenter.notificationKey.post(notificationName: .pup_player_vc)
}
}
case .none:

View File

@ -18,13 +18,12 @@ class MPPositive_MoreOperationDownLoadTableViewCell: UITableViewCell {
//
btn.downloadedButton.setBackgroundImage(UIImage(named: "Song_Loaded'logo"), for: .normal)
btn.downloadedButton.isUserInteractionEnabled = false
btn.downloadedButton.setAttributedTitle(nil, for: .normal)
//
btn.stopDownloadButton.stopButton.setImage(UIImage(named: "download"), for: .normal)
btn.stopDownloadButton.isUserInteractionEnabled = false
btn.stopDownloadButton.tintColor = UIColor(hex: "#80F988")
btn.stopDownloadButton.stopButtonWidth = 1
btn.stopDownloadButton.stopButton.backgroundColor = .clear
btn.stopDownloadButton.stopButton.tintColor = .clear
btn.stopDownloadButton.stopButtonWidth = 2
btn.stopDownloadButton.filledLineWidth = 3*width
btn.stopDownloadButton.filledLineStyleOuter = true

View File

@ -6,21 +6,19 @@ import UIKit
import DownloadButton
//BView(View)
class MPPositive_PlayerCoverView: UIView, PKDownloadButtonDelegate {
//View
// private var loadView = CircularProgressView()
///
lazy var coverImageView:UIImageView = {
let imageView = UIImageView()
imageView.image = placeholderImage
imageView.contentMode = .scaleAspectFill
imageView.layer.masksToBounds = true
imageView.layer.cornerRadius = 16*width
return imageView
}()
///
lazy var titleLabel:UILabel = createLabel(font: .systemFont(ofSize: 22*width, weight: .regular), textColor: .init(hex: "#FFFFFF", alpha: 0.85), textAlignment: .left)
lazy var titleLabel:UILabel = createLabel("Loading", font: .systemFont(ofSize: 22*width, weight: .regular), textColor: .init(hex: "#FFFFFF", alpha: 0.85), textAlignment: .left)
///
lazy var subtitleLabel:UILabel = createLabel(font: .systemFont(ofSize: 12*width, weight: .regular), textColor: .init(hex: "#EEEEEE", alpha: 0.6), textAlignment: .left)
lazy var subtitleLabel:UILabel = createLabel("Loading", font: .systemFont(ofSize: 12*width, weight: .regular), textColor: .init(hex: "#EEEEEE", alpha: 0.6), textAlignment: .left)
///
lazy var collectionSongBtn:UIButton = {
let btn = UIButton()
@ -30,14 +28,6 @@ class MPPositive_PlayerCoverView: UIView, PKDownloadButtonDelegate {
return btn
}()
///
// lazy var loadBtn:UIButton = {
// let btn:UIButton = .init()
// btn.setBackgroundImage(UIImage(named: "Song_Unload'logo"), for: .normal)
// btn.setBackgroundImage(UIImage(named: "Song_Loaded'logo"), for: .selected)
// btn.addTarget(self, action: #selector(loadActionClick(_ :)), for: .touchUpInside)
// return btn
// }()
///
lazy var downloadButton:PKDownloadButton = {
let btn:PKDownloadButton = .init()
//
@ -46,13 +36,12 @@ class MPPositive_PlayerCoverView: UIView, PKDownloadButtonDelegate {
//
btn.downloadedButton.setBackgroundImage(UIImage(named: "Song_Loaded'logo"), for: .normal)
btn.downloadedButton.isUserInteractionEnabled = false
btn.downloadedButton.setAttributedTitle(nil, for: .normal)
//
btn.stopDownloadButton.stopButton.setImage(UIImage(named: "download"), for: .normal)
btn.stopDownloadButton.isUserInteractionEnabled = false
btn.stopDownloadButton.tintColor = UIColor(hex: "#80F988")
btn.stopDownloadButton.stopButtonWidth = 1
btn.stopDownloadButton.stopButton.backgroundColor = .clear
btn.stopDownloadButton.stopButton.tintColor = .clear
btn.stopDownloadButton.stopButtonWidth = 2
btn.stopDownloadButton.filledLineWidth = 3*width
btn.stopDownloadButton.filledLineStyleOuter = true

View File

@ -24,7 +24,7 @@ class MPPositive_PlayerLyricView: UIView {
make.width.equalToSuperview().multipliedBy(0.89)
make.centerX.equalToSuperview()
make.top.equalToSuperview().offset(15*width)
make.bottom.equalToSuperview().offset(30*width)
make.bottom.equalToSuperview().offset(-30*width)
}
return scrollView
}()

View File

@ -15,9 +15,10 @@ class MPSideA_AboutViewController: MPSideA_BaseViewController {
versionView.isUserInteractionEnabled = true
}
}
@IBOutlet weak var versionLabel: UILabel!
override func viewDidLoad() {
super.viewDidLoad()
versionLabel.text = "Version \(app_Version)"
}
@objc private func versionClick(){
let eventAlert = UIAlertController(title: "Version Update", message: "is the latest Version", preferredStyle: .alert)

View File

@ -8,8 +8,9 @@
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="MPSideA_AboutViewController" customModule="MusicPlayer" customModuleProvider="target">
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="MPSideA_AboutViewController" customModule="relax_offline_mp3_music" customModuleProvider="target">
<connections>
<outlet property="versionLabel" destination="miJ-lx-eHK" id="FNF-zt-pBz"/>
<outlet property="versionView" destination="Wrk-iL-cGv" id="sjM-ZU-PyB"/>
<outlet property="view" destination="VwI-HU-Cye" id="KxG-DI-JCd"/>
</connections>