diff --git a/chat-iOS/Views/Chats/ChatsViewBuilder.swift b/chat-iOS/Views/Chats/ChatsViewBuilder.swift index c00a20e..7efce0c 100644 --- a/chat-iOS/Views/Chats/ChatsViewBuilder.swift +++ b/chat-iOS/Views/Chats/ChatsViewBuilder.swift @@ -8,12 +8,12 @@ import UIKit struct ChatsViewBuilder { - static func create() -> UIViewController { + static func create(withRoomId roomId: String, withRoomName roomName: String) -> UIViewController { guard let chatsViewController = ChatsViewController.loadFromStoryboard() as? ChatsViewController else { fatalError("fatal: Failed to initialize the ChatsViewController") } let model = ChatsViewModel() - let presenter = ChatsViewPresenter(model: model) + let presenter = ChatsViewPresenter(model: model, withRoomId: roomId, withRoomName: roomName) chatsViewController.inject(with: presenter) return chatsViewController } diff --git a/chat-iOS/Views/Chats/ChatsViewController.swift b/chat-iOS/Views/Chats/ChatsViewController.swift index aca0a03..573760f 100644 --- a/chat-iOS/Views/Chats/ChatsViewController.swift +++ b/chat-iOS/Views/Chats/ChatsViewController.swift @@ -19,7 +19,7 @@ final class ChatsViewController: UIViewController, UICollectionViewDelegateFlowL @IBOutlet weak var sendButton: UIButton! var transScripts: [Transcript] = Array() - + let chatsCellID = "chatsCellID" override func viewDidLoad() { diff --git a/chat-iOS/Views/Chats/ChatsViewPresenter.swift b/chat-iOS/Views/Chats/ChatsViewPresenter.swift index d81630c..723d63f 100644 --- a/chat-iOS/Views/Chats/ChatsViewPresenter.swift +++ b/chat-iOS/Views/Chats/ChatsViewPresenter.swift @@ -20,9 +20,13 @@ protocol ChatsViewPresenterOutput: class { final class ChatsViewPresenter: ChatsViewPresenterProtocol, ChatsViewModelOutput { weak var view: ChatsViewPresenterOutput! private var model: ChatsViewModelProtocol + private var roomId: String + private var roomName: String - init(model: ChatsViewModelProtocol) { + init(model: ChatsViewModelProtocol, withRoomId roomId: String, withRoomName roomName: String) { self.model = model + self.roomId = roomId + self.roomName = roomName self.model.presenter = self } diff --git a/chat-iOS/Views/SelectChat/SelectChatViewController.swift b/chat-iOS/Views/SelectChat/SelectChatViewController.swift index b2b0eb4..c2e24cb 100644 --- a/chat-iOS/Views/SelectChat/SelectChatViewController.swift +++ b/chat-iOS/Views/SelectChat/SelectChatViewController.swift @@ -80,9 +80,12 @@ extension SelectChatViewController: SelectChatViewPresenterOutput { } func transitionToChatsViewController(selectedRoom room: Room) { - //TODO:- 画面遷移時に加えて値の引き渡しをする - let chatsViewController = ChatsViewBuilder.create() + + guard let roomId = room.id else { return } + guard let roomName = room.name else { return } + let chatsViewController = ChatsViewBuilder.create(withRoomId: roomId, withRoomName: roomName) self.navigationController?.pushViewController(chatsViewController, animated: true) + } }