From a4af417cb4fad79bd6e6bdc7f8f7af001aa8642d Mon Sep 17 00:00:00 2001 From: SSOOYA Date: Wed, 24 May 2023 19:59:24 +0900 Subject: [PATCH] =?UTF-8?q?[refactor]=20#245:=20=EC=B1=84=ED=8C=85?= =?UTF-8?q?=EB=B0=A9=20ViewModel=20=EC=9D=BC=EB=B6=80=20=EC=84=A4=EA=B3=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Chat/ChattingRoomViewModel.swift | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 Zatch/Presentation/ViewModels/Chat/ChattingRoomViewModel.swift diff --git a/Zatch/Presentation/ViewModels/Chat/ChattingRoomViewModel.swift b/Zatch/Presentation/ViewModels/Chat/ChattingRoomViewModel.swift new file mode 100644 index 00000000..8c2469be --- /dev/null +++ b/Zatch/Presentation/ViewModels/Chat/ChattingRoomViewModel.swift @@ -0,0 +1,61 @@ +// +// ChattingRoomViewModel.swift +// Zatch +// +// Created by 박소윤 on 2023/05/23. +// + +import Foundation +import RxSwift +import RxCocoa + +protocol ChattingRoomViewModelInterface: BaseViewModel, BlockUserInterface{ + var messages: [ChatMessage] { get } + func viewDidLoad() +} + +protocol BlockUserInterface{ + var chattingmMembers: [String] { get } + var blockUserIndexSubject: PublishSubject { get } + var blockUserResponse: PublishSubject { get } +} + +class ChattingRoomViewModel: ChattingRoomViewModelInterface{ + + var messages = [ChatMessage]() + var chattingmMembers = [String]() + + let blockUserIndexSubject = PublishSubject() + let blockUserResponse = PublishSubject() + + private let blockUserUseCase: BlockUserUseCaseInterface + private let exitRoomUseCase: ExitChattingRoomUseCaseInterface + private let getChattingMemberListUseCase: GetMemberListOfChattingUseCaseInterface + + init(blockUserUseCase: BlockUserUseCaseInterface = BlockUserUseCase(), + exitRoomUseCase: ExitChattingRoomUseCaseInterface = ExitChattingRoomUseCase(), + getChattingMemberListUseCase: GetMemberListOfChattingUseCaseInterface = GetMemberListOfChattingUseCase()) { + self.blockUserUseCase = blockUserUseCase + self.exitRoomUseCase = exitRoomUseCase + self.getChattingMemberListUseCase = getChattingMemberListUseCase + } + + struct Input{ +// let messageObservable: Observable +// let sendBtnTap: ControlEvent +// let exitBtnTap: ControlEvent + } + + struct Output{ +// let exitResponse: Observable + } + + func transform(_ input: Input) -> Output{ + Output() + } + + func viewDidLoad() { + //채팅방 멤버 조회 + + } +}