Explorar o código

successfully sent messages show an alert

Rain hai 9 meses
pai
achega
47b757da11
Modificáronse 4 ficheiros con 17 adicións e 1 borrados
  1. 2 0
      client/Cargo.toml
  2. 6 0
      client/src/actions.rs
  3. 8 0
      client/src/ui.rs
  4. 1 1
      utils/src/http.rs

+ 2 - 0
client/Cargo.toml

@@ -9,4 +9,6 @@ utils = { path = "../utils" }
 logging = { path = "../logging" }
 
 cursive = "0.21"
+
+# TODO: Write an HTTP client.
 reqwest = { version = "0.12.15", features = [ "blocking" ] }

+ 6 - 0
client/src/actions.rs

@@ -56,6 +56,12 @@ pub fn on_input_submit(siv: &mut Cursive, input_field_id: &str) {
             if !error_dialogue_shown {
                 ui::error(siv, ui::Labels::FailedToLoadMessages(e).localize(language));
             }
+        } else {
+            ui::alert(
+                siv,
+                ui::Labels::Success.localize(language),
+                ui::Labels::SuccessfullySentMessage.localize(language),
+            );
         }
     } else if !text.is_empty() {
         // Invalid message

+ 8 - 0
client/src/ui.rs

@@ -58,6 +58,8 @@ pub enum Labels {
     InvalidUsernameExplination,
     Username,
     InvalidMessage,
+    Success,
+    SuccessfullySentMessage,
     FailedToSendMessage(NetworkError),
     FailedToLoadMessages(NetworkError),
     RefreshButton,
@@ -255,6 +257,12 @@ impl Labels {
             Labels::New => ["New", "Nieuw", "新"],
             Labels::Channel => ["Channel", "Kanaal", "チャネル"],
             Labels::Password => ["Password", "Wachtwoord", "パスワード"],
+            Self::Success => ["Success", "Succes", "成功"],
+            Self::SuccessfullySentMessage => [
+                "Message sent!",
+                "Bericht verzonden!",
+                "メッセージを送信しました!",
+            ],
         };
 
         let idx = match language {

+ 1 - 1
utils/src/http.rs

@@ -6,7 +6,7 @@ use std::{
 
 const VALID_HTTP_VERSIONS: &[&str] = &["HTTP/1.0", "HTTP/1.1"];
 const HTTP_VERSION: &str = "HTTP/1.1";
-const MAX_REQUEST_SIZE: usize = 512;
+const MAX_REQUEST_SIZE: usize = 1024 * 128;
 
 pub type Result<T> = std::result::Result<T, HttpError>;