As a user in a deal I can chat, so I can communicate about the deal.
Opened this issue · 1 comments
Abstract:
Once users agree to engage in a deal, they can chat with each other. That way they can plan in detail how the deal will be executed.
How it could work:
In a deal's detail-view, a chat button appears.
By tapping the chat button, the view changes to a chat window where the Seeker and Provider can communicate about the deal.
The Providers's client creates a new string. Then it encrypts the string two times; once with the Seeker's public key, and once with the Provider's public key.
The encrypted string is a secret that can be shared with the participants of the chat.
These 2 secrets are added to the deal object. This means the Seeker and Provider have a string waiting, encrypted with their public key.
Every message is encrypted with this shared secret on each client.
When the deal is completed, the entire chatlog is stored on IPFS, and the resulting ipfs hash is stored in the deal object.
How the API could work:
When the selected Replier funds a request (see S01E03 Epic 2), that request becomes a deal, the selected Replier becomes the Provider.
The Provider, when funding the deal, creates a secret and encrypts it with the Seeker's public key.
This chatsecret is the encryption key for the entire chat conversation. If members are added, the chatsecret is encrypted with the new member's public key.
A chat is created on the API with key chat-dealHash
. The value is the chat conversation represented as a json object, stringified and encrypted.
The client subscribes to the chatroom.
The chat conversation is sent from the API to client.
Subscription ChatRoom
Parameters:
dealHash
Returns:
chatConversation
JSON stringified encrypted with secret
Event chatUpdate
Returns
chatConversation
What it looks like:
Userflow: https://invis.io/ABGM89SX3V5#/297532804_-Hashtag--contractadress---dealhash-_SEEKER
( > in Invision, hold shift to see clickable areas)
routes: /hashtag/[contractadress]/[dealhash] & /hashtag/[contractadress]/[dealhash]/chatview
When an item is a deal, the detail-view shows a chat-button directly above the green area (both seen as Provider and Seeker).
When the chat button is tapped, the view changes to chat-view.
The chat-view contains:
- (left-top) avatars of the involved Seeker and Provider in that order
- a blue X-mark (close-button - right top)
- scrollable chat area containing the chat-items. The chat-items of the current user are aligned left, the chat-items of the other party are aligned right. Each chat-item contains:
- Datetime of chat-item
- chat-msg
- avatar of msg-sender
- a horizontal divider line
- a new chat input area containing:
- avatar of current user
- input field for the chat-msg
- a white button with black V-mark (submit-button)
When the user inputs a chat-msg and submits, it appears (left-aligned) in the chat area, where all chat-msgs are visible. The input area is sticky, meaning it will always be visible.
When the blue X-mark (close-button) is tapped by the user, the chat-view changes back to the detail-view of the item.
Invisionlinks with login (for inspect mode!):
mobile: https://projects.invisionapp.com/d/main#/console/13838256/297532804/inspect
desktop: https://projects.invisionapp.com/d/main#/console/14147648/297532081/inspect
Documentation / references
With ♡ from Swarm City