Disable notifications in daemon mode

This commit is contained in:
Mark Qvist 2024-03-27 18:41:04 +01:00
parent 6700b7f8b7
commit 72e11fd859
2 changed files with 18 additions and 16 deletions

View File

@ -4967,7 +4967,7 @@ if not args.daemon:
def run(): def run():
if args.daemon: if args.daemon:
RNS.log("Starting Sideband in daemon mode") RNS.log("Starting Sideband in daemon mode")
sideband = SidebandCore(None, is_client=False, verbose=(args.verbose or __debug_build__)) sideband = SidebandCore(None, is_client=False, verbose=(args.verbose or __debug_build__), is_daemon=True)
sideband.start() sideband.start()
while True: while True:
time.sleep(5) time.sleep(5)

View File

@ -106,9 +106,10 @@ class SidebandCore():
# stream logger # stream logger
self.log_announce(destination_hash, app_data, dest_type=SidebandCore.aspect_filter) self.log_announce(destination_hash, app_data, dest_type=SidebandCore.aspect_filter)
def __init__(self, owner_app, is_service=False, is_client=False, android_app_dir=None, verbose=False, owner_service=None, service_context=None): def __init__(self, owner_app, is_service=False, is_client=False, android_app_dir=None, verbose=False, owner_service=None, service_context=None, is_daemon=False):
self.is_service = is_service self.is_service = is_service
self.is_client = is_client self.is_client = is_client
self.is_daemon = is_daemon
self.db = None self.db = None
if not self.is_service and not self.is_client: if not self.is_service and not self.is_client:
@ -769,6 +770,7 @@ class SidebandCore():
RNS.log("Error while setting LXMF propagation node: "+str(e), RNS.LOG_ERROR) RNS.log("Error while setting LXMF propagation node: "+str(e), RNS.LOG_ERROR)
def notify(self, title, content, group=None, context_id=None): def notify(self, title, content, group=None, context_id=None):
if not self.is_daemon:
if self.config["notifications_on"]: if self.config["notifications_on"]:
if RNS.vendor.platformutils.get_platform() == "android": if RNS.vendor.platformutils.get_platform() == "android":
if self.getpersistent("permissions.notifications"): if self.getpersistent("permissions.notifications"):