fix(live): 프로필 라이브 상세를 프로필 화면에서 표시한다
This commit is contained in:
@@ -27,6 +27,7 @@ struct UserProfileView: View {
|
||||
@State private var didTriggerAutoBackOnLoadFailure: Bool = false
|
||||
@State private var isViewVisible: Bool = false
|
||||
@State private var loadedUserId: Int? = nil
|
||||
@State private var profileLiveDetailSheet: LiveDetailSheetState? = nil
|
||||
|
||||
@State private var maxCommunityPostHeight: CGFloat? = nil
|
||||
|
||||
@@ -244,23 +245,16 @@ struct UserProfileView: View {
|
||||
userId: userId,
|
||||
liveRoomList: creatorProfile.liveRoomList,
|
||||
onClickParticipant: { liveRoom in
|
||||
if creatorProfile.creator.creatorId == UserDefaults.int(forKey: .userId) {
|
||||
viewModel.errorMessage = I18n.MemberChannel.liveOnNow
|
||||
viewModel.isShowPopup = true
|
||||
} else {
|
||||
AppState.shared.isShowPlayer = false
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.2) {
|
||||
viewModel.enterLiveRoom(roomId: liveRoom.roomId)
|
||||
}
|
||||
}
|
||||
showProfileLiveDetail(
|
||||
liveRoom: liveRoom,
|
||||
creatorId: creatorProfile.creator.creatorId
|
||||
)
|
||||
},
|
||||
onClickReservation: { liveRoom in
|
||||
if creatorProfile.creator.creatorId == UserDefaults.int(forKey: .userId) {
|
||||
viewModel.errorMessage = I18n.MemberChannel.cannotReserveOwnLive
|
||||
viewModel.isShowPopup = true
|
||||
} else {
|
||||
viewModel.reservationLiveRoom(roomId: liveRoom.roomId)
|
||||
}
|
||||
showProfileLiveDetail(
|
||||
liveRoom: liveRoom,
|
||||
creatorId: creatorProfile.creator.creatorId
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
@@ -436,6 +430,19 @@ struct UserProfileView: View {
|
||||
}
|
||||
|
||||
ZStack {
|
||||
if let liveDetailSheet = profileLiveDetailSheet {
|
||||
LiveDetailView(
|
||||
roomId: liveDetailSheet.roomId,
|
||||
onClickParticipant: liveDetailSheet.onClickParticipant,
|
||||
onClickReservation: liveDetailSheet.onClickReservation,
|
||||
onClickStart: liveDetailSheet.onClickStart,
|
||||
onClickCancel: liveDetailSheet.onClickCancel,
|
||||
onClickClose: {
|
||||
profileLiveDetailSheet = nil
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
if isShowChannelDonationDialog {
|
||||
LiveRoomDonationDialogView(
|
||||
isShowing: $isShowChannelDonationDialog,
|
||||
@@ -673,6 +680,33 @@ struct UserProfileView: View {
|
||||
AppState.shared.back()
|
||||
}
|
||||
}
|
||||
|
||||
private func showProfileLiveDetail(liveRoom: LiveRoomResponse, creatorId: Int) {
|
||||
profileLiveDetailSheet = LiveDetailSheetState(
|
||||
roomId: liveRoom.roomId,
|
||||
onClickParticipant: {
|
||||
if creatorId == UserDefaults.int(forKey: .userId) {
|
||||
viewModel.errorMessage = I18n.MemberChannel.liveOnNow
|
||||
viewModel.isShowPopup = true
|
||||
} else {
|
||||
AppState.shared.isShowPlayer = false
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.2) {
|
||||
viewModel.enterLiveRoom(roomId: liveRoom.roomId)
|
||||
}
|
||||
}
|
||||
},
|
||||
onClickReservation: {
|
||||
if creatorId == UserDefaults.int(forKey: .userId) {
|
||||
viewModel.errorMessage = I18n.MemberChannel.cannotReserveOwnLive
|
||||
viewModel.isShowPopup = true
|
||||
} else {
|
||||
viewModel.reservationLiveRoom(roomId: liveRoom.roomId)
|
||||
}
|
||||
},
|
||||
onClickStart: {},
|
||||
onClickCancel: {}
|
||||
)
|
||||
}
|
||||
|
||||
private func creatorCommunityWriteSuccess() {
|
||||
viewModel.getCreatorProfile(userId: userId)
|
||||
|
||||
Reference in New Issue
Block a user