From e4ed39393bd317ff4a90e4df1d3d55160db1a844 Mon Sep 17 00:00:00 2001 From: Jono Wenger <jono@elixxir.io> Date: Thu, 15 Jun 2023 16:29:26 -0700 Subject: [PATCH] Update go docs for channel notifications --- go.mod | 2 +- go.sum | 4 ++-- wasm/channels.go | 43 +++++++++++++++++++++++++++++++------------ 3 files changed, 34 insertions(+), 15 deletions(-) diff --git a/go.mod b/go.mod index 4fd0a061..de71dd1d 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,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.20230615225942-872022921313 + gitlab.com/elixxir/client/v4 v4.6.4-0.20230615232241-9ef7d0ccc8f7 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 diff --git a/go.sum b/go.sum index c0576f22..58ffbb2c 100644 --- a/go.sum +++ b/go.sum @@ -407,8 +407,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.20230615225942-872022921313 h1:Tmw5PY7Q5WeVSULGhAjU8U37weC+KspSxz0mGvw6Vz8= -gitlab.com/elixxir/client/v4 v4.6.4-0.20230615225942-872022921313/go.mod h1:N/zw9nt1ELjMoYmxNUjIQDfAJLdwOqUCqCf9plpsOvY= +gitlab.com/elixxir/client/v4 v4.6.4-0.20230615232241-9ef7d0ccc8f7 h1:L/JYHj3eMgS+3f3CGEJELyqzKmpSyh3CXC66/TSu/Gw= +gitlab.com/elixxir/client/v4 v4.6.4-0.20230615232241-9ef7d0ccc8f7/go.mod h1:N/zw9nt1ELjMoYmxNUjIQDfAJLdwOqUCqCf9plpsOvY= 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= diff --git a/wasm/channels.go b/wasm/channels.go index 09d3b1b9..29a13213 100644 --- a/wasm/channels.go +++ b/wasm/channels.go @@ -1022,16 +1022,22 @@ func ValidForever(js.Value, []js.Value) any { // to the user should be tracked while all actions should not be (boolean). // - args[5] - JSON of [xxdk.CMIXParams]. If left empty // [bindings.GetDefaultCMixParams] will be used internally (Uint8Array). -// - args[6] - JSON of a slice of public keys of users that should receive -// mobile notifications for the message. +// - args[6] - JSON of a map of slices of [ed25519.PublicKey] of users that +// should receive mobile notifications for the message. Each slice keys on a +// [channels.PingType] that describes the type of notification it is +// (Uint8Array). // -// Example slice of public keys: +// Example map of slices of public keys: // -// [ -// "FgJMvgSsY4rrKkS/jSe+vFOJOs5qSSyOUSW7UtF9/KU=", -// "fPqcHtrJ398PAC35QyWXEU9PHzz8Z4BKQTCxSvpSygw=", -// "JnjCgh7g/+hNiI9VPKW01aRSxGOFmNulNCymy3ImXAo=" -// ] +// { +// "usrMention": [ +// "CLdKxbe8D2WVOpx1mT63TZ5CP/nesmxHLT5DUUalpe0=", +// "S2c6NXjNqgR11SCOaiQUughWaLpWBKNufPt6cbTVHMA=" +// ], +// "usrReply": [ +// "aaMzSeA6Cu2Aix2MlOwzrAI+NnpKshzvZRT02PZPVec=" +// ] +// } // // Returns a promise: // - Resolves to the JSON of [bindings.ChannelSendReport] (Uint8Array). @@ -1043,11 +1049,11 @@ func (cm *ChannelsManager) SendGeneric(_ js.Value, args []js.Value) any { leaseTimeMS := int64(args[3].Int()) tracked := args[4].Bool() cmixParamsJSON := utils.CopyBytesToGo(args[5]) - pingsJSON := utils.CopyBytesToGo(args[6]) + pingsMapJSON := utils.CopyBytesToGo(args[6]) promiseFn := func(resolve, reject func(args ...any) js.Value) { sendReport, err := cm.api.SendGeneric(marshalledChanId, messageType, - msg, leaseTimeMS, tracked, cmixParamsJSON, pingsJSON) + msg, leaseTimeMS, tracked, cmixParamsJSON, pingsMapJSON) if err != nil { reject(exception.NewTrace(err)) } else { @@ -1777,8 +1783,21 @@ func (cm *ChannelsManager) SetMobileNotificationsLevel(_ js.Value, args []js.Val // Example return: // // [ -// {"channel":"emV6aW1hAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD","type":1}, -// {"channel":"emV6aW1hAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD","type":2} +// { +// "channel": "jOgZopfYj4zrE/AHtKmkf+QEWnfUKv9KfIy/+Bsg0PkD", +// "type": 1, +// "pingType": "usrMention" +// }, +// { +// "channel": "GKmfN/LKXQYM6++TC6DeZYqoxvSUPkh5UAHWODqh9zkD", +// "type": 2, +// "pingType": "usrReply" +// }, +// { +// "channel": "M+28xtj0coHrhDHfojGNcyb2c4maO7ZuheB6egS0Pc4D", +// "type": 1, +// "pingType": "" +// } // ] func GetChannelNotificationReportsForMe(_ js.Value, args []js.Value) any { notificationFilterJSON := utils.CopyBytesToGo(args[0]) -- GitLab