feat(chat-room): 유료 메시지 구매 기능 추가
This commit is contained in:
		@@ -122,7 +122,10 @@ struct ChatRoomView: View {
 | 
			
		||||
                                        AiMessageItemView(
 | 
			
		||||
                                            message: message,
 | 
			
		||||
                                            characterName: viewModel.characterName
 | 
			
		||||
                                        )
 | 
			
		||||
                                        ) {
 | 
			
		||||
                                            viewModel.selectedMessage = message
 | 
			
		||||
                                            viewModel.selectedMessageIndex = index
 | 
			
		||||
                                        }
 | 
			
		||||
                                        .id(index)
 | 
			
		||||
                                    }
 | 
			
		||||
                                }
 | 
			
		||||
@@ -210,6 +213,21 @@ struct ChatRoomView: View {
 | 
			
		||||
                    .frame(width: screenSize().width)
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            
 | 
			
		||||
            if let message = viewModel.selectedMessage, viewModel.selectedMessageIndex >= 0 {
 | 
			
		||||
                SodaDialog(
 | 
			
		||||
                    title: "잠금된 메시지",
 | 
			
		||||
                    desc: "이 메시지를 \(message.price ?? 5)캔으로 잠금해제 하시겠습니까?",
 | 
			
		||||
                    confirmButtonTitle: "잠금해제",
 | 
			
		||||
                    confirmButtonAction: {
 | 
			
		||||
                        viewModel.purchaseChatMessage()
 | 
			
		||||
                    },
 | 
			
		||||
                    cancelButtonTitle: "취소"
 | 
			
		||||
                ) {
 | 
			
		||||
                    viewModel.selectedMessage = nil
 | 
			
		||||
                    viewModel.selectedMessageIndex = -1
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        .onAppear {
 | 
			
		||||
            viewModel.enterRoom(roomId: roomId)
 | 
			
		||||
@@ -217,6 +235,23 @@ struct ChatRoomView: View {
 | 
			
		||||
        .onDisappear {
 | 
			
		||||
            viewModel.stopTimer()
 | 
			
		||||
        }
 | 
			
		||||
        .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .top, autohideIn: 2) {
 | 
			
		||||
            GeometryReader { geo in
 | 
			
		||||
                HStack {
 | 
			
		||||
                    Spacer()
 | 
			
		||||
                    Text(viewModel.errorMessage)
 | 
			
		||||
                        .padding(.vertical, 13.3)
 | 
			
		||||
                        .frame(width: geo.size.width - 66.7, alignment: .center)
 | 
			
		||||
                        .font(.custom(Font.medium.rawValue, size: 12))
 | 
			
		||||
                        .background(Color.button)
 | 
			
		||||
                        .foregroundColor(Color.white)
 | 
			
		||||
                        .multilineTextAlignment(.center)
 | 
			
		||||
                        .cornerRadius(20)
 | 
			
		||||
                        .padding(.top, 66.7)
 | 
			
		||||
                    Spacer()
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user