feat(chat): add bindings to `markActivityCenterNotificationsUnread` API (#53)

This is needed so clients can implement the functionality of marking notifications
as unread.
This commit is contained in:
r4bbit.eth 2021-11-16 12:37:56 +01:00 committed by GitHub
parent 3348389ab7
commit ffe6d5e0f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 0 deletions

View File

@ -74,6 +74,11 @@ type
channelId*: string
notificationTypes*: seq[ActivityCenterNotificationType]
MarkAsUnreadNotificationProperties* = ref object of Args
communityId*: string
channelId*: string
notificationTypes*: seq[ActivityCenterNotificationType]
type ChatModel* = ref object
publicKey*: string
events*: EventEmitter
@ -615,6 +620,16 @@ markAsReadProps: MarkAsReadNotificationProperties): string =
self.events.emit("markNotificationsAsRead", markAsReadProps)
proc markActivityCenterNotificationUnread*(self: ChatModel, notificationId: string,
markAsUnreadProps: MarkAsUnreadNotificationProperties): string =
try:
status_chat.markActivityCenterNotificationsUnread(@[notificationId])
except Exception as e:
error "Error marking as unread", msg = e.msg
result = e.msg
self.events.emit("markNotificationsAsUnread", markAsUnreadProps)
proc acceptActivityCenterNotifications*(self: ChatModel, ids: seq[string]): string =
try:
let response = status_chat.acceptActivityCenterNotifications(ids)

View File

@ -558,6 +558,9 @@ proc markAllActivityCenterNotificationsRead*() =
proc markActivityCenterNotificationsRead*(ids: seq[string]) =
discard callPrivateRPC("markActivityCenterNotificationsRead".prefix, %*[ids])
proc markActivityCenterNotificationsUnread*(ids: seq[string]) =
discard callPrivateRPC("markActivityCenterNotificationsUnread".prefix, %*[ids])
proc acceptActivityCenterNotifications*(ids: seq[string]): string =
result = callPrivateRPC("acceptActivityCenterNotifications".prefix, %*[ids])