재생목록 플레이어 추가

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

@@ -18,12 +18,15 @@ struct HomeView: View {
@StateObject var liveViewModel = LiveViewModel()
@StateObject var appState = AppState.shared
@StateObject var contentPlayManager = ContentPlayManager.shared
@StateObject var contentPlayerPlayManager = ContentPlayerPlayManager.shared
private let liveView = LiveView()
private let explorer = ExplorerView()
private let messageView = MessageView()
private let contentView = ContentMainView()
@State private var isShowPlayer = false
var body: some View {
GeometryReader { proxy in
ZStack(alignment: .bottom) {
@@ -53,6 +56,56 @@ struct HomeView: View {
Spacer()
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 {
isShowPlayer = true
}
}
if contentPlayManager.isShowingMiniPlayer {
HStack(spacing: 0) {
KFImage(URL(string: contentPlayManager.coverImage))
@@ -70,12 +123,12 @@ struct HomeView: View {
VStack(alignment: .leading, spacing: 2.3) {
Text(contentPlayManager.title)
.font(.custom(Font.medium.rawValue, size: 13))
.foregroundColor(Color(hex: "eeeeee"))
.foregroundColor(Color.grayee)
.lineLimit(2)
Text(contentPlayManager.nickname)
.font(.custom(Font.medium.rawValue, size: 11))
.foregroundColor(Color(hex: "d2d2d2"))
.foregroundColor(Color.grayd2)
}
.padding(.horizontal, 10.7)
@@ -101,7 +154,7 @@ struct HomeView: View {
}
.padding(.vertical, 10.7)
.padding(.horizontal, 13.3)
.background(Color(hex: "222222"))
.background(Color.gray22)
.contentShape(Rectangle())
.onTapGesture {
appState
@@ -115,7 +168,7 @@ struct HomeView: View {
if proxy.safeAreaInsets.bottom > 0 {
Rectangle()
.foregroundColor(Color(hex: "111111"))
.foregroundColor(Color.gray11)
.frame(width: proxy.size.width, height: 15.3)
}
}
@@ -174,6 +227,10 @@ struct HomeView: View {
AppState.shared.eventPopup = nil
}
}
if isShowPlayer {
ContentPlayerView(isShowing: $isShowPlayer, playlist: [])
}
}
.edgesIgnoringSafeArea(.bottom)
.valueChanged(value: appState.pushRoomId) { value in