mirror of
https://github.com/status-im/status-lib.git
synced 2025-01-11 21:14:30 +00:00
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:
parent
3348389ab7
commit
ffe6d5e0f0
@ -74,6 +74,11 @@ type
|
|||||||
channelId*: string
|
channelId*: string
|
||||||
notificationTypes*: seq[ActivityCenterNotificationType]
|
notificationTypes*: seq[ActivityCenterNotificationType]
|
||||||
|
|
||||||
|
MarkAsUnreadNotificationProperties* = ref object of Args
|
||||||
|
communityId*: string
|
||||||
|
channelId*: string
|
||||||
|
notificationTypes*: seq[ActivityCenterNotificationType]
|
||||||
|
|
||||||
type ChatModel* = ref object
|
type ChatModel* = ref object
|
||||||
publicKey*: string
|
publicKey*: string
|
||||||
events*: EventEmitter
|
events*: EventEmitter
|
||||||
@ -615,6 +620,16 @@ markAsReadProps: MarkAsReadNotificationProperties): string =
|
|||||||
|
|
||||||
self.events.emit("markNotificationsAsRead", markAsReadProps)
|
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 =
|
proc acceptActivityCenterNotifications*(self: ChatModel, ids: seq[string]): string =
|
||||||
try:
|
try:
|
||||||
let response = status_chat.acceptActivityCenterNotifications(ids)
|
let response = status_chat.acceptActivityCenterNotifications(ids)
|
||||||
|
@ -558,6 +558,9 @@ proc markAllActivityCenterNotificationsRead*() =
|
|||||||
proc markActivityCenterNotificationsRead*(ids: seq[string]) =
|
proc markActivityCenterNotificationsRead*(ids: seq[string]) =
|
||||||
discard callPrivateRPC("markActivityCenterNotificationsRead".prefix, %*[ids])
|
discard callPrivateRPC("markActivityCenterNotificationsRead".prefix, %*[ids])
|
||||||
|
|
||||||
|
proc markActivityCenterNotificationsUnread*(ids: seq[string]) =
|
||||||
|
discard callPrivateRPC("markActivityCenterNotificationsUnread".prefix, %*[ids])
|
||||||
|
|
||||||
proc acceptActivityCenterNotifications*(ids: seq[string]): string =
|
proc acceptActivityCenterNotifications*(ids: seq[string]): string =
|
||||||
result = callPrivateRPC("acceptActivityCenterNotifications".prefix, %*[ids])
|
result = callPrivateRPC("acceptActivityCenterNotifications".prefix, %*[ids])
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user