Skip to content
Snippets Groups Projects
Commit bc77db32 authored by Josh Brooks's avatar Josh Brooks
Browse files

Merge branch 'project/HavenBeta' into 'XX-4710/DmNotifications'

# Conflicts:
#   go.mod
#   go.sum
parents ffc7151b 346be4d6
No related branches found
No related tags found
2 merge requests!134Fix triplicate NDF json in DM notifications,!109Project/haven beta
......@@ -11,7 +11,7 @@ require (
github.com/spf13/cobra v1.7.0
github.com/spf13/jwalterweatherman v1.1.0
github.com/stretchr/testify v1.8.2
gitlab.com/elixxir/client/v4 v4.6.4-0.20230626170549-46d4f5259a86
gitlab.com/elixxir/client/v4 v4.6.4-0.20230626174341-9991c0c1c379
gitlab.com/elixxir/crypto v0.0.7-0.20230614183801-387e0cb8e76f
gitlab.com/elixxir/primitives v0.0.3-0.20230613193928-8cf8bdd777ef
gitlab.com/elixxir/wasm-utils v0.0.0-20230615222914-185dd3a6fa08
......
......@@ -519,10 +519,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-20230322223210-fa84f6842de8 h1:uAFCyBkXprQoPkcDDfxXtaMyL5x+xSGrAWzR907xROQ=
gitlab.com/elixxir/bloomfilter v0.0.0-20230322223210-fa84f6842de8/go.mod h1:1X8gRIAPDisS3W6Vtr/ymiUmZMJUIwDV1o5DEOo/pzw=
gitlab.com/elixxir/client/v4 v4.6.4-0.20230623182229-d3c9062e6f57 h1:b/oQLnntnR6ZJlDGiBK2TlyN3omSxDYZvnAY4itrMyw=
gitlab.com/elixxir/client/v4 v4.6.4-0.20230623182229-d3c9062e6f57/go.mod h1:N/zw9nt1ELjMoYmxNUjIQDfAJLdwOqUCqCf9plpsOvY=
gitlab.com/elixxir/client/v4 v4.6.4-0.20230626170549-46d4f5259a86 h1:of599FYjvUmCq/HvaZ1YnY01Emrm+jaWzYnbRIgHph0=
gitlab.com/elixxir/client/v4 v4.6.4-0.20230626170549-46d4f5259a86/go.mod h1:wSeJ9pk+qqUrKHwhd4qZW1CnNlakK75n+1fOjJ7k1Ns=
gitlab.com/elixxir/client/v4 v4.6.4-0.20230626174341-9991c0c1c379 h1:dv3/sCyBv439ulpN394pgN8AYNb67nvC6aP90dGOqm8=
gitlab.com/elixxir/client/v4 v4.6.4-0.20230626174341-9991c0c1c379/go.mod h1:wSeJ9pk+qqUrKHwhd4qZW1CnNlakK75n+1fOjJ7k1Ns=
gitlab.com/elixxir/comms v0.0.4-0.20230613220741-7de1d2ca4a1c h1:0TpLn4AdarrqCwUMvnz4Md+9gLyk9wrQ73J3W9U5zJo=
gitlab.com/elixxir/comms v0.0.4-0.20230613220741-7de1d2ca4a1c/go.mod h1:z+qW0D9VpY5QKTd7wRlb5SK4kBNqLYsa4DXBcUXue9Q=
gitlab.com/elixxir/crypto v0.0.7-0.20230614183801-387e0cb8e76f h1:T0Jvhq5nCELiwkVr07Ti/Ew9ICdexviYeCkFV19kk9A=
......
......@@ -19,6 +19,8 @@ import (
"gitlab.com/elixxir/wasm-utils/utils"
)
// initializing prevents a synchronized Cmix object from being loaded while one
// is being initialized.
var initializing atomic.Bool
// Cmix wraps the [bindings.Cmix] object so its methods can be wrapped to be
......@@ -128,19 +130,23 @@ func NewCmix(_ js.Value, args []js.Value) any {
// - Resolves on success.
// - Rejected with an error if creating a new cMix client fails.
func NewSynchronizedCmix(_ js.Value, args []js.Value) any {
initializing.Store(true)
ndfJSON := args[0].String()
storageDir := args[1].String()
password := utils.CopyBytesToGo(args[2])
rs := newRemoteStore(args[3])
promiseFn := func(resolve, reject func(args ...any) js.Value) {
err := bindings.NewSynchronizedCmix(ndfJSON, storageDir,
password, rs)
// Block loading of synchronized Cmix during initialisation
initializing.Store(true)
err := bindings.NewSynchronizedCmix(ndfJSON, storageDir, password, rs)
// Unblock loading of synchronized Cmix during initialisation
initializing.Store(false)
if err != nil {
reject(exception.NewTrace(err))
} else {
initializing.Store(false)
resolve()
}
}
......@@ -238,8 +244,7 @@ func (c *Cmix) GetReceptionID(js.Value, []js.Value) any {
//
// Returns a promise:
// - Resolves with the RemoteKV object.
func (c *Cmix) GetRemoteKV(_ js.Value, args []js.Value) any {
func (c *Cmix) GetRemoteKV(js.Value, []js.Value) any {
promiseFn := func(resolve, reject func(args ...any) js.Value) {
kv := c.api.GetRemoteKV()
resolve(newRemoteKvJS(kv))
......
......@@ -60,12 +60,13 @@ func newDMClientJS(api *bindings.DMClient) map[string]any {
"GetShareURL": js.FuncOf(cm.GetShareURL),
// DM Sending Methods and Reports
"SendText": js.FuncOf(cm.SendText),
"SendReply": js.FuncOf(cm.SendReply),
"SendReaction": js.FuncOf(cm.SendReaction),
"SendInvite": js.FuncOf(cm.SendInvite),
"SendSilent": js.FuncOf(cm.SendSilent),
"Send": js.FuncOf(cm.Send),
"SendText": js.FuncOf(cm.SendText),
"SendReply": js.FuncOf(cm.SendReply),
"SendReaction": js.FuncOf(cm.SendReaction),
"SendSilent": js.FuncOf(cm.SendSilent),
"SendInvite": js.FuncOf(cm.SendInvite),
"DeleteMessage": js.FuncOf(cm.DeleteMessage),
"Send": js.FuncOf(cm.Send),
// Notifications
"GetNotificationLevel": js.FuncOf(cm.GetNotificationLevel),
......@@ -711,7 +712,7 @@ func (dmc *DMClient) SendInvite(_ js.Value, args []js.Value) any {
// - Rejected with an error if sending fails.
func (dmc *DMClient) DeleteMessage(_ js.Value, args []js.Value) any {
partnerPubKeyBytes := utils.CopyBytesToGo(args[0])
partnerToken := args[1].Int()
partnerToken := int32(args[1].Int())
targetMessageIdBytes := utils.CopyBytesToGo(args[2])
cmixParamsJSON := utils.CopyBytesToGo(args[4])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment