fix(notifications): [re-add] fix notification setup called too soon

Fixes #4702
This commit is contained in:
Jonathan Rainville 2022-02-02 13:56:47 -05:00
parent 4341d12efc
commit 20a2d48eea
2 changed files with 11 additions and 4 deletions

View File

@ -339,6 +339,8 @@ proc userLoggedIn*(self: AppController) =
if(importedAccount.isValid()): if(importedAccount.isValid()):
self.privacyService.removeMnemonic() self.privacyService.removeMnemonic()
self.osNotificationService.userLoggedIn()
proc buildAndRegisterLocalAccountSensitiveSettings(self: AppController) = proc buildAndRegisterLocalAccountSensitiveSettings(self: AppController) =
var pubKey = self.settingsService.getPublicKey() var pubKey = self.settingsService.getPublicKey()
singletonInstance.localAccountSensitiveSettings.setFileName(pubKey) singletonInstance.localAccountSensitiveSettings.setFileName(pubKey)

View File

@ -17,15 +17,15 @@ QtObject:
type Service* = ref object of QObject type Service* = ref object of QObject
events: EventEmitter events: EventEmitter
notification: StatusOSNotification notification: StatusOSNotification
notificationSetUp: bool
proc setup(self: Service, events: EventEmitter) = proc setup(self: Service, events: EventEmitter) =
self.QObject.setup self.QObject.setup
self.events = events self.events = events
self.notification = newStatusOSNotification()
signalConnect(self.notification, "notificationClicked(QString)", self, "onNotificationClicked(QString)", 2)
proc delete*(self: Service) = proc delete*(self: Service) =
self.notification.delete if self.notificationSetUp:
self.notification.delete
self.QObject.delete self.QObject.delete
proc newService*(events: EventEmitter): Service = proc newService*(events: EventEmitter): Service =
@ -51,4 +51,9 @@ QtObject:
## This slot is called once user clicks a notificaiton bubble, "identifier" ## This slot is called once user clicks a notificaiton bubble, "identifier"
## contains data which uniquely define that notification. ## contains data which uniquely define that notification.
let details = toOsNotificationDetails(parseJson(identifier)) let details = toOsNotificationDetails(parseJson(identifier))
self.events.emit(SIGNAL_OS_NOTIFICATION_CLICKED, OsNotificationsArgs(details: details)) self.events.emit(SIGNAL_OS_NOTIFICATION_CLICKED, OsNotificationsArgs(details: details))
proc userLoggedIn*(self: Service) =
self.notification = newStatusOSNotification()
signalConnect(self.notification, "notificationClicked(QString)", self, "onNotificationClicked(QString)", 2)
self.notificationSetUp = true