Skip to content

Commit

Permalink
fix: ensure notification settings are cached from RPC
Browse files Browse the repository at this point in the history
There are a bunch of notification related settings that cause RPC
calls when read from the UI in QML/Qt.

This is bad because whenever the view tries to read a notification
setting it causes an RPC call and then rerenders the view. This happens
pretty much every time a new signal arrives in the client.

To account for that we now fetch all notification settings once and mark
the service as initialized so it know when to simply return cached
values. The cache is updated when the notification settings change.

Fixes #10493
  • Loading branch information
0x-r4bbit committed May 4, 2023
1 parent b91a1c1 commit 202a789
Show file tree
Hide file tree
Showing 2 changed files with 108 additions and 3 deletions.
11 changes: 11 additions & 0 deletions src/app_service/service/settings/dto/settings.nim
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,17 @@ type
gifRecents*: JsonNode
gifFavorites*: JsonNode
testNetworksEnabled*: bool
notificationsAllowNotifications*: bool
notificationsOneToOneChats*: string
notificationsGroupChats*: string
notificationsPersonalMentions*: string
notificationsGlobalMentions*: string
notificationsAllMessages*: string
notificationsContactRequests*: string
notificationsIdentityVerificationRequests*: string
notificationsSoundsEnabled*: bool
notificationsVolume*: int
notificationsMessagePreview*: int

proc toPinnedMailserver*(jsonObj: JsonNode): PinnedMailserver =
# we maintain pinned mailserver per fleet
Expand Down
Loading

0 comments on commit 202a789

Please # to comment.