mtxchat add modal begging for patience

This commit is contained in:
nworbnhoj 2023-09-09 10:20:24 +10:00
parent 7a13439d5c
commit 07ef4d16c2
2 changed files with 19 additions and 4 deletions

View file

@ -225,6 +225,10 @@
"ja": "WiFi not connected. Entering read-only mode *EN*",
"zh": "WiFi not connected. Entering read-only mode *EN*"
},
"mtxchat.listen.patience": {
"en": "It takes a while to get new events from the [matrix] server.\nPlease be patient :-)",
"en-tts": "It takes a while to get new events from the [matrix] server.\nPlease be patient."
},
"mtxchat.close.item": {
"en": "Close menu",
"en-tts": "Close menu"

View file

@ -78,6 +78,7 @@ pub struct MtxChat<'a> {
since: String,
listening: bool,
modals: Modals,
new_room: bool,
}
impl<'a> MtxChat<'a> {
pub fn new(chat: &Chat) -> MtxChat {
@ -103,6 +104,7 @@ impl<'a> MtxChat<'a> {
since: EMPTY.to_string(),
listening: false,
modals: modals,
new_room: false,
}
}
@ -243,6 +245,12 @@ impl<'a> MtxChat<'a> {
if let Some(room) = self.get_room_id() {
self.dialogue_set(Some(room.as_str()));
self.listen();
if self.new_room {
self.new_room = false;
self.modals
.show_notification(t!("mtxchat.listen.patience", locales::LANG), None)
.expect("notification failed");
}
return true;
} else {
self.modals
@ -403,10 +411,13 @@ impl<'a> MtxChat<'a> {
let builder = match self.get(ROOM_NAME_KEY) {
// TODO add TextValidationFn
Ok(Some(room)) => builder.field_placeholder_persist(Some(room), None),
_ => builder.field(
Some(t!("mtxchat.room.name", locales::LANG).to_string()),
None,
),
_ => {
self.new_room = true;
builder.field(
Some(t!("mtxchat.room.name", locales::LANG).to_string()),
None,
)
}
};
let builder = match self.get(ROOM_DOMAIN_KEY) {
// TODO add TextValidationFn