Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] 채팅 관련 QA해결 #137

Merged
merged 2 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 10 additions & 13 deletions AirplaIN/AirplaIN/SceneDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
whiteboardRepository: whiteboardRepository,
profileRepository: profileRepository)
let profileUseCase = ProfileUseCase(repository: profileRepository)
let manageWhieboardObjectUseCase = ManageWhiteboardObjectUseCase(
let manageWhiteboardObjectUseCase = ManageWhiteboardObjectUseCase(
profileRepository: profileRepository,
whiteboardObjectRepository: whiteboardObjectRepository,
whiteboardRepository: whiteboardRepository,
Expand All @@ -54,30 +54,27 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
textFieldDefaultSize: CGSize(width: 200, height: 50))
let drawObjectUseCase = DrawObjectUseCase()
let gameObjectUseCase = GameObjectUseCase(repository: GameRepository(persistenceService: PersistenceService()))
let addPhotoUseCase = PhotoUseCase(photoRepository: photoRepository)
let photoUseCase = PhotoUseCase(photoRepository: photoRepository)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

하 이런 디테일 놓친거까지 챙겨주다니.. 그저 갓

let chatUseCase = ChatUseCase(chatRepository: chatRepository)

let whiteboardObjectViewFactory = WhiteboardObjectViewFactory()

let whiteboardListViewModel = WhiteboardListViewModel(whiteboardUseCase: whiteboardUseCase)
let whiteboardViewModel = WhiteboardViewModel(
whiteboardUseCase: whiteboardUseCase,
addPhotoUseCase: addPhotoUseCase,
drawObjectUseCase: drawObjectUseCase,
textObjectUseCase: textObjectUseCase,
chatUseCase: chatUseCase,
gameObjectUseCase: gameObjectUseCase,
managemanageWhiteboardToolUseCase: manageWhiteboardToolUseCase,
manageWhiteboardObjectUseCase: manageWhieboardObjectUseCase)
let profileViewModel = ProfileViewModel(profileUseCase: profileUseCase)

let whiteboardListViewController = WhiteboardListViewController(
viewModel: whiteboardListViewModel,
whiteboardViewModel: whiteboardViewModel,
whiteboardObjectViewFactory: whiteboardObjectViewFactory,
profileViewModel: profileViewModel,
profileRepository: profileRepository,
chatUseCase: chatUseCase)
whiteboardUseCase: whiteboardUseCase,
photoUseCase: photoUseCase,
drawObjectUseCase: drawObjectUseCase,
textObjectUseCase: textObjectUseCase,
chatUseCase: chatUseCase,
gameObjectUseCase: gameObjectUseCase,
manageWhiteboardToolUseCase: manageWhiteboardToolUseCase,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

음음... 좋습니다 👍👍👍

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ㅋㅋ리팩토링 하면서 주입관련해서 같이 고민 해봅시다!!

manageWhiteboardObjectUseCase: manageWhiteboardObjectUseCase)

let window = UIWindow(windowScene: windowScene)
let navigationController = UINavigationController(rootViewController: whiteboardListViewController)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ protocol ChatTextFieldViewDelegate: AnyObject, UITextFieldDelegate {

final class ChatTextFieldView: UIView {
private enum ChatTextFieldLayoutConstant {
static let sendButtonSize: CGFloat = 23
static let sendButtonTraillingInset: CGFloat = 16
static let sendButtonSize: CGFloat = 40
static let sendButtonTraillingInset: CGFloat = 8
static let sendButtonImageSize: CGFloat = 20
static let textFieldLeadingInset: CGFloat = 20
static let textFieldBorderWidth: CGFloat = 1
static let textFieldCornerRadius: CGFloat = 20
Expand All @@ -32,7 +33,11 @@ final class ChatTextFieldView: UIView {
private let sendButton: UIButton = {
let button = UIButton()
var buttonConfiguration = UIButton.Configuration.plain()
let imageConfiguration = UIImage
.SymbolConfiguration(
pointSize: ChatTextFieldLayoutConstant.sendButtonImageSize)
buttonConfiguration.image = UIImage(systemName: "arrow.up.circle.fill")
buttonConfiguration.preferredSymbolConfigurationForImage = imageConfiguration
button.configuration = buttonConfiguration
button.tintColor = .airplainBlue

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ public final class WhiteboardViewModel: ViewModel {

private(set) var output: Output
private let whiteboardUseCase: WhiteboardUseCaseInterface
private let photoUseCase: PhotoUseCase
private let photoUseCase: PhotoUseCaseInterface
private let drawObjectUseCase: DrawObjectUseCaseInterface
private let textObjectUseCase: TextObjectUseCaseInterface
private let chatUseCase: ChatUseCase
private let chatUseCase: ChatUseCaseInterface
private let gameObjectUseCase: GameObjectUseCaseInterface
private let manageWhiteboardToolUseCase: ManageWhiteboardToolUseCaseInterface
private let manageWhiteboardObjectUseCase: ManageWhiteboardObjectUseCaseInterface
Expand All @@ -55,21 +55,21 @@ public final class WhiteboardViewModel: ViewModel {

public init(
whiteboardUseCase: WhiteboardUseCaseInterface,
addPhotoUseCase: PhotoUseCase,
photoUseCase: PhotoUseCaseInterface,
drawObjectUseCase: DrawObjectUseCaseInterface,
textObjectUseCase: TextObjectUseCaseInterface,
chatUseCase: ChatUseCase,
chatUseCase: ChatUseCaseInterface,
gameObjectUseCase: GameObjectUseCaseInterface,
managemanageWhiteboardToolUseCase: ManageWhiteboardToolUseCaseInterface,
manageWhiteboardToolUseCase: ManageWhiteboardToolUseCaseInterface,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ㅋㅋㅋㅋㅋㅋ managemange 이번에는 확실히 죽인걸루 ~~

manageWhiteboardObjectUseCase: ManageWhiteboardObjectUseCaseInterface
) {
self.whiteboardUseCase = whiteboardUseCase
self.photoUseCase = addPhotoUseCase
self.photoUseCase = photoUseCase
self.drawObjectUseCase = drawObjectUseCase
self.textObjectUseCase = textObjectUseCase
self.chatUseCase = chatUseCase
self.gameObjectUseCase = gameObjectUseCase
self.manageWhiteboardToolUseCase = managemanageWhiteboardToolUseCase
self.manageWhiteboardToolUseCase = manageWhiteboardToolUseCase
self.manageWhiteboardObjectUseCase = manageWhiteboardObjectUseCase
selectedObjectSubject = CurrentValueSubject(nil)
imageSubject = PassthroughSubject<(id: UUID, imageData: Data), Never>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,26 +61,44 @@ public final class WhiteboardListViewController: UIViewController {
private let viewModel: WhiteboardListViewModel
private var cancellables = Set<AnyCancellable>()

private let whiteboardViewModel: WhiteboardViewModel
private let whiteboardObjectViewFactory: WhiteboardObjectViewFactoryable
private let profileViewModel: ProfileViewModel
private let profileRepository: ProfileRepositoryInterface
private let whiteboardUseCase: WhiteboardUseCaseInterface
private let photoUseCase: PhotoUseCaseInterface
private let drawObjectUseCase: DrawObjectUseCaseInterface
private let textObjectUseCase: TextObjectUseCaseInterface
private let chatUseCase: ChatUseCaseInterface
private let gameObjectUseCase: GameObjectUseCaseInterface
private let manageWhiteboardToolUseCase: ManageWhiteboardToolUseCaseInterface
private let manageWhiteboardObjectUseCase: ManageWhiteboardObjectUseCaseInterface

public init(
viewModel: WhiteboardListViewModel,
whiteboardViewModel: WhiteboardViewModel,
whiteboardObjectViewFactory: WhiteboardObjectViewFactoryable,
profileViewModel: ProfileViewModel,
profileRepository: ProfileRepositoryInterface,
chatUseCase: ChatUseCaseInterface
whiteboardUseCase: WhiteboardUseCaseInterface,
photoUseCase: PhotoUseCaseInterface,
drawObjectUseCase: DrawObjectUseCaseInterface,
textObjectUseCase: TextObjectUseCaseInterface,
chatUseCase: ChatUseCaseInterface,
gameObjectUseCase: GameObjectUseCaseInterface,
manageWhiteboardToolUseCase: ManageWhiteboardToolUseCaseInterface,
manageWhiteboardObjectUseCase: ManageWhiteboardObjectUseCaseInterface
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

민족 대이동을 하셨군요..
고생하셨습니다.. 😭

) {
self.viewModel = viewModel
self.whiteboardViewModel = whiteboardViewModel
self.whiteboardObjectViewFactory = whiteboardObjectViewFactory
self.profileViewModel = profileViewModel
self.profileRepository = profileRepository
self.whiteboardUseCase = whiteboardUseCase
self.photoUseCase = photoUseCase
self.drawObjectUseCase = drawObjectUseCase
self.textObjectUseCase = textObjectUseCase
self.chatUseCase = chatUseCase
self.gameObjectUseCase = gameObjectUseCase
self.manageWhiteboardToolUseCase = manageWhiteboardToolUseCase
self.manageWhiteboardObjectUseCase = manageWhiteboardObjectUseCase
super.init(nibName: nil, bundle: nil)
}

Expand Down Expand Up @@ -113,12 +131,27 @@ public final class WhiteboardListViewController: UIViewController {
self?.viewModel.action(input: .createWhiteboard)

guard
let whiteboardViewModel = self?.whiteboardViewModel,
let whiteboardObjectViewFactory = self?.whiteboardObjectViewFactory,
let profileRepository = self?.profileRepository,
let chatUseCase = self?.chatUseCase
let whiteboardUseCase = self?.whiteboardUseCase,
let photoUseCase = self?.photoUseCase,
let drawObjectUseCase = self?.drawObjectUseCase,
let textObjectUseCase = self?.textObjectUseCase,
let chatUseCase = self?.chatUseCase,
let gameObjectUseCase = self?.gameObjectUseCase,
let manageWhiteboardToolUseCase = self?.manageWhiteboardToolUseCase,
let manageWhiteboardObjectUseCase = self?.manageWhiteboardObjectUseCase
else { return }

let whiteboardViewModel = WhiteboardViewModel(
whiteboardUseCase: whiteboardUseCase,
photoUseCase: photoUseCase,
drawObjectUseCase: drawObjectUseCase,
textObjectUseCase: textObjectUseCase,
chatUseCase: chatUseCase,
gameObjectUseCase: gameObjectUseCase,
manageWhiteboardToolUseCase: manageWhiteboardToolUseCase,
manageWhiteboardObjectUseCase: manageWhiteboardObjectUseCase)
let whiteboardViewController = WhiteboardViewController(
viewModel: whiteboardViewModel,
objectViewFactory: whiteboardObjectViewFactory,
Expand Down Expand Up @@ -280,6 +313,15 @@ extension WhiteboardListViewController: UICollectionViewDelegate {
public func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
guard let selectedWhiteboard = dataSource?.itemIdentifier(for: indexPath) else { return }
viewModel.action(input: .joinWhiteboard(whiteboard: selectedWhiteboard))
let whiteboardViewModel = WhiteboardViewModel(
whiteboardUseCase: whiteboardUseCase,
photoUseCase: photoUseCase,
drawObjectUseCase: drawObjectUseCase,
textObjectUseCase: textObjectUseCase,
chatUseCase: chatUseCase,
gameObjectUseCase: gameObjectUseCase,
manageWhiteboardToolUseCase: manageWhiteboardToolUseCase,
manageWhiteboardObjectUseCase: manageWhiteboardObjectUseCase)
let whiteboardViewController = WhiteboardViewController(
viewModel: whiteboardViewModel,
objectViewFactory: whiteboardObjectViewFactory,
Expand Down