콘텐츠 메인

- 콘텐츠 미니 플레이어 추가
This commit is contained in:
Yu Sung 2025-02-22 12:20:26 +09:00
parent b4c4b534b4
commit f29628d521
1 changed files with 119 additions and 0 deletions

View File

@ -6,6 +6,7 @@
//
import SwiftUI
import Kingfisher
enum ContentMainTab {
case HOME
@ -24,7 +25,11 @@ struct TabItem {
struct ContentMainViewV2: View {
@StateObject var contentPlayManager = ContentPlayManager.shared
@StateObject var contentPlayerPlayManager = ContentPlayerPlayManager.shared
@State private var selectedTab: ContentMainTab = .SERIES
@State private var isShowPlayer = false
let tabItemList = [
TabItem(title: "", tab: .HOME),
@ -127,6 +132,120 @@ struct ContentMainViewV2: View {
ContentMainTabFreeView()
}
}
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))
.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(contentPlayManager.title)
.font(.custom(Font.medium.rawValue, size: 13))
.foregroundColor(Color.grayee)
.lineLimit(2)
Text(contentPlayManager.nickname)
.font(.custom(Font.medium.rawValue, size: 11))
.foregroundColor(Color.grayd2)
}
.padding(.horizontal, 10.7)
Spacer()
Image(contentPlayManager.isPlaying ? "ic_noti_pause" : "btn_bar_play")
.resizable()
.frame(width: 25, height: 25)
.onTapGesture {
if contentPlayManager.isPlaying {
contentPlayManager.pauseAudio()
} else {
contentPlayManager
.playAudio(contentId: contentPlayManager.contentId)
}
}
Image("ic_noti_stop")
.resizable()
.frame(width: 25, height: 25)
.padding(.leading, 16)
.onTapGesture { contentPlayManager.stopAudio() }
}
.padding(.vertical, 10.7)
.padding(.horizontal, 13.3)
.background(Color.gray22)
.contentShape(Rectangle())
.onTapGesture {
AppState.shared
.setAppStep(
step: .contentDetail(contentId: contentPlayManager.contentId)
)
}
}
}
if isShowPlayer {
ContentPlayerView(isShowing: $isShowPlayer, playlist: [])
}
}
.navigationBarHidden(true)