Skip to content

Commit

Permalink
Fixed new conversation error dialog being wonky
Browse files Browse the repository at this point in the history
  • Loading branch information
markqvist committed Nov 24, 2024
1 parent 0cbd4c7 commit fe4c618
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
4 changes: 4 additions & 0 deletions sbapp/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2627,11 +2627,15 @@ def dl_yes(s):
RNS.log("Error while creating conversation: "+str(e), RNS.LOG_ERROR)

if new_result:
dialog.d_content.ids["n_address_field"].helper_text = ""
dialog.d_content.ids["n_address_field"].helper_text_mode = "on_focus"
dialog.d_content.ids["n_address_field"].error = False
dialog.dismiss()
if self.conversations_view != None:
self.conversations_view.update()
else:
dialog.d_content.ids["n_address_field"].helper_text = "Invalid address, check your input"
dialog.d_content.ids["n_address_field"].helper_text_mode = "persistent"
dialog.d_content.ids["n_address_field"].error = True
# dialog.d_content.ids["n_error_field"].text = "Could not create conversation. Check your input."

Expand Down
6 changes: 5 additions & 1 deletion sbapp/sideband/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -4264,7 +4264,11 @@ def new_conversation(self, dest_str, name = "", trusted = False):

try:
addr_b = bytes.fromhex(dest_str)
self._db_create_conversation(addr_b, name, trusted)
if addr_b == self.lxmf_destination.hash:
RNS.log("Cannot create conversation with own LXMF address", RNS.LOG_ERROR)
return False
else:
self._db_create_conversation(addr_b, name, trusted)

except Exception as e:
RNS.log("Error while creating conversation: "+str(e), RNS.LOG_ERROR)
Expand Down
4 changes: 2 additions & 2 deletions sbapp/ui/conversations.py
Original file line number Diff line number Diff line change
Expand Up @@ -524,8 +524,8 @@ def get_widget(self):
id: n_address_field
max_text_length: 32
hint_text: "Address"
helper_text: "Error, check your input"
helper_text_mode: "on_error"
helper_text: ""
helper_text_mode: "on_focus"
text: ""
font_size: dp(24)
Expand Down

0 comments on commit fe4c618

Please sign in to comment.