Added ratchet info display to object details
This commit is contained in:
parent
5d586d26fc
commit
e0e1540a94
|
@ -936,6 +936,12 @@ class SidebandApp(MDApp):
|
||||||
if self.conversations_view != None:
|
if self.conversations_view != None:
|
||||||
self.conversations_view.update()
|
self.conversations_view.update()
|
||||||
|
|
||||||
|
if self.sideband.getstate("app.flags.new_ticket", allow_cache=True):
|
||||||
|
def cb(d):
|
||||||
|
self.sideband.message_router.reload_available_tickets()
|
||||||
|
self.sideband.setstate("app.flags.new_ticket", False)
|
||||||
|
Clock.schedule_once(cb, 1.5)
|
||||||
|
|
||||||
if self.sideband.getstate("wants.viewupdate.conversations", allow_cache=True):
|
if self.sideband.getstate("wants.viewupdate.conversations", allow_cache=True):
|
||||||
if self.conversations_view != None:
|
if self.conversations_view != None:
|
||||||
self.conversations_view.update()
|
self.conversations_view.update()
|
||||||
|
|
|
@ -3647,14 +3647,20 @@ class SidebandCore():
|
||||||
|
|
||||||
def message_notification(self, message, no_display=False):
|
def message_notification(self, message, no_display=False):
|
||||||
if message.state == LXMF.LXMessage.FAILED and hasattr(message, "try_propagation_on_fail") and message.try_propagation_on_fail:
|
if message.state == LXMF.LXMessage.FAILED and hasattr(message, "try_propagation_on_fail") and message.try_propagation_on_fail:
|
||||||
RNS.log("Direct delivery of "+str(message)+" failed. Retrying as propagated message.", RNS.LOG_VERBOSE)
|
if hasattr(message, "stamp_generation_failed") and message.stamp_generation_failed == True:
|
||||||
message.try_propagation_on_fail = None
|
RNS.log(f"Could not send {message} due to a stamp generation failure", RNS.LOG_ERROR)
|
||||||
message.delivery_attempts = 0
|
if not no_display:
|
||||||
del message.next_delivery_attempt
|
self.lxm_ingest(message, originator=True)
|
||||||
message.packed = None
|
else:
|
||||||
message.desired_method = LXMF.LXMessage.PROPAGATED
|
RNS.log("Direct delivery of "+str(message)+" failed. Retrying as propagated message.", RNS.LOG_VERBOSE)
|
||||||
self._db_message_set_method(message.hash, LXMF.LXMessage.PROPAGATED)
|
message.try_propagation_on_fail = None
|
||||||
self.message_router.handle_outbound(message)
|
message.delivery_attempts = 0
|
||||||
|
if hasattr(message, "next_delivery_attempt"):
|
||||||
|
del message.next_delivery_attempt
|
||||||
|
message.packed = None
|
||||||
|
message.desired_method = LXMF.LXMessage.PROPAGATED
|
||||||
|
self._db_message_set_method(message.hash, LXMF.LXMessage.PROPAGATED)
|
||||||
|
self.message_router.handle_outbound(message)
|
||||||
else:
|
else:
|
||||||
if not no_display:
|
if not no_display:
|
||||||
self.lxm_ingest(message, originator=True)
|
self.lxm_ingest(message, originator=True)
|
||||||
|
@ -3771,9 +3777,6 @@ class SidebandCore():
|
||||||
fields[LXMF.FIELD_AUDIO] = audio
|
fields[LXMF.FIELD_AUDIO] = audio
|
||||||
|
|
||||||
lxm = LXMF.LXMessage(dest, source, content, title="", desired_method=desired_method, fields = fields)
|
lxm = LXMF.LXMessage(dest, source, content, title="", desired_method=desired_method, fields = fields)
|
||||||
|
|
||||||
# Defer stamp generation so workload doesn't run on UI thread
|
|
||||||
lxm.defer_stamp = True
|
|
||||||
|
|
||||||
if not no_display:
|
if not no_display:
|
||||||
lxm.register_delivery_callback(self.message_notification)
|
lxm.register_delivery_callback(self.message_notification)
|
||||||
|
@ -3926,6 +3929,11 @@ class SidebandCore():
|
||||||
RNS.log("Squelching notification due to telemetry-only message", RNS.LOG_DEBUG)
|
RNS.log("Squelching notification due to telemetry-only message", RNS.LOG_DEBUG)
|
||||||
telemetry_only = True
|
telemetry_only = True
|
||||||
|
|
||||||
|
if LXMF.FIELD_TICKET in message.fields:
|
||||||
|
if self.is_service:
|
||||||
|
RNS.log("Notifying UI of newly arrived delivery ticket", RNS.LOG_DEBUG)
|
||||||
|
self.setstate("app.flags.new_ticket", True)
|
||||||
|
|
||||||
if not telemetry_only:
|
if not telemetry_only:
|
||||||
if self._db_conversation(context_dest) == None:
|
if self._db_conversation(context_dest) == None:
|
||||||
self._db_create_conversation(context_dest)
|
self._db_create_conversation(context_dest)
|
||||||
|
|
|
@ -160,7 +160,7 @@ class Messages():
|
||||||
if prg <= 0.00:
|
if prg <= 0.00:
|
||||||
stamp_cost = self.app.sideband.get_lxm_stamp_cost(msg["hash"])
|
stamp_cost = self.app.sideband.get_lxm_stamp_cost(msg["hash"])
|
||||||
if stamp_cost:
|
if stamp_cost:
|
||||||
sphrase = f"Generating stamp (cost {stamp_cost})"
|
sphrase = f"Generating stamp with cost {stamp_cost}"
|
||||||
prgstr = ""
|
prgstr = ""
|
||||||
else:
|
else:
|
||||||
sphrase = "Waiting for path"
|
sphrase = "Waiting for path"
|
||||||
|
|
|
@ -781,6 +781,14 @@ class RVDetails(MDRecycleView):
|
||||||
RNS.log("The contained exception was: "+str(e), RNS.LOG_ERROR)
|
RNS.log("The contained exception was: "+str(e), RNS.LOG_ERROR)
|
||||||
RNS.trace_exception(e)
|
RNS.trace_exception(e)
|
||||||
|
|
||||||
|
try:
|
||||||
|
ratchet_id = RNS.Identity.current_ratchet_id(self.delegate.object_hash)
|
||||||
|
if ratchet_id:
|
||||||
|
self.entries.append({"icon": "lock-check-outline", "text": f"Using ratchet [b]{RNS.prettyhexrep(ratchet_id)}[/b]", "on_release": pass_job})
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
RNS.trace_exception(e)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
nh = RNS.Transport.hops_to(self.delegate.object_hash)
|
nh = RNS.Transport.hops_to(self.delegate.object_hash)
|
||||||
nhi = self.delegate.app.sideband.reticulum.get_next_hop_if_name(self.delegate.object_hash)
|
nhi = self.delegate.app.sideband.reticulum.get_next_hop_if_name(self.delegate.object_hash)
|
||||||
|
@ -806,9 +814,25 @@ class RVDetails(MDRecycleView):
|
||||||
RNS.trace_exception(e)
|
RNS.trace_exception(e)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
ticket_expires = self.delegate.app.sideband.message_router.get_outbound_ticket_expiry(self.delegate.object_hash)
|
||||||
stamp_cost = self.delegate.app.sideband.message_router.get_outbound_stamp_cost(self.delegate.object_hash)
|
stamp_cost = self.delegate.app.sideband.message_router.get_outbound_stamp_cost(self.delegate.object_hash)
|
||||||
|
t_str = ""
|
||||||
|
if ticket_expires:
|
||||||
|
t_str = " (but have ticket)"
|
||||||
if stamp_cost:
|
if stamp_cost:
|
||||||
self.entries.append({"icon": "postage-stamp", "text": f"Required stamp cost [b]{stamp_cost}[/b]", "on_release": pass_job})
|
self.entries.append({"icon": "postage-stamp", "text": f"Required stamp cost [b]{stamp_cost}[/b]"+t_str, "on_release": pass_job})
|
||||||
|
if ticket_expires:
|
||||||
|
valid_for = ticket_expires - time.time()
|
||||||
|
self.entries.append({"icon": "ticket-confirmation", "text": f"Delivery ticket valid for [b]{RNS.prettytime(valid_for)}[/b]", "on_release": pass_job})
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
RNS.trace_exception(e)
|
||||||
|
|
||||||
|
try:
|
||||||
|
ticket_expires = self.delegate.app.sideband.message_router.get_outbound_ticket_expiry(self.delegate.object_hash)
|
||||||
|
if ticket_expires:
|
||||||
|
valid_for = ticket_expires - time.time()
|
||||||
|
self.entries.append({"icon": "ticket-confirmation", "text": f"Delivery ticket valid for [b]{RNS.prettytime(valid_for)}[/b]", "on_release": pass_job})
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
RNS.trace_exception(e)
|
RNS.trace_exception(e)
|
||||||
|
|
Loading…
Reference in New Issue