下载,收藏
This commit is contained in:
parent
97297c7c55
commit
e1f39fe1f7
@ -1455,7 +1455,7 @@
|
|||||||
CODE_SIGN_IDENTITY = "Apple Development";
|
CODE_SIGN_IDENTITY = "Apple Development";
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 1.2;
|
CURRENT_PROJECT_VERSION = 1.2;
|
||||||
DEVELOPMENT_TEAM = T93S37G27F;
|
DEVELOPMENT_TEAM = 6HWQW9JC74;
|
||||||
ENABLE_USER_SCRIPT_SANDBOXING = NO;
|
ENABLE_USER_SCRIPT_SANDBOXING = NO;
|
||||||
GENERATE_INFOPLIST_FILE = YES;
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
INFOPLIST_FILE = MusicPlayer/Info.plist;
|
INFOPLIST_FILE = MusicPlayer/Info.plist;
|
||||||
@ -1493,7 +1493,7 @@
|
|||||||
CODE_SIGN_IDENTITY = "Apple Development";
|
CODE_SIGN_IDENTITY = "Apple Development";
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 1.2;
|
CURRENT_PROJECT_VERSION = 1.2;
|
||||||
DEVELOPMENT_TEAM = T93S37G27F;
|
DEVELOPMENT_TEAM = 6HWQW9JC74;
|
||||||
ENABLE_USER_SCRIPT_SANDBOXING = NO;
|
ENABLE_USER_SCRIPT_SANDBOXING = NO;
|
||||||
GENERATE_INFOPLIST_FILE = YES;
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
INFOPLIST_FILE = MusicPlayer/Info.plist;
|
INFOPLIST_FILE = MusicPlayer/Info.plist;
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="22757" systemVersion="23E224" minimumToolsVersion="Automatic" sourceLanguage="Swift" userDefinedModelVersionIdentifier="">
|
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="22757" systemVersion="23E214" minimumToolsVersion="Automatic" sourceLanguage="Swift" userDefinedModelVersionIdentifier="">
|
||||||
<entity name="MPPositive_CollectionArtistModel" representedClassName="MPPositive_CollectionArtistModel" syncable="YES" codeGenerationType="class">
|
<entity name="MPPositive_CollectionArtistModel" representedClassName="MPPositive_CollectionArtistModel" syncable="YES">
|
||||||
<attribute name="artistId" optional="YES" attributeType="String"/>
|
<attribute name="artistId" optional="YES" attributeType="String"/>
|
||||||
<attribute name="coverImage" optional="YES" attributeType="URI"/>
|
<attribute name="coverImage" optional="YES" attributeType="URI"/>
|
||||||
<attribute name="subtitle" optional="YES" attributeType="String"/>
|
<attribute name="subtitle" optional="YES" attributeType="String"/>
|
||||||
|
|||||||
@ -19,4 +19,6 @@ class MPPositive_CollectionSongModel: NSManagedObject, MP_CoreDataManageableDele
|
|||||||
@NSManaged var subtitle:String?
|
@NSManaged var subtitle:String?
|
||||||
///播放的VideoID
|
///播放的VideoID
|
||||||
@NSManaged var videoId:String?
|
@NSManaged var videoId:String?
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -75,9 +75,11 @@ class MPPositive_SongViewModel: NSObject {
|
|||||||
relatedId = song.relatedID
|
relatedId = song.relatedID
|
||||||
}
|
}
|
||||||
//检索是否收藏
|
//检索是否收藏
|
||||||
|
isCollection = MPPositive_CollectionSongModel.fetch(.init(format: "videoId == %@", song.videoId)).count != 0
|
||||||
|
|
||||||
//检索是否下载
|
//检索是否下载
|
||||||
isDlownd = MPPositive_DownloadItemModel.fetch(.init(format: "videoId==%i", "dsadasda")).count != 0
|
isDlownd = MPPositive_DownloadItemModel.fetch(.init(format: "videoId == %@", song.videoId)).count != 0
|
||||||
|
|
||||||
//执行预加载
|
//执行预加载
|
||||||
if isPloading == false {
|
if isPloading == false {
|
||||||
preloadAsset(resourceAsset)
|
preloadAsset(resourceAsset)
|
||||||
|
|||||||
@ -307,9 +307,9 @@ class MPPositive_PlayerViewController: MPPositive_BaseViewController, UIViewCont
|
|||||||
coverView.subtitleLabel.text = MP_PlayerManager.shared.loadPlayer.currentVideo?.subtitle
|
coverView.subtitleLabel.text = MP_PlayerManager.shared.loadPlayer.currentVideo?.subtitle
|
||||||
lyricsView.titleLabel.text = MP_PlayerManager.shared.loadPlayer.currentVideo?.title
|
lyricsView.titleLabel.text = MP_PlayerManager.shared.loadPlayer.currentVideo?.title
|
||||||
lyricsView.subtitleLabel.text = MP_PlayerManager.shared.loadPlayer.currentVideo?.subtitle
|
lyricsView.subtitleLabel.text = MP_PlayerManager.shared.loadPlayer.currentVideo?.subtitle
|
||||||
lyricsView.lyricsLabel.text = MP_PlayerManager.shared.loadPlayer.currentVideo.lyrics ?? "No Lyrics"
|
lyricsView.lyricsLabel.text = MP_PlayerManager.shared.loadPlayer.currentVideo?.lyrics ?? "No Lyrics"
|
||||||
coverView.loadBtn.isSelected = MP_PlayerManager.shared.loadPlayer.currentVideo?.isDlownd ?? false
|
coverView.loadBtn.isSelected = 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
|
||||||
}
|
}
|
||||||
//MARK: - 通知
|
//MARK: - 通知
|
||||||
//播放器音乐刷新
|
//播放器音乐刷新
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
import SVProgressHUD
|
||||||
//B面播放器封面View(封面,标题,副标题,收藏,下载,进度条View)
|
//B面播放器封面View(封面,标题,副标题,收藏,下载,进度条View)
|
||||||
class MPPositive_PlayerCoverView: UIView {
|
class MPPositive_PlayerCoverView: UIView {
|
||||||
//下载进度条View
|
//下载进度条View
|
||||||
@ -148,10 +149,32 @@ class MPPositive_PlayerCoverView: UIView {
|
|||||||
}
|
}
|
||||||
//切换当前列表收藏状态
|
//切换当前列表收藏状态
|
||||||
@objc private func collectionSwitchClick(_ sender:UIButton) {
|
@objc private func collectionSwitchClick(_ sender:UIButton) {
|
||||||
|
if self.collectionSongBtn.isSelected == true{
|
||||||
|
self.collectionSongBtn.isSelected = false
|
||||||
|
if MP_PlayerManager.shared.loadPlayer.currentVideo != nil{
|
||||||
|
MPPositive_CollectionSongModel.fetch(.init(format: "videoId == %@", MP_PlayerManager.shared.loadPlayer.currentVideo.song.videoId)).forEach { i in
|
||||||
|
if i.videoId == MP_PlayerManager.shared.loadPlayer.currentVideo.song.videoId{
|
||||||
|
MPPositive_CollectionSongModel.delete(i)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
self.collectionSongBtn.isSelected = true
|
||||||
|
if MP_PlayerManager.shared.loadPlayer.currentVideo != nil{
|
||||||
|
let item = MPPositive_CollectionSongModel.create()
|
||||||
|
item.title = MP_PlayerManager.shared.loadPlayer.currentVideo.title
|
||||||
|
item.videoId = MP_PlayerManager.shared.loadPlayer.currentVideo.song.videoId
|
||||||
|
item.subtitle = MP_PlayerManager.shared.loadPlayer.currentVideo.subtitle
|
||||||
|
item.coverImage = MP_PlayerManager.shared.loadPlayer.currentVideo.coverUrl
|
||||||
|
MPPositive_CollectionSongModel.save()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//点击下载
|
//点击下载
|
||||||
@objc private func loadActionClick(_ sender:UIButton) {
|
@objc private func loadActionClick(_ sender:UIButton) {
|
||||||
|
|
||||||
|
if MP_PlayerManager.shared.loadPlayer.currentVideo?.isDlownd == false{
|
||||||
|
|
||||||
// 添加圆形进度条到下载按钮位置
|
// 添加圆形进度条到下载按钮位置
|
||||||
addCircularProgressBar(over: sender)
|
addCircularProgressBar(over: sender)
|
||||||
|
|
||||||
@ -189,11 +212,21 @@ class MPPositive_PlayerCoverView: UIView {
|
|||||||
case .failure(let error):
|
case .failure(let error):
|
||||||
print("Download failed with error: \(error)")
|
print("Download failed with error: \(error)")
|
||||||
self?.loadView.removeFromSuperview()
|
self?.loadView.removeFromSuperview()
|
||||||
|
DispatchQueue.main.async {
|
||||||
|
self?.loadBtn.setBackgroundImage(UIImage(named: "Song_Unload'logo"), for: .normal)
|
||||||
|
self?.loadBtn.setImage(UIImage(named: ""), for: .normal)
|
||||||
|
}
|
||||||
|
SVProgressHUD.showInfo(withStatus: "下载超时请重新下载")
|
||||||
|
DispatchQueue.main.asyncAfter(deadline: .now() + 1.5) {
|
||||||
|
SVProgressHUD.dismiss()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
// 添加圆形进度条
|
// 添加圆形进度条
|
||||||
private func addCircularProgressBar(over button: UIButton) {
|
private func addCircularProgressBar(over button: UIButton) {
|
||||||
loadView.removeFromSuperview() // 移除先前的进度视图(如果有)
|
loadView.removeFromSuperview() // 移除先前的进度视图(如果有)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user