From b60cde6e4f808f460d24c1d1de1f1b538851f695 Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Wed, 28 Sep 2022 13:12:14 +0200 Subject: [PATCH] Work on service class --- sbapp/patches/PythonService.java | 1 + sbapp/services/sidebandservice.py | 14 ++++++++++++++ sbapp/sideband/core.py | 3 +-- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/sbapp/patches/PythonService.java b/sbapp/patches/PythonService.java index 3544073..41b59b3 100644 --- a/sbapp/patches/PythonService.java +++ b/sbapp/patches/PythonService.java @@ -145,6 +145,7 @@ public class PythonService extends Service implements Runnable { builder.setContentText("Reticulum Running"); builder.setContentIntent(pIntent); + // TODO: Generalise this Bitmap icon_bitmap = BitmapFactory.decodeFile("/data/user/0/io.unsigned.sideband/files/app/assets/notification_icon.png"); Icon service_icon = Icon.createWithBitmap(icon_bitmap); // builder.setSmallIcon(context.getApplicationInfo().icon); diff --git a/sbapp/services/sidebandservice.py b/sbapp/services/sidebandservice.py index a048d21..b3625d3 100644 --- a/sbapp/services/sidebandservice.py +++ b/sbapp/services/sidebandservice.py @@ -6,6 +6,20 @@ from jnius import autoclass, cast Context = autoclass('android.content.Context') +class RnsService(): + def __init__(self): + pass + + def start(self): + pass + + def stop(self): + pass + + def restart(self): + self.stop() + self.start() + class sidebandservice(): def __init__(self): diff --git a/sbapp/sideband/core.py b/sbapp/sideband/core.py index 767d98e..c504696 100644 --- a/sbapp/sideband/core.py +++ b/sbapp/sideband/core.py @@ -707,7 +707,6 @@ class SidebandCore(): def __start_jobs_immediate(self): # TODO: Reset loglevel self.reticulum = RNS.Reticulum(configdir=self.rns_configdir, loglevel=7) - RNS.log("Reticulum started, activating LXMF...") if RNS.vendor.platformutils.get_platform() == "android": if not self.reticulum.is_connected_to_shared_instance: @@ -818,7 +817,7 @@ class SidebandCore(): RNS.log("Error while adding I2P Interface. The contained exception was: "+str(e)) self.interface_i2p = None - + RNS.log("Reticulum started, activating LXMF...") self.message_router = LXMF.LXMRouter(identity = self.identity, storagepath = self.lxmf_storage, autopeer = True) self.message_router.register_delivery_callback(self.lxmf_delivery)