From a638a8ed9f4e5a8692199deaba42c1bafba88030 Mon Sep 17 00:00:00 2001 From: Jake Taylor <jake@elixxir.io> Date: Wed, 7 Sep 2022 16:42:54 -0500 Subject: [PATCH] added missing implementations --- go.mod | 4 ++-- go.sum | 4 ++-- indexedDb/implementation.go | 42 ++++++++++++++++++++++++++++++++++--- indexedDb/model.go | 3 ++- 4 files changed, 45 insertions(+), 8 deletions(-) diff --git a/go.mod b/go.mod index cb208b43..8e720cec 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,8 @@ require ( github.com/hack-pad/go-indexeddb v0.2.0 github.com/pkg/errors v0.9.1 github.com/spf13/jwalterweatherman v1.1.0 - gitlab.com/elixxir/client v1.5.1-0.20220907184817-0409e48f068a + gitlab.com/elixxir/client v1.5.1-0.20220907213656-d2cb1308c363 + gitlab.com/elixxir/crypto v0.0.7-0.20220902165412-5c5e3e990e84 gitlab.com/xx_network/primitives v0.0.4-0.20220809193445-9fc0a5209548 ) @@ -38,7 +39,6 @@ require ( github.com/zeebo/blake3 v0.2.3 // indirect gitlab.com/elixxir/bloomfilter v0.0.0-20211222005329-7d931ceead6f // indirect gitlab.com/elixxir/comms v0.0.4-0.20220907184530-d8eec143a1e8 // indirect - gitlab.com/elixxir/crypto v0.0.7-0.20220902165412-5c5e3e990e84 // indirect gitlab.com/elixxir/ekv v0.2.1-0.20220901224437-ab4cbf94bf8b // indirect gitlab.com/elixxir/primitives v0.0.3-0.20220901220638-1acc75fabdc6 // indirect gitlab.com/xx_network/comms v0.0.4-0.20220902164216-e3272eb0efac // indirect diff --git a/go.sum b/go.sum index 02d16899..e471cb08 100644 --- a/go.sum +++ b/go.sum @@ -613,8 +613,8 @@ github.com/zeebo/pcg v1.0.1 h1:lyqfGeWiv4ahac6ttHs+I5hwtH/+1mrhlCtVNQM2kHo= github.com/zeebo/pcg v1.0.1/go.mod h1:09F0S9iiKrwn9rlI5yjLkmrug154/YRW6KnnXVDM/l4= gitlab.com/elixxir/bloomfilter v0.0.0-20211222005329-7d931ceead6f h1:yXGvNBqzZwAhDYlSnxPRbgor6JWoOt1Z7s3z1O9JR40= gitlab.com/elixxir/bloomfilter v0.0.0-20211222005329-7d931ceead6f/go.mod h1:H6jztdm0k+wEV2QGK/KYA+MY9nj9Zzatux/qIvDDv3k= -gitlab.com/elixxir/client v1.5.1-0.20220907184817-0409e48f068a h1:l7cNBeWqxN4x6sNKZmG7nPYaSqTcalRPFF1n+V/UGlE= -gitlab.com/elixxir/client v1.5.1-0.20220907184817-0409e48f068a/go.mod h1:HvISFfNXL/XCJ6ynSrEwG9kPEp14i87G5y4wyL1H8R0= +gitlab.com/elixxir/client v1.5.1-0.20220907213656-d2cb1308c363 h1:pj80sFUq/0Kg/7sLo1/lldf94Ygbul1i7sBEqsqbYyA= +gitlab.com/elixxir/client v1.5.1-0.20220907213656-d2cb1308c363/go.mod h1:HvISFfNXL/XCJ6ynSrEwG9kPEp14i87G5y4wyL1H8R0= gitlab.com/elixxir/comms v0.0.4-0.20220907184530-d8eec143a1e8 h1:xbJBQdMdB+mMsKIVXqx7eAWzZmulA3KdRhlbyAk0NIc= gitlab.com/elixxir/comms v0.0.4-0.20220907184530-d8eec143a1e8/go.mod h1:xE9NKMAxzvTXmyJ5BMjBZFWMPfvQpw3rB7be2VYvU8E= gitlab.com/elixxir/crypto v0.0.0-20200804182833-984246dea2c4/go.mod h1:ucm9SFKJo+K0N2GwRRpaNr+tKXMIOVWzmyUD0SbOu2c= diff --git a/indexedDb/implementation.go b/indexedDb/implementation.go index 512692f7..67b253d5 100644 --- a/indexedDb/implementation.go +++ b/indexedDb/implementation.go @@ -4,10 +4,14 @@ // All rights reserved. / //////////////////////////////////////////////////////////////////////////////// +//go:build js && wasm +// +build js,wasm + package indexedDb import ( "github.com/hack-pad/go-indexeddb/idb" + "gitlab.com/elixxir/client/channels" "time" "gitlab.com/elixxir/client/cmix/rounds" @@ -46,9 +50,9 @@ func (w *wasmModel) ReceiveMessage(channelID *id.ID, messageID cryptoChannel.Mes // Messages may arrive our of order, so a reply in theory can arrive before // the initial message, as a result it may be important to buffer replies. func (w *wasmModel) ReceiveReply(ChannelID *id.ID, messageID cryptoChannel.MessageID, - replyTo cryptoChannel.MessageID, SenderUsername string, - text string, timestamp time.Time, lease time.Duration, - round rounds.Round) { + SenderUsername string, text string, timestamp time.Time, + lease time.Duration, round rounds.Round) { + } // ReceiveReaction is called whenever a reaction to a message is received @@ -61,3 +65,35 @@ func (w *wasmModel) ReceiveReaction(channelID *id.ID, messageID cryptoChannel.Me reaction string, timestamp time.Time, lease time.Duration, round rounds.Round) { } + +// MessageSent is called whenever the user sends a message. It should be +//designated as "sent" and that delivery is unknown. +func (w *wasmModel) MessageSent(channelID *id.ID, messageID cryptoChannel.MessageID, + myUsername string, text string, timestamp time.Time, + lease time.Duration, round rounds.Round) { + +} + +// ReplySent is called whenever the user sends a reply. It should be +// designated as "sent" and that delivery is unknown. +func (w *wasmModel) ReplySent(channelID *id.ID, messageID cryptoChannel.MessageID, + replyTo cryptoChannel.MessageID, myUsername string, text string, + timestamp time.Time, lease time.Duration, round rounds.Round) { + +} + +// ReactionSent is called whenever the user sends a reply. It should be +// designated as "sent" and that delivery is unknown. +func (w *wasmModel) ReactionSent(channelID *id.ID, messageID cryptoChannel.MessageID, + reactionTo cryptoChannel.MessageID, senderUsername string, + reaction string, timestamp time.Time, lease time.Duration, + round rounds.Round) { + +} + +// UpdateSentStatus is called whenever the sent status of a message +// has changed +func (w *wasmModel) UpdateSentStatus(messageID cryptoChannel.MessageID, + status channels.SentStatus) { + +} diff --git a/indexedDb/model.go b/indexedDb/model.go index fbed220f..d8c52107 100644 --- a/indexedDb/model.go +++ b/indexedDb/model.go @@ -45,12 +45,13 @@ type Message struct { ChannelId []byte `json:"channel_id"` // Index ParentMessageId []byte `json:"parent_message_id"` // Index Timestamp time.Time `json:"timestamp"` // Index + Status uint8 `json:"status"` Hidden bool `json:"hidden"` Pinned bool `json:"pinned"` // Index } // User defines the IndexedDb representation of a single User. -// A User sends many Message. +// A User has many Message. type User struct { Id []byte `json:"id"` // Matches pkeyName Username string `json:"username"` -- GitLab