mirror of
https://github.com/kavishdevar/librepods.git
synced 2026-02-11 12:12:26 +00:00
add custom callback when notification received
This commit is contained in:
@@ -19,8 +19,10 @@ class Connection:
|
|||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def initialize_notifications(self):
|
def initialize_notifications(self, callback: callable = None):
|
||||||
self.notifications = Notifications(self.socket, self.notification_callback)
|
if callback is None:
|
||||||
|
callback = self.notification_callback
|
||||||
|
self.notifications = Notifications(self.socket, callback)
|
||||||
self.notificationListener = self.notifications.notificationListener
|
self.notificationListener = self.notifications.notificationListener
|
||||||
self.BatteryNotification = self.notifications.BatteryNotification
|
self.BatteryNotification = self.notifications.BatteryNotification
|
||||||
self.notifications.initialize()
|
self.notifications.initialize()
|
||||||
|
|||||||
Reference in New Issue
Block a user