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*", "ja": "WiFi not connected. Entering read-only mode *EN*",
"zh": "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": { "mtxchat.close.item": {
"en": "Close menu", "en": "Close menu",
"en-tts": "Close menu" "en-tts": "Close menu"

View file

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