-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[refactor] #245: 채팅방 ViewModel 일부 설계
- Loading branch information
Showing
1 changed file
with
61 additions
and
0 deletions.
There are no files selected for viewing
61 changes: 61 additions & 0 deletions
61
Zatch/Presentation/ViewModels/Chat/ChattingRoomViewModel.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() { | ||
//채팅방 멤버 조회 | ||
|
||
} | ||
} |