Improved message sending responsiveness

This commit is contained in:
Mark Qvist 2022-10-08 18:13:24 +02:00
parent 1603fd4a0f
commit 19d41a182d
2 changed files with 14 additions and 0 deletions

View File

@ -493,6 +493,8 @@ class SidebandApp(MDApp):
self.root.ids.nokeys_text.text = ""
self.message_area_detect()
self.update_message_widgets()
self.root.ids.message_text.disabled = False
self.root.ids.screen_manager.current = "messages_screen"
self.sideband.setstate("app.displaying", self.root.ids.screen_manager.current)
@ -504,6 +506,12 @@ class SidebandApp(MDApp):
self.open_conversations(direction="right")
def message_send_action(self, sender=None):
def cb(dt):
self.message_send_dispatch(sender)
Clock.schedule_once(cb, 0.20)
def message_send_dispatch(self, sender=None):
self.root.ids.message_send_button.disabled = True
if self.root.ids.screen_manager.current == "messages_screen":
if self.outbound_mode_propagation and self.sideband.message_router.get_outbound_propagation_node() == None:
self.messages_view.send_error_dialog = MDDialog(
@ -543,6 +551,11 @@ class SidebandApp(MDApp):
)
self.messages_view.send_error_dialog.open()
def cb(dt):
self.root.ids.message_send_button.disabled = False
Clock.schedule_once(cb, 0.5)
def message_propagation_action(self, sender):
if self.outbound_mode_propagation:
self.outbound_mode_propagation = False

View File

@ -167,6 +167,7 @@ MDNavigationLayout:
max_height: dp(100)
MDRectangleFlatIconButton:
id: message_send_button
icon: "transfer-up"
text: "Send"
padding: [dp(10), dp(13), dp(10), dp(14)]