fix(ActivityCenter): Simplify and fix AC notifications read/unread states (#12753)

* fix(ActivityCenter): Simplify and fix AC notifications read/unread states

* fix: review fixes
This commit is contained in:
Mikhail Rogachev 2023-11-20 12:53:34 +04:00 committed by GitHub
parent 200c0b337f
commit 7830310591
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 59 additions and 249 deletions

View File

@ -55,34 +55,25 @@ proc init*(self: Controller) =
self.delegate.addActivityCenterNotifications(args.activityCenterNotifications)
self.updateActivityGroupCounters()
self.events.on(activity_center_service.SIGNAL_MARK_NOTIFICATIONS_AS_ACCEPTED) do(e: Args):
var evArgs = MarkAsAcceptedNotificationProperties(e)
self.delegate.acceptActivityCenterNotificationsDone(evArgs.notificationIds)
self.events.on(activity_center_service.SIGNAL_MARK_NOTIFICATIONS_AS_DISMISSED) do(e: Args):
var evArgs = MarkAsDismissedNotificationProperties(e)
self.delegate.dismissActivityCenterNotificationsDone(evArgs.notificationIds)
self.events.on(activity_center_service.SIGNAL_MARK_NOTIFICATIONS_AS_READ) do(e: Args):
var evArgs = MarkAsReadNotificationProperties(e)
if (evArgs.isAll):
self.delegate.markAllActivityCenterNotificationsReadDone()
return
self.events.on(activity_center_service.SIGNAL_ACTIVITY_CENTER_MARK_NOTIFICATIONS_AS_READ) do(e: Args):
var evArgs = ActivityCenterNotificationIdsArgs(e)
if (evArgs.notificationIds.len > 0):
self.delegate.markActivityCenterNotificationReadDone(evArgs.notificationIds)
self.events.on(activity_center_service.SIGNAL_MARK_NOTIFICATIONS_AS_UNREAD) do(e: Args):
var evArgs = MarkAsUnreadNotificationProperties(e)
self.events.on(activity_center_service.SIGNAL_ACTIVITY_CENTER_MARK_NOTIFICATIONS_AS_UNREAD) do(e: Args):
var evArgs = ActivityCenterNotificationIdsArgs(e)
if (evArgs.notificationIds.len > 0):
self.delegate.markActivityCenterNotificationUnreadDone(evArgs.notificationIds)
self.events.on(activity_center_service.SIGNAL_ACTIVITY_CENTER_MARK_ALL_NOTIFICATIONS_AS_READ) do(e: Args):
self.delegate.markAllActivityCenterNotificationsReadDone()
self.events.on(activity_center_service.SIGNAL_ACTIVITY_CENTER_NOTIFICATIONS_COUNT_MAY_HAVE_CHANGED) do(e: Args):
self.delegate.unreadActivityCenterNotificationsCountChanged()
self.delegate.hasUnseenActivityCenterNotificationsChanged()
self.delegate.onNotificationsCountMayHaveChanged()
self.updateActivityGroupCounters()
self.events.on(activity_center_service.SIGNAL_ACTIVITY_CENTER_NOTIFICATIONS_REMOVED) do(e: Args):
var evArgs = RemoveActivityCenterNotificationsArgs(e)
var evArgs = ActivityCenterNotificationIdsArgs(e)
if (evArgs.notificationIds.len > 0):
self.delegate.removeActivityCenterNotifications(evArgs.notificationIds)
@ -107,32 +98,18 @@ proc getActivityCenterNotifications*(self: Controller): seq[ActivityCenterNotifi
proc asyncActivityNotificationLoad*(self: Controller) =
self.activityCenterService.asyncActivityNotificationLoad()
proc markAllActivityCenterNotificationsRead*(self: Controller): string =
return self.activityCenterService.markAllActivityCenterNotificationsRead()
proc markAllActivityCenterNotificationsRead*(self: Controller) =
self.activityCenterService.markAllActivityCenterNotificationsRead()
proc markActivityCenterNotificationRead*(
self: Controller,
notificationId: string,
markAsReadProps: MarkAsReadNotificationProperties
): string =
return self.activityCenterService.markActivityCenterNotificationRead(notificationId, markAsReadProps)
proc markActivityCenterNotificationRead*(self: Controller, notificationId: string) =
self.activityCenterService.markActivityCenterNotificationRead(notificationId)
proc markActivityCenterNotificationUnread*(
self: Controller,
notificationId: string,
markAsUnreadProps: MarkAsUnreadNotificationProperties
): string =
return self.activityCenterService.markActivityCenterNotificationUnread(notificationId, markAsUnreadProps)
proc markActivityCenterNotificationUnread*(self: Controller,notificationId: string) =
self.activityCenterService.markActivityCenterNotificationUnread(notificationId)
proc markAsSeenActivityCenterNotifications*(self: Controller) =
self.activityCenterService.markAsSeenActivityCenterNotifications()
proc acceptActivityCenterNotifications*(self: Controller, notificationIds: seq[string]): string =
return self.activityCenterService.acceptActivityCenterNotifications(notificationIds)
proc dismissActivityCenterNotifications*(self: Controller, notificationIds: seq[string]): string =
return self.activityCenterService.dismissActivityCenterNotifications(notificationIds)
proc replacePubKeysWithDisplayNames*(self: Controller, message: string): string =
return self.messageService.replacePubKeysWithDisplayNames(message)
@ -171,4 +148,3 @@ proc setActivityCenterReadType*(self: Controller, readType: ActivityCenterReadTy
proc getActivityCenterReadType*(self: Controller): ActivityCenterReadType =
return self.activityCenterService.getActivityCenterReadType()

View File

@ -27,7 +27,7 @@ method unreadActivityCenterNotificationsCount*(self: AccessInterface): int {.bas
method hasUnseenActivityCenterNotifications*(self: AccessInterface): bool {.base.} =
raise newException(ValueError, "No implementation available")
method unreadActivityCenterNotificationsCountChanged*(self: AccessInterface) {.base.} =
method onNotificationsCountMayHaveChanged*(self: AccessInterface) {.base.} =
raise newException(ValueError, "No implementation available")
method hasUnseenActivityCenterNotificationsChanged*(self: AccessInterface) {.base.} =
@ -45,9 +45,6 @@ method markAllActivityCenterNotificationsRead*(self: AccessInterface): string {.
method markAllActivityCenterNotificationsReadDone*(self: AccessInterface) {.base.} =
raise newException(ValueError, "No implementation available")
method dismissActivityCenterNotificationsDone*(self: AccessInterface, notificationIds: seq[string]) {.base.} =
raise newException(ValueError, "No implementation available")
method markActivityCenterNotificationReadDone*(self: AccessInterface, notificationIds: seq[string]) {.base.} =
raise newException(ValueError, "No implementation available")
@ -57,13 +54,10 @@ method markActivityCenterNotificationUnreadDone*(self: AccessInterface, notifica
method removeActivityCenterNotifications*(self: AccessInterface, notificationIds: seq[string]) {.base.} =
raise newException(ValueError, "No implementation available")
method acceptActivityCenterNotificationsDone*(self: AccessInterface, notificationIds: seq[string]) {.base.} =
method markActivityCenterNotificationRead*(self: AccessInterface, notificationId: string) {.base.} =
raise newException(ValueError, "No implementation available")
method markActivityCenterNotificationRead*(self: AccessInterface, notificationId: string, communityId: string, channelId: string, nType: int): string {.base.} =
raise newException(ValueError, "No implementation available")
method markActivityCenterNotificationUnread*(self: AccessInterface, notificationId: string, communityId: string, channelId: string, nType: int): string {.base.} =
method markActivityCenterNotificationUnread*(self: AccessInterface, notificationId: string) {.base.} =
raise newException(ValueError, "No implementation available")
method markAsSeenActivityCenterNotifications*(self: AccessInterface) {.base.} =
@ -75,12 +69,6 @@ method addActivityCenterNotifications*(self: AccessInterface, activityCenterNoti
method resetActivityCenterNotifications*(self: AccessInterface, activityCenterNotifications: seq[ActivityCenterNotificationDto]) {.base.} =
raise newException(ValueError, "No implementation available")
method acceptActivityCenterNotifications*(self: AccessInterface, notificationIds: seq[string]): string {.base.} =
raise newException(ValueError, "No implementation available")
method dismissActivityCenterNotifications*(self: AccessInterface, notificationIds: seq[string]): string {.base.} =
raise newException(ValueError, "No implementation available")
method switchTo*(self: AccessInterface, sectionId, chatId, messageId: string) {.base.} =
raise newException(ValueError, "No implementation available")

View File

@ -43,7 +43,7 @@ QtObject:
if (notification.chatId == chatId and not notification.read):
result.add(notification.id)
proc markAllAsRead*(self: Model) =
proc markAllAsRead*(self: Model) =
for activityCenterNotification in self.activityCenterNotifications:
activityCenterNotification.read = true

View File

@ -72,8 +72,9 @@ method unreadActivityCenterNotificationsCount*(self: Module): int =
method hasUnseenActivityCenterNotifications*(self: Module): bool =
self.controller.hasUnseenActivityCenterNotifications()
method unreadActivityCenterNotificationsCountChanged*(self: Module) =
method onNotificationsCountMayHaveChanged*(self: Module) =
self.view.unreadActivityCenterNotificationsCountChanged()
self.view.hasUnseenActivityCenterNotificationsChanged()
method hasUnseenActivityCenterNotificationsChanged*(self: Module) =
self.view.hasUnseenActivityCenterNotificationsChanged()
@ -196,72 +197,37 @@ method markAllActivityCenterNotificationsRead*(self: Module): string =
method markAllActivityCenterNotificationsReadDone*(self: Module) =
self.view.markAllActivityCenterNotificationsReadDone()
self.view.unreadActivityCenterNotificationsCountChanged()
method markActivityCenterNotificationRead*(
self: Module,
notificationId: string,
communityId: string,
channelId: string,
nType: int
): string =
let notificationType = ActivityCenterNotificationType(nType)
let markAsReadProps = MarkAsReadNotificationProperties(
notificationIds: @[notificationId],
communityId: communityId,
channelId: channelId,
notificationTypes: @[notificationType]
)
result = self.controller.markActivityCenterNotificationRead(notificationId, markAsReadProps)
method markActivityCenterNotificationRead*(self: Module, notificationId: string) =
self.controller.markActivityCenterNotificationRead(notificationId)
method markActivityCenterNotificationReadDone*(self: Module, notificationIds: seq[string]) =
for notificationId in notificationIds:
self.view.markActivityCenterNotificationReadDone(notificationId)
self.view.unreadActivityCenterNotificationsCountChanged()
method markAsSeenActivityCenterNotifications*(self: Module) =
self.controller.markAsSeenActivityCenterNotifications()
method addActivityCenterNotifications*(self: Module, activityCenterNotifications: seq[ActivityCenterNotificationDto]) =
self.view.addActivityCenterNotifications(self.convertToItems(activityCenterNotifications))
self.view.hasUnseenActivityCenterNotificationsChanged()
method resetActivityCenterNotifications*(self: Module, activityCenterNotifications: seq[ActivityCenterNotificationDto]) =
self.view.resetActivityCenterNotifications(self.convertToItems(activityCenterNotifications))
method markActivityCenterNotificationUnread*(
self: Module,
notificationId: string,
communityId: string,
channelId: string,
nType: int
): string =
let notificationType = ActivityCenterNotificationType(nType)
let markAsUnreadProps = MarkAsUnreadNotificationProperties(
notificationIds: @[notificationId],
communityId: communityId,
channelId: channelId,
notificationTypes: @[notificationType]
)
result = self.controller.markActivityCenterNotificationUnread(notificationId, markAsUnreadProps)
method markActivityCenterNotificationUnread*(self: Module, notificationId: string) =
self.controller.markActivityCenterNotificationUnread(notificationId)
method markActivityCenterNotificationUnreadDone*(self: Module, notificationIds: seq[string]) =
for notificationId in notificationIds:
self.view.markActivityCenterNotificationUnreadDone(notificationId)
self.view.unreadActivityCenterNotificationsCountChanged()
method removeActivityCenterNotifications*(self: Module, notificationIds: seq[string]) =
self.view.removeActivityCenterNotifications(notificationIds)
method acceptActivityCenterNotificationsDone*(self: Module, notificationIds: seq[string]) =
self.view.acceptActivityCenterNotificationsDone(notificationIds)
method acceptActivityCenterNotifications*(self: Module, notificationIds: seq[string]): string =
self.controller.acceptActivityCenterNotifications(notificationIds)
method dismissActivityCenterNotificationsDone*(self: Module, notificationIds: seq[string]) =
self.view.dismissActivityCenterNotificationsDone(notificationIds)
method dismissActivityCenterNotifications*(self: Module, notificationIds: seq[string]): string =
self.controller.dismissActivityCenterNotifications(notificationIds)
method switchTo*(self: Module, sectionId, chatId, messageId: string) =
self.controller.switchTo(sectionId, chatId, messageId)

View File

@ -71,70 +71,25 @@ QtObject:
proc markAllActivityCenterNotificationsReadDone*(self: View) {.slot.} =
self.model.markAllAsRead()
proc markActivityCenterNotificationRead(
self: View,
notificationId: string,
communityId: string,
channelId: string,
nType: int
): void {.slot.} =
discard self.delegate.markActivityCenterNotificationRead(notificationId, communityId, channelId, nType)
proc markActivityCenterNotificationRead(self: View, notificationId: string): void {.slot.} =
self.delegate.markActivityCenterNotificationRead(notificationId)
proc markActivityCenterNotificationReadDone*(self: View, notificationId: string) =
self.model.markActivityCenterNotificationRead(notificationId)
self.model.markActivityCenterNotificationRead(notificationId)
proc markActivityCenterNotificationUnreadDone*(self: View, notificationId: string) =
self.model.markActivityCenterNotificationUnread(notificationId)
self.model.markActivityCenterNotificationUnread(notificationId)
proc removeActivityCenterNotifications*(self: View, notificationIds: seq[string]) =
self.model.removeNotifications(notificationIds)
self.model.removeNotifications(notificationIds)
proc markAllChatMentionsAsRead*(self: View, communityId: string, chatId: string) =
let notifsIds = self.model.getUnreadNotificationsForChat(chatId)
for notifId in notifsIds:
# TODO change the 3 to the real type
self.markActivityCenterNotificationRead(notifId, communityId, chatId, ActivityCenterNotificationType.Mention.int)
proc markActivityCenterNotificationUnread(
self: View,
notificationId: string,
communityId: string,
channelId: string,
nType: int
): void {.slot.} =
discard self.delegate.markActivityCenterNotificationUnread(
notificationId,
communityId,
channelId,
nType
)
proc markActivityCenterNotificationUnread(self: View, notificationId: string): void {.slot.} =
self.delegate.markActivityCenterNotificationUnread(notificationId)
proc markAsSeenActivityCenterNotifications(self: View): void {.slot.} =
self.delegate.markAsSeenActivityCenterNotifications()
self.hasUnseenActivityCenterNotificationsChanged()
proc acceptActivityCenterNotifications(self: View, idsJson: string): string {.slot.} =
let ids = map(parseJson(idsJson).getElems(), proc(x:JsonNode):string = x.getStr())
result = self.delegate.acceptActivityCenterNotifications(ids)
proc acceptActivityCenterNotificationsDone*(self: View, notificationIds: seq[string]) =
self.model.removeNotifications(notificationIds)
proc acceptActivityCenterNotification(self: View, id: string): string {.slot.} =
self.acceptActivityCenterNotifications(fmt"[""{id}""]")
proc dismissActivityCenterNotifications(self: View, idsJson: string): string {.slot.} =
let ids = map(parseJson(idsJson).getElems(), proc(x:JsonNode):string = x.getStr())
result = self.delegate.dismissActivityCenterNotifications(ids)
proc dismissActivityCenterNotification(self: View, id: string): string {.slot.} =
self.dismissActivityCenterNotifications(fmt"[""{id}""]")
proc dismissActivityCenterNotificationsDone*(self: View, notificationIds: seq[string]) =
self.model.removeNotifications(notificationIds)
proc addActivityCenterNotifications*(self: View, activityCenterNotifications: seq[Item]) =
self.model.upsertActivityCenterNotifications(activityCenterNotifications)

View File

@ -1,4 +1,4 @@
import NimQml, json, sequtils, chronicles, strutils, strutils, stint
import NimQml, json, sequtils, chronicles, strutils, strutils, stint, sugar
import ../../../app/core/eventemitter
import ../../../app/core/[main]
@ -22,35 +22,15 @@ type
ActivityCenterNotificationsArgs* = ref object of Args
activityCenterNotifications*: seq[ActivityCenterNotificationDto]
MarkAsAcceptedNotificationProperties* = ref object of Args
ActivityCenterNotificationIdsArgs* = ref object of Args
notificationIds*: seq[string]
RemoveActivityCenterNotificationsArgs* = ref object of Args
notificationIds*: seq[string]
MarkAsDismissedNotificationProperties* = ref object of Args
notificationIds*: seq[string]
MarkAsReadNotificationProperties* = ref object of Args
isAll*: bool
notificationIds*: seq[string]
communityId*: string
channelId*: string
notificationTypes*: seq[ActivityCenterNotificationType]
MarkAsUnreadNotificationProperties* = ref object of Args
notificationIds*: seq[string]
communityId*: string
channelId*: string
notificationTypes*: seq[ActivityCenterNotificationType]
# Signals which may be emitted by this service:
const SIGNAL_ACTIVITY_CENTER_NOTIFICATIONS_LOADED* = "activityCenterNotificationsLoaded"
const SIGNAL_ACTIVITY_CENTER_NOTIFICATIONS_COUNT_MAY_HAVE_CHANGED* = "activityCenterNotificationsCountMayChanged"
const SIGNAL_MARK_NOTIFICATIONS_AS_READ* = "markNotificationsAsRead"
const SIGNAL_MARK_NOTIFICATIONS_AS_UNREAD* = "markNotificationsAsUnread"
const SIGNAL_MARK_NOTIFICATIONS_AS_ACCEPTED* = "markNotificationsAsAccepted"
const SIGNAL_MARK_NOTIFICATIONS_AS_DISMISSED* = "markNotificationsAsDismissed"
const SIGNAL_ACTIVITY_CENTER_MARK_NOTIFICATIONS_AS_READ* = "activityCenterMarkNotificationsAsRead"
const SIGNAL_ACTIVITY_CENTER_MARK_NOTIFICATIONS_AS_UNREAD* = "activityCenterMarkNotificationsAsUnread"
const SIGNAL_ACTIVITY_CENTER_MARK_ALL_NOTIFICATIONS_AS_READ* = "activityCenterMarkAllNotificationsAsRead"
const SIGNAL_ACTIVITY_CENTER_NOTIFICATIONS_REMOVED* = "activityCenterNotificationsRemoved"
const DEFAULT_LIMIT = 20
@ -106,15 +86,10 @@ QtObject:
SIGNAL_ACTIVITY_CENTER_NOTIFICATIONS_LOADED,
ActivityCenterNotificationsArgs(activityCenterNotifications: filteredNotifications)
)
if (removedNotifications.len > 0):
var notificationIds: seq[string]
for notification in removedNotifications:
notificationIds.add(notification.id)
self.events.emit(SIGNAL_ACTIVITY_CENTER_NOTIFICATIONS_REMOVED, RemoveActivityCenterNotificationsArgs(
notificationIds: notificationIds
))
if (removedNotifications.len > 0):
var notificationIds: seq[string] = removedNotifications.map(notification => notification.id)
self.events.emit(SIGNAL_ACTIVITY_CENTER_NOTIFICATIONS_REMOVED, ActivityCenterNotificationIdsArgs(notificationIds: notificationIds))
# NOTE: this signal must fire even we have no new notifications to show
self.events.emit(SIGNAL_ACTIVITY_CENTER_NOTIFICATIONS_COUNT_MAY_HAVE_CHANGED, Args())
@ -228,47 +203,28 @@ QtObject:
except Exception as e:
error "Error getting unseen activity center notifications", msg = e.msg
proc markActivityCenterNotificationRead*(
self: Service,
notificationId: string,
markAsReadProps: MarkAsReadNotificationProperties
): string =
proc markActivityCenterNotificationRead*(self: Service, notificationId: string) =
try:
discard backend.markActivityCenterNotificationsRead(@[notificationId])
self.events.emit(SIGNAL_MARK_NOTIFICATIONS_AS_READ, markAsReadProps)
self.events.emit(SIGNAL_ACTIVITY_CENTER_NOTIFICATIONS_COUNT_MAY_HAVE_CHANGED, Args())
let notificationIds = @[notificationId]
discard backend.markActivityCenterNotificationsRead(notificationIds)
self.events.emit(SIGNAL_ACTIVITY_CENTER_MARK_NOTIFICATIONS_AS_READ, ActivityCenterNotificationIdsArgs(notificationIds: notificationIds))
except Exception as e:
error "Error marking as read", msg = e.msg
result = e.msg
proc markActivityCenterNotificationUnread*(
self: Service,
notificationId: string,
markAsUnreadProps: MarkAsUnreadNotificationProperties
): string =
proc markActivityCenterNotificationUnread*(self: Service, notificationId: string) =
try:
discard backend.markActivityCenterNotificationsUnread(@[notificationId])
self.events.emit(SIGNAL_MARK_NOTIFICATIONS_AS_UNREAD, markAsUnreadProps)
self.events.emit(SIGNAL_ACTIVITY_CENTER_NOTIFICATIONS_COUNT_MAY_HAVE_CHANGED, Args())
let notificationIds = @[notificationId]
discard backend.markActivityCenterNotificationsUnread(notificationIds)
self.events.emit(SIGNAL_ACTIVITY_CENTER_MARK_NOTIFICATIONS_AS_UNREAD, ActivityCenterNotificationIdsArgs(notificationIds: notificationIds))
except Exception as e:
error "Error marking as unread", msg = e.msg
result = e.msg
proc markAllActivityCenterNotificationsRead*(self: Service, initialLoad: bool = true):string =
proc markAllActivityCenterNotificationsRead*(self: Service) =
try:
discard backend.markAllActivityCenterNotificationsRead()
# Accroding specs: Clicking the "Mark all as read" MUST mark mentions and replies items as read in the selected category
var types : seq[ActivityCenterNotificationType]
types.add(ActivityCenterNotificationType.Mention)
types.add(ActivityCenterNotificationType.Reply)
self.events.emit(SIGNAL_MARK_NOTIFICATIONS_AS_READ,
MarkAsReadNotificationProperties(notificationTypes: types, isAll: true))
self.events.emit(SIGNAL_ACTIVITY_CENTER_NOTIFICATIONS_COUNT_MAY_HAVE_CHANGED, Args())
self.events.emit(SIGNAL_ACTIVITY_CENTER_MARK_ALL_NOTIFICATIONS_AS_READ, Args())
except Exception as e:
error "Error marking all as read", msg = e.msg
result = e.msg
proc markAsSeenActivityCenterNotifications*(self: Service) =
try:
@ -287,32 +243,10 @@ QtObject:
self.events.emit(SIGNAL_ACTIVITY_CENTER_NOTIFICATIONS_LOADED,
ActivityCenterNotificationsArgs(activityCenterNotifications: activityCenterNotificationsTuple[1]))
proc acceptActivityCenterNotifications*(self: Service, notificationIds: seq[string]): string =
try:
discard backend.acceptActivityCenterNotifications(notificationIds)
self.events.emit(SIGNAL_MARK_NOTIFICATIONS_AS_ACCEPTED,
MarkAsDismissedNotificationProperties(notificationIds: notificationIds))
self.events.emit(SIGNAL_ACTIVITY_CENTER_NOTIFICATIONS_COUNT_MAY_HAVE_CHANGED, Args())
except Exception as e:
error "Error marking as accepted", msg = e.msg
result = e.msg
proc dismissActivityCenterNotifications*(self: Service, notificationIds: seq[string]): string =
try:
discard backend.dismissActivityCenterNotifications(notificationIds)
self.events.emit(SIGNAL_MARK_NOTIFICATIONS_AS_DISMISSED,
MarkAsDismissedNotificationProperties(notificationIds: notificationIds))
self.events.emit(SIGNAL_ACTIVITY_CENTER_NOTIFICATIONS_COUNT_MAY_HAVE_CHANGED, Args())
except Exception as e:
error "Error marking as dismissed", msg = e.msg
result = e.msg
proc deleteActivityCenterNotifications*(self: Service, notificationIds: seq[string]): string =
try:
discard backend.deleteActivityCenterNotifications(notificationIds)
self.events.emit(SIGNAL_ACTIVITY_CENTER_NOTIFICATIONS_REMOVED, RemoveActivityCenterNotificationsArgs(
notificationIds: notificationIds
))
self.events.emit(SIGNAL_ACTIVITY_CENTER_NOTIFICATIONS_REMOVED, ActivityCenterNotificationIdsArgs(notificationIds: notificationIds))
self.events.emit(SIGNAL_ACTIVITY_CENTER_NOTIFICATIONS_COUNT_MAY_HAVE_CHANGED, Args())
except Exception as e:
error "Error deleting notifications", msg = e.msg
@ -322,4 +256,4 @@ QtObject:
let acNotifications = self.getActivityCenterNotifications()
for acNotification in acNotifications:
if acNotification.notificationType == notificationType and acNotification.communityId == communityId:
return acNotification
return acNotification

View File

@ -321,12 +321,7 @@ QtObject:
self.acService.parseActivityCenterResponse(response)
let notificationToSetRead = self.acService.getNotificationForTypeAndCommunityId(notification.ActivityCenterNotificationType.OwnerTokenReceived, contractDetails.communityId)
if notificationToSetRead != nil:
let markAsReadProps = MarkAsReadNotificationProperties(
notificationIds: @[notificationToSetRead.id],
communityId: contractDetails.communityId,
notificationTypes: @[notification.ActivityCenterNotificationType.OwnerTokenReceived]
)
discard self.acService.markActivityCenterNotificationRead(notificationToSetRead.id, markAsReadProps)
self.acService.markActivityCenterNotificationRead(notificationToSetRead.id)
except Exception as e:
error "Error processing set signer transaction", msg=e.msg

View File

@ -79,15 +79,11 @@ QtObject {
}
function markActivityCenterNotificationRead(notification) {
root.activityCenterModuleInst.markActivityCenterNotificationRead(
notification.id, notification.message.communityId,
notification.message.chatId, notification.notificationType)
root.activityCenterModuleInst.markActivityCenterNotificationRead(notification.id)
}
function markActivityCenterNotificationUnread(notification) {
root.activityCenterModuleInst.markActivityCenterNotificationUnread(
notification.id, notification.message.communityId,
notification.message.chatId, notification.notificationType)
root.activityCenterModuleInst.markActivityCenterNotificationUnread(notification.id)
}
function markAsSeenActivityCenterNotifications() {