Skip to content

Commit

Permalink
fix(red-dot): fix getting the real state of the AC notification count
Browse files Browse the repository at this point in the history
Fixes #16021

The problem was that the view doesn't update in a sync way, so getting the count from the view might be wrong.

This fix makes it so we have to get the count from status-go twice, which is not ideal, but to fix it, we'd need a refactor of the AC view count mechanism
  • Loading branch information
jrainville committed Aug 12, 2024
1 parent a7e74f3 commit 33698ec
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 7 deletions.
3 changes: 0 additions & 3 deletions src/app/modules/main/activity_center/io_interface.nim
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ method viewDidLoad*(self: AccessInterface) {.base.} =
method hasMoreToShow*(self: AccessInterface): bool {.base.} =
raise newException(ValueError, "No implementation available")

method unreadActivityCenterNotificationsCountFromView*(self: AccessInterface): int {.base.} =
raise newException(ValueError, "No implementation available")

method unreadActivityCenterNotificationsCount*(self: AccessInterface): int {.base.} =
raise newException(ValueError, "No implementation available")

Expand Down
3 changes: 0 additions & 3 deletions src/app/modules/main/activity_center/module.nim
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,6 @@ method viewDidLoad*(self: Module) =
method hasMoreToShow*(self: Module): bool =
self.controller.hasMoreToShow()

method unreadActivityCenterNotificationsCountFromView*(self: Module): int =
self.view.unreadCount()

method unreadActivityCenterNotificationsCount*(self: Module): int =
self.controller.unreadActivityCenterNotificationsCount()

Expand Down
2 changes: 1 addition & 1 deletion src/app/modules/main/module.nim
Original file line number Diff line number Diff line change
Expand Up @@ -963,7 +963,7 @@ method onChatLeft*[T](self: Module[T], chatId: string) =

proc checkIfWeHaveNotifications[T](self: Module[T]) =
let sectionWithUnread = self.view.model().isThereASectionWithUnreadMessages()
let activtyCenterNotifications = self.activityCenterModule.unreadActivityCenterNotificationsCountFromView() > 0
let activtyCenterNotifications = self.activityCenterModule.unreadActivityCenterNotificationsCount() > 0
self.view.setNotificationAvailable(sectionWithUnread or activtyCenterNotifications)

method onActivityNotificationsUpdated[T](self: Module[T]) =
Expand Down

0 comments on commit 33698ec

Please sign in to comment.