Reverts quit operation

This commit is contained in:
Tom Marble 2022-10-18 13:31:31 -05:00
parent a6021bb0a1
commit 90bcd989f7
No known key found for this signature in database
GPG key ID: 40BFEE868B055D9A
7 changed files with 1 additions and 66 deletions

View file

@ -17,18 +17,6 @@
"zh": "TBD available mtxcli commands:",
"en-tts": "available mtxcli commands:"
},
"mtxcli.quit.help": {
"en": "quit (returns to shellchat)",
"ja": "TBD quit...",
"zh": "TBD quit...",
"en-tts": "quit (returns to shellchat)"
},
"mtxcli.quit.quitting": {
"en": "quitting...",
"ja": "TBD quitting...",
"zh": "TBD quitting...",
"en-tts": "quitting.."
},
"mtxcli.unknown.help": {
"en": "unknown command",
"ja": "TBD unknown command",

View file

@ -81,14 +81,12 @@ impl CommonEnv {
///// 1. add your module here, and pull its namespace into the local crate
mod help; use help::*;
mod quit; use quit::*;
pub struct CmdEnv {
common_env: CommonEnv,
lastverb: String::<256>,
///// 2. declare storage for your command here.
help_cmd: Help,
quit_cmd: Quit,
}
impl CmdEnv {
pub fn new(xns: &xous_names::XousNames) -> CmdEnv {
@ -110,7 +108,6 @@ impl CmdEnv {
lastverb: String::<256>::new(),
///// 3. initialize your storage, by calling new()
help_cmd: Help::new(&xns),
quit_cmd: Quit::new(&xns),
}
}
@ -120,7 +117,6 @@ impl CmdEnv {
let commands: &mut [& mut dyn ShellCmdApi] = &mut [
///// 4. add your command to this array, so that it can be looked up and dispatched
&mut self.help_cmd,
&mut self.quit_cmd,
];
if let Some(cmdline) = maybe_cmdline {

View file

@ -27,13 +27,9 @@ impl<'a> ShellCmdApi<'a> for Help {
"help" => {
write!(ret, "{}", t!("mtxcli.help.help", xous::LANG)).unwrap();
}
"quit" => {
write!(ret, "{}", t!("mtxcli.quit.help", xous::LANG)).unwrap();
}
"" => {
write!(ret, "{}\n", t!("mtxcli.help.overview", xous::LANG)).unwrap();
write!(ret, "{}\n", t!("mtxcli.help.help", xous::LANG)).unwrap();
write!(ret, "{}", t!("mtxcli.quit.help", xous::LANG)).unwrap();
write!(ret, "{}", t!("mtxcli.help.help", xous::LANG)).unwrap();
}
_ => {
write!(ret, "{}: {}",

View file

@ -1,26 +0,0 @@
use crate::{ShellCmdApi,CommonEnv};
use xous_ipc::String;
use core::fmt::Write;
use locales::t;
#[derive(Debug)]
pub struct Quit {
}
impl Quit {
pub fn new(_xns: &xous_names::XousNames) -> Self {
Quit {
}
}
}
impl<'a> ShellCmdApi<'a> for Quit {
cmd_api!(quit);
fn process(&mut self, _args: String::<1024>, env: &mut CommonEnv) -> Result<Option<String::<1024>>, xous::Error> {
let mut ret = String::<1024>::new();
write!(ret, "{}", t!("mtxcli.quit.quitting", xous::LANG)).unwrap();
env.gam.request_default_app().unwrap();
Ok(Some(ret))
}
}

View file

@ -201,9 +201,6 @@ pub(crate) enum Opcode {
Bip39toBytes = 30,
BytestoBip39 = 31,
Bip39Suggestions = 32,
/// Request switching to the default app
DefaultApp = 33,
}
// small wart -- we have to reset the size of a modal to max size for resize computations

View file

@ -394,12 +394,6 @@ impl Gam {
let buf = Buffer::into_buf(switchapp).or(Err(xous::Error::InternalError))?;
buf.send(self.conn, Opcode::SwitchToApp.to_u32().unwrap()).or(Err(xous::Error::InternalError)).map(|_|())
}
/// Allows applications to "quit" and switch to a default application
pub fn request_default_app(&self) -> Result<(), xous::Error> {
send_message(self.conn,
Message::new_scalar(Opcode::DefaultApp.to_usize().unwrap(), 0, 0, 0, 0)
).map(|_|())
}
pub fn raise_menu(&self, menu_name_str: &str) -> Result<(), xous::Error> {
let menu_name = GamActivation {
name: String::<128>::from_str(menu_name_str),

View file

@ -664,16 +664,6 @@ fn wrapped_main() -> ! {
}
buffer.replace(spec).unwrap();
}
Some(Opcode::DefaultApp) => {
if let Some(new_app_token) = context_mgr.find_app_token_by_name(INITIAL_APP_FOCUS) {
match context_mgr.activate(&gfx, &mut canvases, new_app_token, true) {
Ok(_) => (),
Err(_) => log::warn!("failed to switch to {}, silent error!", switchapp.app_name.as_str().unwrap()),
}
} else {
log::warn!("Request to switch to default app, but the default app has not registered itself yet!");
}
}
Some(Opcode::Quit) => break,
None => {log::error!("unhandled message {:?}", msg);}
}