mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-21 09:14:34 +00:00
oops, broke CI with something in *this* code
push a fix that will get CI running, but breaks this dev flow
This commit is contained in:
parent
82919637d8
commit
11932898ac
3 changed files with 65 additions and 17 deletions
|
|
@ -92,7 +92,6 @@ fn main() -> ! {
|
||||||
log_server::init_wait().unwrap();
|
log_server::init_wait().unwrap();
|
||||||
log::set_max_level(log::LevelFilter::Debug);
|
log::set_max_level(log::LevelFilter::Debug);
|
||||||
log::info!("my PID is {}", xous::process::id());
|
log::info!("my PID is {}", xous::process::id());
|
||||||
let mut mode = VaultMode::Fido;
|
|
||||||
|
|
||||||
// let's try keeping this completely private as a server. can we do that?
|
// let's try keeping this completely private as a server. can we do that?
|
||||||
let sid = xous::create_server().unwrap();
|
let sid = xous::create_server().unwrap();
|
||||||
|
|
@ -175,16 +174,13 @@ fn main() -> ! {
|
||||||
log::debug!("vaultux got input line: {}", s.as_str());
|
log::debug!("vaultux got input line: {}", s.as_str());
|
||||||
match s.as_str() {
|
match s.as_str() {
|
||||||
"\u{0011}" => {
|
"\u{0011}" => {
|
||||||
mode = VaultMode::Fido;
|
vaultux.set_mode(VaultMode::Fido);
|
||||||
log::info!("fido");
|
|
||||||
}
|
}
|
||||||
"\u{0012}" => {
|
"\u{0012}" => {
|
||||||
mode = VaultMode::Totp;
|
vaultux.set_mode(VaultMode::Totp);
|
||||||
log::info!("totp");
|
|
||||||
}
|
}
|
||||||
"\u{0013}" => {
|
"\u{0013}" => {
|
||||||
mode = VaultMode::Password;
|
vaultux.set_mode(VaultMode::Password);
|
||||||
log::info!("passwords");
|
|
||||||
}
|
}
|
||||||
"\u{0014}" => {
|
"\u{0014}" => {
|
||||||
vaultux.raise_menu();
|
vaultux.raise_menu();
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,13 @@ pub(crate) struct VaultUx {
|
||||||
|
|
||||||
// our security token for making changes to our record on the GAM
|
// our security token for making changes to our record on the GAM
|
||||||
token: [u32; 4],
|
token: [u32; 4],
|
||||||
|
|
||||||
|
// current operation mode
|
||||||
|
mode: VaultMode,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const TITLE_HEIGHT: i16 = 32;
|
||||||
|
|
||||||
impl VaultUx{
|
impl VaultUx{
|
||||||
pub(crate) fn new(xns: &xous_names::XousNames, sid: xous::SID) -> Self {
|
pub(crate) fn new(xns: &xous_names::XousNames, sid: xous::SID) -> Self {
|
||||||
let gam = gam::Gam::new(xns).expect("can't connect to GAM");
|
let gam = gam::Gam::new(xns).expect("can't connect to GAM");
|
||||||
|
|
@ -52,9 +58,10 @@ impl VaultUx{
|
||||||
screensize,
|
screensize,
|
||||||
margin: Point::new(4, 4),
|
margin: Point::new(4, 4),
|
||||||
token,
|
token,
|
||||||
|
mode: VaultMode::Fido,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
pub(crate) fn set_mode(&mut self, mode: VaultMode) { self.mode = mode; }
|
||||||
/// accept a new input string
|
/// accept a new input string
|
||||||
pub(crate) fn input(&mut self, line: &str) -> Result<(), xous::Error> {
|
pub(crate) fn input(&mut self, line: &str) -> Result<(), xous::Error> {
|
||||||
self.input = Some(String::from(line));
|
self.input = Some(String::from(line));
|
||||||
|
|
@ -82,21 +89,64 @@ impl VaultUx{
|
||||||
}
|
}
|
||||||
pub(crate) fn redraw(&mut self) -> Result<(), xous::Error> {
|
pub(crate) fn redraw(&mut self) -> Result<(), xous::Error> {
|
||||||
self.clear_area();
|
self.clear_area();
|
||||||
let mut test_text = TextView::new(self.content,
|
|
||||||
|
// ---- draw title area ----
|
||||||
|
let mut title_text = TextView::new(self.content,
|
||||||
graphics_server::TextBounds::CenteredTop(
|
graphics_server::TextBounds::CenteredTop(
|
||||||
Rectangle::new(
|
Rectangle::new(
|
||||||
Point::new(self.margin.x, 0),
|
Point::new(self.margin.x, 0),
|
||||||
Point::new(self.screensize.x - self.margin.x, 48)
|
Point::new(self.screensize.x - self.margin.x, TITLE_HEIGHT)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
test_text.draw_border = false;
|
title_text.draw_border = true;
|
||||||
test_text.clear_area = true;
|
title_text.rounded_border = Some(8);
|
||||||
test_text.style = GlyphStyle::Large;
|
title_text.clear_area = true;
|
||||||
write!(test_text, "FIDO").ok();
|
title_text.style = GlyphStyle::Large;
|
||||||
self.gam.post_textview(&mut test_text).expect("couldn't post test text");
|
match self.mode {
|
||||||
|
VaultMode::Fido => write!(title_text, "FIDO").ok(),
|
||||||
|
VaultMode::Totp => write!(title_text, "⏳1234").ok(),
|
||||||
|
VaultMode::Password => write!(title_text, "🔐****").ok(),
|
||||||
|
};
|
||||||
|
self.gam.post_textview(&mut title_text).expect("couldn't post title");
|
||||||
|
|
||||||
log::trace!("repl app redraw##");
|
// ---- draw list body area ----
|
||||||
|
let available_height = self.screensize.y - TITLE_HEIGHT;
|
||||||
|
let style = GlyphStyle::Large;
|
||||||
|
let glyph_height = self.gam.glyph_height_hint(style).unwrap();
|
||||||
|
let box_height = (glyph_height * 2) as i16;
|
||||||
|
let line_count = available_height / box_height;
|
||||||
|
|
||||||
|
let mut test_list = Vec::new();
|
||||||
|
for i in 0..16 {
|
||||||
|
let test_string = format!("Test item {}\nMore info about the item.", i);
|
||||||
|
test_list.push(test_string);
|
||||||
|
}
|
||||||
|
|
||||||
|
let mut insert_at = TITLE_HEIGHT;
|
||||||
|
for item in test_list {
|
||||||
|
if insert_at > self.screensize.y - box_height {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
let mut box_text = TextView::new(self.content,
|
||||||
|
graphics_server::TextBounds::BoundingBox(
|
||||||
|
Rectangle::new(
|
||||||
|
Point::new(self.margin.x, insert_at),
|
||||||
|
Point::new(self.screensize.x - self.margin.x, insert_at + box_height)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
box_text.draw_border = true;
|
||||||
|
box_text.rounded_border = None;
|
||||||
|
box_text.clear_area = true;
|
||||||
|
box_text.style = style;
|
||||||
|
write!(box_text, "{}", item).ok();
|
||||||
|
self.gam.post_textview(&mut box_text).expect("couldn't post list item");
|
||||||
|
|
||||||
|
insert_at += box_height;
|
||||||
|
}
|
||||||
|
|
||||||
|
log::trace!("vault app redraw##");
|
||||||
self.gam.redraw().expect("couldn't redraw screen");
|
self.gam.redraw().expect("couldn't redraw screen");
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,9 @@ const ICONS: [&'static str; 4] = [
|
||||||
pub(crate) fn icontray_server() {
|
pub(crate) fn icontray_server() {
|
||||||
let xns = xous_names::XousNames::new().unwrap();
|
let xns = xous_names::XousNames::new().unwrap();
|
||||||
// one connection only, should be the GAM
|
// one connection only, should be the GAM
|
||||||
let ime_sh_sid = xns.register_name(SERVER_NAME_ICONTRAY, Some(1)).expect("can't register server");
|
// however, because the predictor is connected only on demand -- we leave this as open-ended, which
|
||||||
|
// means anyone could send something to this server if they knew the name of it.
|
||||||
|
let ime_sh_sid = xns.register_name(SERVER_NAME_ICONTRAY, None).expect("can't register server");
|
||||||
|
|
||||||
let mytriggers = PredictionTriggers {
|
let mytriggers = PredictionTriggers {
|
||||||
newline: false,
|
newline: false,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue