parent
b4c4b534b4
commit
f29628d521
|
@ -6,6 +6,7 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
import Kingfisher
|
||||||
|
|
||||||
enum ContentMainTab {
|
enum ContentMainTab {
|
||||||
case HOME
|
case HOME
|
||||||
|
@ -24,7 +25,11 @@ struct TabItem {
|
||||||
|
|
||||||
struct ContentMainViewV2: View {
|
struct ContentMainViewV2: View {
|
||||||
|
|
||||||
|
@StateObject var contentPlayManager = ContentPlayManager.shared
|
||||||
|
@StateObject var contentPlayerPlayManager = ContentPlayerPlayManager.shared
|
||||||
|
|
||||||
@State private var selectedTab: ContentMainTab = .SERIES
|
@State private var selectedTab: ContentMainTab = .SERIES
|
||||||
|
@State private var isShowPlayer = false
|
||||||
|
|
||||||
let tabItemList = [
|
let tabItemList = [
|
||||||
TabItem(title: "홈", tab: .HOME),
|
TabItem(title: "홈", tab: .HOME),
|
||||||
|
@ -127,6 +132,120 @@ struct ContentMainViewV2: View {
|
||||||
ContentMainTabFreeView()
|
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)
|
.navigationBarHidden(true)
|
||||||
|
|
Loading…
Reference in New Issue