fix(@activity_center): fix dup messages

fixes #4631
This commit is contained in:
Anthony Laibe 2022-02-01 11:20:52 +01:00 committed by Anthony Laibe
parent 19f5ce8de0
commit 2ca1b71364
1 changed files with 2 additions and 14 deletions

View File

@ -3,10 +3,8 @@ import ./controller_interface
import ./io_interface
import ../../../core/eventemitter
import ../../../core/signals/types
import ../../../../app_service/service/activity_center/service as activity_center_service
import ../../../../app_service/service/contacts/service as contacts_service
import ../../../../app_service/service/chat/service as chat_service
import ../../../../app_service/service/message/service as message_service
import ../../../../app_service/service/eth/utils as eth_utils
@ -38,14 +36,9 @@ method delete*[T](self: Controller[T]) =
discard
method init*[T](self: Controller[T]) =
self.events.on(SIGNAL_ACTIVITY_CENTER_NOTIFICATIONS_LOADED) do(e: Args):
self.events.on(activity_center_service.SIGNAL_ACTIVITY_CENTER_NOTIFICATIONS_LOADED) do(e: Args):
let args = ActivityCenterNotificationsArgs(e)
self.delegate.pushActivityCenterNotifications(args.activityCenterNotifications)
self.events.on(chat_service.SIGNAL_CHAT_UPDATE) do(e: Args):
var evArgs = ChatUpdateArgsNew(e)
if (evArgs.activityCenterNotifications.len > 0):
self.delegate.addActivityCenterNotification(evArgs.activityCenterNotifications)
self.delegate.addActivityCenterNotification(args.activityCenterNotifications)
self.events.on(activity_center_service.SIGNAL_MARK_NOTIFICATIONS_AS_ACCEPTED) do(e: Args):
var evArgs = MarkAsAcceptedNotificationProperties(e)
@ -68,11 +61,6 @@ method init*[T](self: Controller[T]) =
if (evArgs.notificationIds.len > 0):
self.delegate.markActivityCenterNotificationUnreadDone(evArgs.notificationIds)
self.events.on(SignalType.Message.event) do(e: Args):
var evArgs = MessageSignal(e)
if (evArgs.activityCenterNotifications.len > 0):
self.delegate.addActivityCenterNotification(evArgs.activityCenterNotifications)
method hasMoreToShow*[T](self: Controller[T]): bool =
return self.activityCenterService.hasMoreToShow()