Skip to content

Commit

Permalink
[refactor] #245: 채팅방 ViewModel 일부 설계
Browse files Browse the repository at this point in the history
  • Loading branch information
dev-muuu committed May 24, 2023
1 parent c61c517 commit a4af417
Showing 1 changed file with 61 additions and 0 deletions.
61 changes: 61 additions & 0 deletions Zatch/Presentation/ViewModels/Chat/ChattingRoomViewModel.swift
Original file line number Diff line number Diff line change
@@ -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<Int> { get }
var blockUserResponse: PublishSubject<ResponseState> { get }
}

class ChattingRoomViewModel: ChattingRoomViewModelInterface{

var messages = [ChatMessage]()
var chattingmMembers = [String]()

let blockUserIndexSubject = PublishSubject<Int>()
let blockUserResponse = PublishSubject<ResponseState>()

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<String>
// let sendBtnTap: ControlEvent<Void>
// let exitBtnTap: ControlEvent<Void>
}

struct Output{
// let exitResponse: Observable<ResponseState>
}

func transform(_ input: Input) -> Output{
Output()
}

func viewDidLoad() {
//채팅방 멤버 조회

}
}

0 comments on commit a4af417

Please sign in to comment.