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.root.ids.nokeys_text.text = ""
self.message_area_detect() self.message_area_detect()
self.update_message_widgets() self.update_message_widgets()
self.root.ids.message_text.disabled = False
self.root.ids.screen_manager.current = "messages_screen" self.root.ids.screen_manager.current = "messages_screen"
self.sideband.setstate("app.displaying", self.root.ids.screen_manager.current) self.sideband.setstate("app.displaying", self.root.ids.screen_manager.current)
@ -504,6 +506,12 @@ class SidebandApp(MDApp):
self.open_conversations(direction="right") self.open_conversations(direction="right")
def message_send_action(self, sender=None): 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.root.ids.screen_manager.current == "messages_screen":
if self.outbound_mode_propagation and self.sideband.message_router.get_outbound_propagation_node() == None: if self.outbound_mode_propagation and self.sideband.message_router.get_outbound_propagation_node() == None:
self.messages_view.send_error_dialog = MDDialog( self.messages_view.send_error_dialog = MDDialog(
@ -542,6 +550,11 @@ class SidebandApp(MDApp):
# elevation=0, # elevation=0,
) )
self.messages_view.send_error_dialog.open() 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): def message_propagation_action(self, sender):
if self.outbound_mode_propagation: if self.outbound_mode_propagation:

View File

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