2021-08-14 16:01:25 +02:00
|
|
|
use crate::tui;
|
|
|
|
use log::*;
|
|
|
|
use steamguard::{Confirmation, ConfirmationType};
|
|
|
|
|
2022-06-25 16:57:37 +02:00
|
|
|
pub fn demo_prompt() {
|
|
|
|
print!("Prompt: ");
|
|
|
|
let result = tui::prompt();
|
|
|
|
println!("Result: {}", result);
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn demo_prompt_char() {
|
|
|
|
println!("Showing prompt");
|
|
|
|
let result = tui::prompt_char("Continue?", "yn");
|
|
|
|
println!("Result: {}", result);
|
|
|
|
let result = tui::prompt_char("Continue?", "Yn");
|
|
|
|
println!("Result: {}", result);
|
|
|
|
let result = tui::prompt_char("Continue?", "yN");
|
|
|
|
println!("Result: {}", result);
|
|
|
|
}
|
|
|
|
|
2021-08-14 16:01:25 +02:00
|
|
|
pub fn demo_confirmation_menu() {
|
|
|
|
info!("showing demo menu");
|
|
|
|
let (accept, deny) = tui::prompt_confirmation_menu(vec![
|
|
|
|
Confirmation {
|
|
|
|
id: 1234,
|
|
|
|
key: 12345,
|
|
|
|
conf_type: ConfirmationType::Trade,
|
|
|
|
creator: 09870987,
|
2021-08-14 18:16:40 +02:00
|
|
|
description: "example confirmation".into(),
|
2021-08-14 16:01:25 +02:00
|
|
|
},
|
|
|
|
Confirmation {
|
|
|
|
id: 1234,
|
|
|
|
key: 12345,
|
|
|
|
conf_type: ConfirmationType::MarketSell,
|
|
|
|
creator: 09870987,
|
2021-08-14 18:16:40 +02:00
|
|
|
description: "example confirmation".into(),
|
2021-08-14 16:01:25 +02:00
|
|
|
},
|
|
|
|
Confirmation {
|
|
|
|
id: 1234,
|
|
|
|
key: 12345,
|
|
|
|
conf_type: ConfirmationType::AccountRecovery,
|
|
|
|
creator: 09870987,
|
2021-08-14 18:16:40 +02:00
|
|
|
description: "example confirmation".into(),
|
2021-08-14 16:01:25 +02:00
|
|
|
},
|
|
|
|
Confirmation {
|
|
|
|
id: 1234,
|
|
|
|
key: 12345,
|
|
|
|
conf_type: ConfirmationType::Trade,
|
|
|
|
creator: 09870987,
|
2021-08-14 18:16:40 +02:00
|
|
|
description: "example confirmation".into(),
|
2021-08-14 16:01:25 +02:00
|
|
|
},
|
2022-06-25 16:57:37 +02:00
|
|
|
])
|
|
|
|
.expect("confirmation menu demo failed");
|
2021-08-14 16:01:25 +02:00
|
|
|
println!("accept: {}, deny: {}", accept.len(), deny.len());
|
|
|
|
}
|