fix(notifications): fix notification setup called too soon
This commit is contained in:
parent
22181ea0ee
commit
1a0fb268e3
|
@ -50,3 +50,4 @@ proc delete*(self: AppService) =
|
|||
|
||||
proc onLoggedIn*(self: AppService) =
|
||||
self.marathon.onLoggedIn()
|
||||
self.osNotificationService.onLoggedIn()
|
||||
|
|
|
@ -11,15 +11,14 @@ QtObject:
|
|||
type OsNotificationService* = ref object of QObject
|
||||
status: Status
|
||||
notification: StatusOSNotification
|
||||
notificationSetUp: bool
|
||||
|
||||
proc setup(self: OsNotificationService, status: Status) =
|
||||
self.QObject.setup
|
||||
self.status = status
|
||||
self.notification = newStatusOSNotification()
|
||||
signalConnect(self.notification, "notificationClicked(QString)", self,
|
||||
"onNotificationClicked(QString)", 2)
|
||||
|
||||
proc delete*(self: OsNotificationService) =
|
||||
if self.notificationSetUp:
|
||||
self.notification.delete
|
||||
self.QObject.delete
|
||||
|
||||
|
@ -46,3 +45,8 @@ QtObject:
|
|||
## This slot is called once user clicks a notificaiton bubble, "identifier"
|
||||
## contains data which uniquely define that notification.
|
||||
self.status.osnotifications.onNotificationClicked(identifier)
|
||||
|
||||
proc onLoggedIn*(self: OsNotificationService) =
|
||||
self.notification = newStatusOSNotification()
|
||||
self.notificationSetUp = true
|
||||
signalConnect(self.notification, "notificationClicked(QString)", self, "onNotificationClicked(QString)", 2)
|
Loading…
Reference in New Issue