Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
X
xxdk-wasm
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elixxir
xxdk-wasm
Merge requests
!109
Project/haven beta
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Project/haven beta
project/HavenBeta
into
release
Overview
0
Commits
201
Pipelines
0
Changes
4
Merged
Jake Taylor
requested to merge
project/HavenBeta
into
release
1 year ago
Overview
0
Commits
201
Pipelines
0
Changes
4
Expand
0
0
Merge request reports
Viewing commit
07c3bbc7
Show latest version
4 files
+
96
−
2
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
4
Search (e.g. *.vue) (Ctrl+P)
07c3bbc7
First Pass notifications
· 07c3bbc7
Richard T. Carback III
authored
1 year ago
wasm/channels.go
+
83
−
0
Options
@@ -17,6 +17,7 @@ import (
"syscall/js"
"gitlab.com/elixxir/client/v4/channels"
"gitlab.com/elixxir/primitives/notifications"
channelsDb
"gitlab.com/elixxir/xxdk-wasm/indexedDb/worker/channels"
"gitlab.com/elixxir/client/v4/bindings"
@@ -1454,6 +1455,88 @@ func (cm *ChannelsManager) GetMutedUsers(_ js.Value, args []js.Value) any {
return
utils
.
CopyBytesToJS
(
mutedUsers
)
}
////////////////////////////////////////////////////////////////////////////////
// Notifications //
////////////////////////////////////////////////////////////////////////////////
// GetNotificationLevel implements
// [bindings.ChannelsManager.GetNotificationLevel]
//
// Parameters:
// - args[0] - channelIDBytes - The marshalled bytes of the
// channel's [id.ID] (Uint8Array)
//
// Returns:
// - int - The [channels.NotificationLevel] for the channel.
// throws an error if there is an issue
func
(
cm
*
ChannelsManager
)
GetNotificationLevel
(
_
js
.
Value
,
args
[]
js
.
Value
)
any
{
channelIDBytes
:=
utils
.
CopyBytesToGo
(
args
[
0
])
level
,
err
:=
cm
.
api
.
GetNotificationLevel
(
channelIDBytes
)
if
err
!=
nil
{
utils
.
Throw
(
utils
.
TypeError
,
err
)
return
nil
}
return
level
}
// SetMobileNotificationsLevel implements
// [bindings.ChannelsManager.SetMobileNotificationsLevel]
//
// Parameters:
// - args[0] - channelIDBytes - The marshaled bytes of the channel's [id.ID]
// (Uint8Array).
// - args[1] - level - The [channels.NotificationLevel] to set for
// the channel.
// - args[2] - status - The [notifications.NotificationState] to set
// for the channel.
// - args[3] - push - True to enable push notifications and false to
// only have in-app notifications.
//
// Returns nothing or throws an error
func
(
cm
*
ChannelsManager
)
SetMobileNotificationsLevel
(
_
js
.
Value
,
args
[]
js
.
Value
)
any
{
channelIDBytes
:=
utils
.
CopyBytesToGo
(
args
[
0
])
level
:=
args
[
1
]
.
Int
()
status
:=
args
[
2
]
.
Int
()
push
:=
args
[
3
]
.
Bool
()
err
:=
cm
.
api
.
SetMobileNotificationsLevel
(
channelIDBytes
,
level
,
status
,
push
)
if
err
!=
nil
{
utils
.
Throw
(
utils
.
TypeError
,
err
)
}
return
nil
}
// GetNotificationReportsForMe implements
// [bindings.GetNotificationsReportsForMe]
//
// Parameters:
// - args[0] - notificationFilterJSON - JSON of a slice of
// [channels.NotificationFilter] (Uint8Array).
// - args[1] - notificationDataJSON - JSON of a slice of
// [notifications.Data] (Uint8Array).
//
// Returns:
// - []byte - JSON of a slice of [channels.NotificationReport].
// Throws an error if one occurs
func
GetNotificationReportsForMe
(
_
js
.
Value
,
args
[]
js
.
Value
)
any
{
notificationFilterJSON
:=
utils
.
CopyBytesToGo
(
args
[
0
])
notificationDataJSON
:=
utils
.
CopyBytesToGo
(
args
[
1
])
nrs
,
err
:=
bindings
.
GetNotificationReportsForMe
(
notificationFilterJSON
,
notificationDataJSON
)
if
err
!=
nil
{
utils
.
Throw
(
utils
.
TypeError
,
err
)
return
nil
}
return
utils
.
CopyBytesToJS
(
nrs
)
}
////////////////////////////////////////////////////////////////////////////////
// Admin Management //
////////////////////////////////////////////////////////////////////////////////
Loading