From fc9e1bf86fede090efc520821656594ba182da41 Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Mon, 3 Nov 2025 13:37:48 +0100 Subject: [PATCH] Added call confirm dialog --- sbapp/main.py | 22 ++++++++++++++++++++-- sbapp/sideband/core.py | 3 +++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/sbapp/main.py b/sbapp/main.py index dd8a6b6..7853fb8 100644 --- a/sbapp/main.py +++ b/sbapp/main.py @@ -1802,8 +1802,26 @@ class SidebandApp(MDApp): elif sender.conv_type == self.sideband.CONV_VOICE: identity_hash = sender.sb_uid - def cb(dt): self.dial_action(identity_hash) - Clock.schedule_once(cb, 0.15) + if not self.sideband.config["confirm_calls"]: + def cb(dt): self.dial_action(identity_hash) + Clock.schedule_once(cb, 0.15) + else: + call_dialog_text = f"[b]Initiate Voice Call?[/b]\n\nDestination Identity:\n{RNS.prettyhexrep(identity_hash)}?" + if hasattr(self, "confirm_call_dialog"): self.confirm_call_dialog.text = call_dialog_text + else: + yes_button = MDRectangleFlatButton(text="Call",font_size=dp(18), theme_text_color="Custom", line_color=self.color_accept, text_color=self.color_accept) + no_button = MDRectangleFlatButton(text="Cancel",font_size=dp(18)) + self.confirm_call_dialog = MDDialog(text=call_dialog_text, buttons=[ no_button, yes_button ]) + def dl_no(s): self.confirm_call_dialog.dismiss() + def dl_yes(s): + self.confirm_call_dialog.dismiss() + def cb(dt): self.dial_action(self.confirm_call_dialog.dest_identity_hash) + Clock.schedule_once(cb, 0.15) + + yes_button.bind(on_release=dl_yes) + no_button.bind(on_release=dl_no) + self.confirm_call_dialog.dest_identity_hash = identity_hash + self.confirm_call_dialog.open() def open_conversation(self, context_dest, direction="left"): self.rec_dialog_is_open = False diff --git a/sbapp/sideband/core.py b/sbapp/sideband/core.py index 0568853..b653492 100644 --- a/sbapp/sideband/core.py +++ b/sbapp/sideband/core.py @@ -475,6 +475,7 @@ class SidebandCore(): self.config["lxm_limit_1mb"] = True self.config["trusted_markup_only"] = False self.config["compose_in_markdown"] = False + self.config["confirm_calls"] = True # Connectivity self.config["connect_transport"] = False @@ -652,6 +653,8 @@ class SidebandCore(): self.config["trusted_markup_only"] = False if not "compose_in_markdown" in self.config: self.config["compose_in_markdown"] = False + if not "confirm_calls" in self.config: + self.config["confirm_calls"] = True if not "input_language" in self.config: self.config["input_language"] = None