Simulate sending feedback in dev

Joseph T. Lyons created

Change summary

Cargo.lock                             | 1 +
crates/feedback2/Cargo.toml            | 7 ++++---
crates/feedback2/src/feedback_modal.rs | 3 +++
3 files changed, 8 insertions(+), 3 deletions(-)

Detailed changes

Cargo.lock 🔗

@@ -3265,6 +3265,7 @@ dependencies = [
  "serde_derive",
  "settings2",
  "smallvec",
+ "smol",
  "sysinfo",
  "theme2",
  "tree-sitter-markdown",

crates/feedback2/Cargo.toml 🔗

@@ -26,16 +26,17 @@ ui = { package = "ui2", path = "../ui2" }
 util = { path = "../util" }
 workspace = { package = "workspace2", path = "../workspace2"}
 
-log.workspace = true
-futures.workspace = true
 anyhow.workspace = true
-smallvec.workspace = true
+futures.workspace = true
 human_bytes = "0.4.1"
 isahc.workspace = true
 lazy_static.workspace = true
+log.workspace = true
 postage.workspace = true
 serde.workspace = true
 serde_derive.workspace = true
+smallvec.workspace = true
+smol.workspace = true
 sysinfo.workspace = true
 tree-sitter-markdown = { git = "https://github.com/MDeiml/tree-sitter-markdown", rev = "330ecab87a3e3a7211ac69bbadc19eabecdb1cca" }
 urlencoding = "2.1.2"

crates/feedback2/src/feedback_modal.rs 🔗

@@ -22,6 +22,7 @@ use crate::{system_specs::SystemSpecs, GiveFeedback, OpenZedCommunityRepo};
 
 // For UI testing purposes
 const SEND_SUCCESS_IN_DEV_MODE: bool = true;
+const SEND_TIME_IN_DEV_MODE: Duration = Duration::from_secs(2);
 
 // Temporary, until tests are in place
 #[cfg(debug_assertions)]
@@ -273,6 +274,8 @@ impl FeedbackModal {
         system_specs: SystemSpecs,
     ) -> anyhow::Result<()> {
         if DEV_MODE {
+            smol::Timer::after(SEND_TIME_IN_DEV_MODE).await;
+
             if SEND_SUCCESS_IN_DEV_MODE {
                 return Ok(());
             } else {