From f29628d521964165b055f423a49f04a0a0f6feb0 Mon Sep 17 00:00:00 2001 From: Yu Sung Date: Sat, 22 Feb 2025 12:20:26 +0900 Subject: [PATCH] =?UTF-8?q?=EC=BD=98=ED=85=90=EC=B8=A0=20=EB=A9=94?= =?UTF-8?q?=EC=9D=B8=20-=20=EC=BD=98=ED=85=90=EC=B8=A0=20=EB=AF=B8?= =?UTF-8?q?=EB=8B=88=20=ED=94=8C=EB=A0=88=EC=9D=B4=EC=96=B4=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Content/Main/V2/ContentMainViewV2.swift | 119 ++++++++++++++++++ 1 file changed, 119 insertions(+) diff --git a/SodaLive/Sources/Content/Main/V2/ContentMainViewV2.swift b/SodaLive/Sources/Content/Main/V2/ContentMainViewV2.swift index 499341e..8d5c7bd 100644 --- a/SodaLive/Sources/Content/Main/V2/ContentMainViewV2.swift +++ b/SodaLive/Sources/Content/Main/V2/ContentMainViewV2.swift @@ -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)