Added ability to clear call log

This commit is contained in:
Mark Qvist
2025-11-21 00:10:38 +01:00
parent 24bf675ca3
commit e4d649ca79
3 changed files with 68 additions and 37 deletions

View File

@@ -1997,33 +1997,34 @@ class SidebandCore():
connection.send(send_result)
elif "get_plugins_info" in call: connection.send(self._get_plugins_info())
elif "get_destination_establishment_rate" in call: connection.send(self._get_destination_establishment_rate(call["get_destination_establishment_rate"]))
elif "get_destination_mtu" in call: connection.send(self._get_destination_mtu(call["get_destination_mtu"]))
elif "get_destination_edr" in call: connection.send(self._get_destination_edr(call["get_destination_edr"]))
elif "get_destination_lmd" in call: connection.send(self._get_destination_lmd(call["get_destination_lmd"]))
elif "get_lxm_progress" in call: connection.send(self.get_lxm_progress(call["get_lxm_progress"]["lxm_hash"]))
elif "get_lxm_stamp_cost" in call: connection.send(self.get_lxm_stamp_cost(call["get_lxm_stamp_cost"]["lxm_hash"]))
elif "get_lxm_propagation_cost" in call: connection.send(self.get_lxm_propagation_cost(call["get_lxm_propagation_cost"]["lxm_hash"]))
elif "is_tracking" in call: connection.send(self.is_tracking(call["is_tracking"]))
elif "start_tracking" in call: connection.send(self.start_tracking(object_addr=call["start_tracking"]["object_addr"], interval=call["start_tracking"]["interval"], duration=call["start_tracking"]["duration"]))
elif "stop_tracking" in call: connection.send(self.stop_tracking(object_addr=call["stop_tracking"]["object_addr"]))
elif "get_service_log" in call: connection.send(self.get_service_log())
elif "start_voice" in call: connection.send(self.start_voice())
elif "stop_voice" in call: connection.send(self.stop_voice())
elif "telephone_is_available" in call: connection.send(self.telephone.is_available if self.telephone else False)
elif "telephone_is_in_call" in call: connection.send(self.telephone.is_in_call if self.telephone else False)
elif "telephone_call_is_connecting" in call: connection.send(self.telephone.call_is_connecting if self.telephone else False)
elif "telephone_is_ringing" in call: connection.send(self.telephone.is_ringing if self.telephone else False)
elif "telephone_caller_info" in call: connection.send(self.telephone.caller.hash if self.telephone and self.telephone.caller else None)
elif "telephone_set_busy" in call: connection.send(self.telephone.set_busy(call["telephone_set_busy"]) if self.telephone else False)
elif "telephone_dial" in call: connection.send(self.telephone.dial(call["telephone_dial"]) if self.telephone else False)
elif "telephone_hangup" in call: connection.send(self.telephone.hangup() if self.telephone else False)
elif "telephone_answer" in call: connection.send(self.telephone.answer() if self.telephone else False)
elif "telephone_set_speaker" in call: connection.send(self.telephone.set_speaker(call["telephone_set_speaker"]) if self.telephone else False)
elif "telephone_set_microphone" in call: connection.send(self.telephone.set_microphone(call["telephone_set_microphone"]) if self.telephone else False)
elif "telephone_set_ringer" in call: connection.send(self.telephone.set_ringer(call["telephone_set_ringer"]) if self.telephone else False)
elif "telephone_set_low_latency_output" in call: connection.send(self.telephone.set_low_latency_output(call["telephone_set_low_latency_output"]) if self.telephone else False)
elif "telephone_announce" in call: connection.send(self.telephone.announce() if self.telephone else False)
elif "telephone_get_call_log" in call: connection.send(self.telephone.get_call_log() if self.telephone else [])
elif "get_destination_mtu" in call: connection.send(self._get_destination_mtu(call["get_destination_mtu"]))
elif "get_destination_edr" in call: connection.send(self._get_destination_edr(call["get_destination_edr"]))
elif "get_destination_lmd" in call: connection.send(self._get_destination_lmd(call["get_destination_lmd"]))
elif "get_lxm_progress" in call: connection.send(self.get_lxm_progress(call["get_lxm_progress"]["lxm_hash"]))
elif "get_lxm_stamp_cost" in call: connection.send(self.get_lxm_stamp_cost(call["get_lxm_stamp_cost"]["lxm_hash"]))
elif "get_lxm_propagation_cost" in call: connection.send(self.get_lxm_propagation_cost(call["get_lxm_propagation_cost"]["lxm_hash"]))
elif "is_tracking" in call: connection.send(self.is_tracking(call["is_tracking"]))
elif "start_tracking" in call: connection.send(self.start_tracking(object_addr=call["start_tracking"]["object_addr"], interval=call["start_tracking"]["interval"], duration=call["start_tracking"]["duration"]))
elif "stop_tracking" in call: connection.send(self.stop_tracking(object_addr=call["stop_tracking"]["object_addr"]))
elif "get_service_log" in call: connection.send(self.get_service_log())
elif "start_voice" in call: connection.send(self.start_voice())
elif "stop_voice" in call: connection.send(self.stop_voice())
elif "telephone_is_available" in call: connection.send(self.telephone.is_available if self.telephone else False)
elif "telephone_is_in_call" in call: connection.send(self.telephone.is_in_call if self.telephone else False)
elif "telephone_call_is_connecting" in call: connection.send(self.telephone.call_is_connecting if self.telephone else False)
elif "telephone_is_ringing" in call: connection.send(self.telephone.is_ringing if self.telephone else False)
elif "telephone_caller_info" in call: connection.send(self.telephone.caller.hash if self.telephone and self.telephone.caller else None)
elif "telephone_set_busy" in call: connection.send(self.telephone.set_busy(call["telephone_set_busy"]) if self.telephone else False)
elif "telephone_dial" in call: connection.send(self.telephone.dial(call["telephone_dial"]) if self.telephone else False)
elif "telephone_hangup" in call: connection.send(self.telephone.hangup() if self.telephone else False)
elif "telephone_answer" in call: connection.send(self.telephone.answer() if self.telephone else False)
elif "telephone_set_speaker" in call: connection.send(self.telephone.set_speaker(call["telephone_set_speaker"]) if self.telephone else False)
elif "telephone_set_microphone" in call: connection.send(self.telephone.set_microphone(call["telephone_set_microphone"]) if self.telephone else False)
elif "telephone_set_ringer" in call: connection.send(self.telephone.set_ringer(call["telephone_set_ringer"]) if self.telephone else False)
elif "telephone_set_low_latency_output" in call: connection.send(self.telephone.set_low_latency_output(call["telephone_set_low_latency_output"]) if self.telephone else False)
elif "telephone_announce" in call: connection.send(self.telephone.announce() if self.telephone else False)
elif "telephone_get_call_log" in call: connection.send(self.telephone.get_call_log() if self.telephone else [])
elif "telephone_clear_call_log" in call: connection.send(self.telephone.clear_call_log() if self.telephone else False)
else:
connection.send(None)

View File

@@ -118,6 +118,12 @@ class ReticulumTelephone():
def set_busy(self, busy): self.telephone.set_busy(busy)
def set_low_latency_output(self, enabled): self.telephone.set_low_latency_output(enabled)
def clear_call_log(self):
self.call_log = []
try:
with open(self.logpath, "wb") as logfile: logfile.write(msgpack.packb([]))
except Exception as e: raise OSError("Could not clear call log file")
def get_call_log(self):
if self.call_log: return self.call_log
else:
@@ -264,13 +270,14 @@ class ReticulumTelephoneProxy():
@property
def caller(self): return CallerProxy(hash=self.owner.service_rpc_request({"telephone_caller_info": True }))
def set_busy(self, busy): return self.owner.service_rpc_request({"telephone_set_busy": busy })
def dial(self, dial_target): return self.owner.service_rpc_request({"telephone_dial": dial_target })
def hangup(self): return self.owner.service_rpc_request({"telephone_hangup": True })
def answer(self): return self.owner.service_rpc_request({"telephone_answer": True })
def set_speaker(self, speaker): return self.owner.service_rpc_request({"telephone_set_speaker": speaker })
def set_microphone(self, microphone): return self.owner.service_rpc_request({"telephone_set_microphone": microphone })
def set_ringer(self, ringer): return self.owner.service_rpc_request({"telephone_set_ringer": ringer })
def set_busy(self, busy): return self.owner.service_rpc_request({"telephone_set_busy": busy })
def dial(self, dial_target): return self.owner.service_rpc_request({"telephone_dial": dial_target })
def hangup(self): return self.owner.service_rpc_request({"telephone_hangup": True })
def answer(self): return self.owner.service_rpc_request({"telephone_answer": True })
def set_speaker(self, speaker): return self.owner.service_rpc_request({"telephone_set_speaker": speaker })
def set_microphone(self, microphone): return self.owner.service_rpc_request({"telephone_set_microphone": microphone })
def set_ringer(self, ringer): return self.owner.service_rpc_request({"telephone_set_ringer": ringer })
def set_low_latency_output(self, enabled): return self.owner.service_rpc_request({"telephone_set_low_latency_output": enabled})
def announce(self): return self.owner.service_rpc_request({"telephone_announce": True})
def get_call_log(self): return self.owner.service_rpc_request({"telephone_get_call_log": True})
def announce(self): return self.owner.service_rpc_request({"telephone_announce": True})
def get_call_log(self): return self.owner.service_rpc_request({"telephone_get_call_log": True})
def clear_call_log(self): return self.owner.service_rpc_request({"telephone_clear_call_log": True})

View File

@@ -164,6 +164,10 @@ class Voice():
def _path_request_failed(self, dt):
toast("Path request timed out")
def clear_log_action(self, sender=None):
self.app.sideband.telephone.clear_call_log()
self.update_call_log()
def log_dial_action(self, sender=None):
def job(dt=None):
if not self.app.root.ids.screen_manager.current == "voice_screen": return
@@ -178,7 +182,6 @@ class Voice():
Clock.schedule_once(job, 0.1)
def reject_action(self, sender=None):
if self.app.sideband.voice_running:
if self.app.sideband.telephone.is_ringing:
@@ -522,6 +525,26 @@ MDScreen:
MDBoxLayout:
orientation: "vertical"
id: log_list_container
MDSeparator:
orientation: "horizontal"
height: dp(1)
MDBoxLayout:
orientation: "vertical"
size_hint_y: None
height: self.minimum_height
padding: [dp(28), dp(24), dp(28), dp(24)]
MDRectangleFlatIconButton:
id: clear_log_button
icon: "playlist-remove"
text: "Clear Log"
padding: [dp(0), dp(14), dp(0), dp(14)]
icon_size: dp(24)
font_size: dp(16)
size_hint: [1.0, None]
on_release: root.delegate.clear_log_action(self)
"""
layout_voice_settings_screen = """