Added ChatStore which will handle all of the SDK integration so that UI is simple and only doing UI work.
Implemented connect which gets the client using token, gets the conversation, and loads recent messages. The team decided that for MVP we would simply enable the chat button on the room screen after the connect sequence is completely finished. Tapping the chat button will do nothing before connect finishes or if it fails.
Implemented disconnect which tears everything down safely.
The implementation strategy is to implement ChatStore before the final UI because the final UI will be kind of interesting. Meanwhile I will be implementing a placeholder UI with a few buttons and logging to test ChatStore.
Add placeholder chat button to home screen.
Output recent messages to log when chat screen is shown.
Testing
While it would be valuable to unit test ChatStore there are challenges and I think we should focus on UI tests for the chat feature. To mock the SDK types I would have to do a lot of retroactive modeling and I think that would make it more difficult for customers to understand the code. And it is very likely there would be other surprises and problems because that always seems to be the case with testing SDK usage. So I think quarantining the SDK integration inside ChatStore and using UI tests is a better strategy. I think I will be able to get good coverage with a moderate number of UI tests. There is a separate ticket for UI tests after UI is finished.
I manually tested connect, disconnect, reconnect. And verified that recent messages were output to log when chat screen was shown.
https://issues.corp.twilio.com/browse/VIDEO-3719
Changes
TwilioConversationsClient
to app.ChatStore
which will handle all of the SDK integration so that UI is simple and only doing UI work.ChatStore
before the final UI because the final UI will be kind of interesting. Meanwhile I will be implementing a placeholder UI with a few buttons and logging to testChatStore
.Testing
ChatStore
there are challenges and I think we should focus on UI tests for the chat feature. To mock the SDK types I would have to do a lot of retroactive modeling and I think that would make it more difficult for customers to understand the code. And it is very likely there would be other surprises and problems because that always seems to be the case with testing SDK usage. So I think quarantining the SDK integration insideChatStore
and using UI tests is a better strategy. I think I will be able to get good coverage with a moderate number of UI tests. There is a separate ticket for UI tests after UI is finished.