From 51ba11b50e98cd8197a0a1a0593cb643d86efd55 Mon Sep 17 00:00:00 2001 From: ShuMatsuki Date: Wed, 22 Jul 2020 17:09:05 +0900 Subject: [PATCH] =?UTF-8?q?=E7=94=BB=E9=9D=A2=E9=81=B7=E7=A7=BB=E6=99=82?= =?UTF-8?q?=E3=81=AB=E3=83=91=E3=83=A9=E3=83=A1=E3=83=BC=E3=82=BF=E3=83=BC?= =?UTF-8?q?=E3=81=AE=E5=8F=97=E3=81=91=E6=B8=A1=E3=81=97=E3=82=92=E8=BF=BD?= =?UTF-8?q?=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- chat-iOS/Views/Chats/ChatsViewBuilder.swift | 4 ++-- chat-iOS/Views/Chats/ChatsViewController.swift | 2 +- chat-iOS/Views/Chats/ChatsViewPresenter.swift | 6 +++++- chat-iOS/Views/SelectChat/SelectChatViewController.swift | 7 +++++-- 4 files changed, 13 insertions(+), 6 deletions(-) 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) + } }