feat: 메인 홈 - 라이브 중
- 터치 액션 추가
This commit is contained in:
@@ -11,6 +11,7 @@ import Kingfisher
|
|||||||
struct HomeLiveItemView: View {
|
struct HomeLiveItemView: View {
|
||||||
|
|
||||||
let item: GetRoomListResponse
|
let item: GetRoomListResponse
|
||||||
|
let onClickItem: (Int) -> Void
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
HStack(spacing: 16) {
|
HStack(spacing: 16) {
|
||||||
@@ -65,6 +66,8 @@ struct HomeLiveItemView: View {
|
|||||||
lineWidth: 1
|
lineWidth: 1
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
.contentShape(Rectangle())
|
||||||
|
.onTapGesture { onClickItem(item.roomId) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,5 +91,5 @@ struct HomeLiveItemView: View {
|
|||||||
isReservation: false,
|
isReservation: false,
|
||||||
isPrivateRoom: false
|
isPrivateRoom: false
|
||||||
)
|
)
|
||||||
)
|
) { _ in }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ import SwiftUI
|
|||||||
|
|
||||||
struct HomeTabView: View {
|
struct HomeTabView: View {
|
||||||
@StateObject var viewModel = HomeTabViewModel()
|
@StateObject var viewModel = HomeTabViewModel()
|
||||||
|
@StateObject var liveViewModel = LiveViewModel()
|
||||||
|
|
||||||
@AppStorage("token") private var token: String = UserDefaults.string(forKey: UserDefaultsKey.token)
|
@AppStorage("token") private var token: String = UserDefaults.string(forKey: UserDefaultsKey.token)
|
||||||
@AppStorage("role") private var role: String = UserDefaults.string(forKey: UserDefaultsKey.role)
|
@AppStorage("role") private var role: String = UserDefaults.string(forKey: UserDefaultsKey.role)
|
||||||
|
|
||||||
@@ -50,8 +52,25 @@ struct HomeTabView: View {
|
|||||||
|
|
||||||
ScrollView(.horizontal, showsIndicators: false) {
|
ScrollView(.horizontal, showsIndicators: false) {
|
||||||
HStack(spacing: 16) {
|
HStack(spacing: 16) {
|
||||||
ForEach(0..<viewModel.liveList.count, id: \.self) {
|
ForEach(0..<viewModel.liveList.count, id: \.self) { index in
|
||||||
HomeLiveItemView(item: viewModel.liveList[$0])
|
HomeLiveItemView(item: viewModel.liveList[index]) { roomId in
|
||||||
|
if !token.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty {
|
||||||
|
AppState.shared.setAppStep(
|
||||||
|
step: .liveDetail(
|
||||||
|
roomId: roomId,
|
||||||
|
onClickParticipant: {
|
||||||
|
AppState.shared.isShowPlayer = false
|
||||||
|
liveViewModel.enterLiveRoom(roomId: roomId)
|
||||||
|
},
|
||||||
|
onClickReservation: {},
|
||||||
|
onClickStart: {},
|
||||||
|
onClickCancel: {}
|
||||||
|
)
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
AppState.shared.setAppStep(step: .login)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.padding(.horizontal, 24)
|
.padding(.horizontal, 24)
|
||||||
|
|||||||
Reference in New Issue
Block a user