재생목록 플레이어 추가

This commit is contained in:
Yu Sung
2024-12-17 23:13:19 +09:00
parent 9ca1493255
commit c3e60bd92c
21 changed files with 829 additions and 8 deletions

View File

@@ -10,6 +10,7 @@ import Kingfisher
struct ContentPlaylistDetailView: View {
@StateObject var viewModel = ContentPlaylistDetailViewModel()
@StateObject var contentPlayerPlayManager = ContentPlayerPlayManager.shared
let playlistId: Int
@Binding var isShowing: Bool
@@ -17,8 +18,10 @@ struct ContentPlaylistDetailView: View {
@State private var isShowPopupMenu = false
@State private var isShowDeleteConfirm = false
@State private var isShowPlayer = false
@State private var isShowModify = false
@State private var playlist: [AudioContentPlaylistContent] = []
var body: some View {
BaseView(isLoading: $viewModel.isLoading) {
@@ -148,6 +151,9 @@ struct ContentPlaylistDetailView: View {
.cornerRadius(5.3)
.contentShape(Rectangle())
.onTapGesture {
ContentPlayManager.shared.stopAudio()
playlist = response.contentList
isShowPlayer = true
}
HStack(spacing: 5.3) {
@@ -163,6 +169,9 @@ struct ContentPlaylistDetailView: View {
.cornerRadius(5.3)
.contentShape(Rectangle())
.onTapGesture {
ContentPlayManager.shared.stopAudio()
playlist = response.contentList.shuffled()
isShowPlayer = true
}
}
.padding(.top, 18)
@@ -177,6 +186,57 @@ struct ContentPlaylistDetailView: View {
.padding(.horizontal, 13.3)
}
}
if contentPlayerPlayManager.isShowingMiniPlayer {
HStack(spacing: 0) {
KFImage(URL(string: contentPlayerPlayManager.coverImageUrl))
.cancelOnDisappear(true)
.downsampling(
size: CGSize(
width: 36.7,
height: 36.7
)
)
.resizable()
.frame(width: 36.7, height: 36.7)
.cornerRadius(5.3)
VStack(alignment: .leading, spacing: 2.3) {
Text(contentPlayerPlayManager.title)
.font(.custom(Font.medium.rawValue, size: 13))
.foregroundColor(Color.grayee)
.lineLimit(2)
Text(contentPlayerPlayManager.nickname)
.font(.custom(Font.medium.rawValue, size: 11))
.foregroundColor(Color.grayd2)
}
.padding(.horizontal, 10.7)
Spacer()
Image(contentPlayerPlayManager.isPlaying ? "ic_noti_pause" : "btn_bar_play")
.resizable()
.frame(width: 25, height: 25)
.onTapGesture {
contentPlayerPlayManager.playOrPause()
}
Image("ic_noti_stop")
.resizable()
.frame(width: 25, height: 25)
.padding(.leading, 16)
.onTapGesture { contentPlayerPlayManager.resetPlayer() }
}
.padding(.vertical, 10.7)
.padding(.horizontal, 13.3)
.background(Color.gray22)
.contentShape(Rectangle())
.onTapGesture {
playlist = []
isShowPlayer = true
}
}
}
.popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .bottom, autohideIn: 2) {
HStack {
@@ -260,6 +320,10 @@ struct ContentPlaylistDetailView: View {
reloadData: $reloadData
)
}
if isShowPlayer {
ContentPlayerView(isShowing: $isShowPlayer, playlist: playlist)
}
}
}
}