From d087adc60ec94205922eb68cd2f26f74fd5a97ac Mon Sep 17 00:00:00 2001 From: Guillaume Louvigny Date: Tue, 27 Nov 2018 14:44:00 +0100 Subject: [PATCH] feat: send mark as seen signal to core when displaying messages --- .../common/components/Screens/Chats/Detail.js | 34 +++++++++++-------- core/go.mod | 2 +- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/client/react-native/common/components/Screens/Chats/Detail.js b/client/react-native/common/components/Screens/Chats/Detail.js index ca12152775..6d69592864 100644 --- a/client/react-native/common/components/Screens/Chats/Detail.js +++ b/client/react-native/common/components/Screens/Chats/Detail.js @@ -17,14 +17,16 @@ class Message extends React.PureComponent { const conversation = this.props.navigation.getParam('conversation') const contactId = this.props.data.senderId const isMyself = - conversation.members.find(m => m.contactId === contactId).contact.status === - 42 + conversation.members.find(m => m.contactId === contactId).contact + .status === 42 if (isMyself || this.props.data.seenAt !== null) { return } - await this.props.screenProps.context.mutations.eventSeen({ eventId: this.props.data.id }) + await this.props.screenProps.context.mutations.eventSeen({ + eventId: this.props.data.id, + }) } async componentDidUpdate (prevProps) { @@ -39,8 +41,8 @@ class Message extends React.PureComponent { const conversation = this.props.navigation.getParam('conversation') const contactId = this.props.data.senderId const isMyself = - conversation.members.find(m => m.contactId === contactId).contact.status === - 42 + conversation.members.find(m => m.contactId === contactId).contact + .status === 42 const { data } = this.props @@ -78,13 +80,12 @@ class Message extends React.PureComponent { [isMyself ? 'left' : 'right']: 42, }} > - {new Date(data.createdAt).toTimeString()} - {' '} - {isMyself - ? - : null} - {' '} - {/* TODO: used for debugging, remove me */} + {new Date(data.createdAt).toTimeString()}{' '} + {isMyself ? ( + + ) : null}{' '} + {' '} + {/* TODO: used for debugging, remove me */} ) @@ -222,8 +223,13 @@ export default class Detail extends PureComponent { subscriptions={[subscriptions.conversationNewMessage]} fragment={fragments.EventList} alias='EventList' - renderItem={props => } + renderItem={props => ( + + )} inverted style={{ paddingTop: 48 }} /> diff --git a/core/go.mod b/core/go.mod index 9998ea7afe..bb98865326 100644 --- a/core/go.mod +++ b/core/go.mod @@ -135,7 +135,7 @@ require ( github.com/uber-go/atomic v1.3.2 // indirect github.com/uber/jaeger-client-go v2.15.0+incompatible github.com/uber/jaeger-lib v1.5.0 // indirect - github.com/vektah/gqlparser v0.0.0-20181002002754-f119686bf1d4 + github.com/vektah/gqlparser v0.0.0-20181002002754-f119686bf1d4 // indirect github.com/whyrusleeping/base32 v0.0.0-20170828182744-c30ac30633cc // indirect github.com/whyrusleeping/cbor v0.0.0-20171005072247-63513f603b11 // indirect github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1 // indirect