mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-19 09:00:54 +00:00
implement sigchat chat menu items [register, link, close]
This commit is contained in:
parent
7b26c04fb0
commit
f51f781c3b
3 changed files with 39 additions and 2 deletions
|
|
@ -30,6 +30,8 @@ The `sigchat` code is primarily concerned with the Signal specific protocols, wh
|
||||||
The Chat library provides the UI to display a series of Signal post (Posts) in a Signal group (Dialogue) stored in the pddb. Each Dialogue is stored in the `pddb:dict` `sigchat.dialogue` under a descriptive `pddb:key` (ie ``).
|
The Chat library provides the UI to display a series of Signal post (Posts) in a Signal group (Dialogue) stored in the pddb. Each Dialogue is stored in the `pddb:dict` `sigchat.dialogue` under a descriptive `pddb:key` (ie ``).
|
||||||
|
|
||||||
`sigchat` passes a menu to the Chat UI:
|
`sigchat` passes a menu to the Chat UI:
|
||||||
|
* `register` to register a new Signal account with a phone number
|
||||||
|
* `link` this device to an existing Signal account.
|
||||||
|
|
||||||
The `sigchat` servers is set to receive:
|
The `sigchat` servers is set to receive:
|
||||||
* `SigchatOp::Post` A memory msg containing an outbount user post
|
* `SigchatOp::Post` A memory msg containing an outbount user post
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,17 @@
|
||||||
"en": "Setup Signal on this device.",
|
"en": "Setup Signal on this device.",
|
||||||
"en-tts": "Setup Signal on this device."
|
"en-tts": "Setup Signal on this device."
|
||||||
},
|
},
|
||||||
|
"sigchat.menu.close": {
|
||||||
|
"en": "Close menu",
|
||||||
|
"en-tts": "Close menu"
|
||||||
|
},
|
||||||
|
"sigchat.register": {
|
||||||
|
"en": "Register",
|
||||||
|
"en-tts": "Register"
|
||||||
|
},
|
||||||
|
"sigchat.link": {
|
||||||
|
"en": "Link",
|
||||||
|
"en-tts": "Link"
|
||||||
},
|
},
|
||||||
"sigchat.number": {
|
"sigchat.number": {
|
||||||
"en": "Number",
|
"en": "Number",
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,30 @@ fn wrapped_main() -> ! {
|
||||||
);
|
);
|
||||||
|
|
||||||
let cid = xous::connect(sid).unwrap();
|
let cid = xous::connect(sid).unwrap();
|
||||||
|
chat.menu_add(MenuItem {
|
||||||
|
name: xous_ipc::String::from_str(t!("sigchat.register", locales::LANG)),
|
||||||
|
action_conn: Some(cid),
|
||||||
|
action_opcode: SigchatOp::Menu as u32,
|
||||||
|
action_payload: MenuPayload::Scalar([MenuOp::Register as u32, 0, 0, 0]),
|
||||||
|
close_on_select: true,
|
||||||
|
})
|
||||||
|
.expect("failed add menu");
|
||||||
|
chat.menu_add(MenuItem {
|
||||||
|
name: xous_ipc::String::from_str(t!("sigchat.link", locales::LANG)),
|
||||||
|
action_conn: Some(cid),
|
||||||
|
action_opcode: SigchatOp::Menu as u32,
|
||||||
|
action_payload: MenuPayload::Scalar([MenuOp::Link as u32, 0, 0, 0]),
|
||||||
|
close_on_select: true,
|
||||||
|
})
|
||||||
|
.expect("failed add menu");
|
||||||
|
chat.menu_add(MenuItem {
|
||||||
|
name: xous_ipc::String::from_str(t!("sigchat.menu.close", locales::LANG)),
|
||||||
|
action_conn: Some(cid),
|
||||||
|
action_opcode: SigchatOp::Menu as u32,
|
||||||
|
action_payload: MenuPayload::Scalar([MenuOp::Noop as u32, 0, 0, 0]),
|
||||||
|
close_on_select: true,
|
||||||
|
})
|
||||||
|
.expect("failed add menu");
|
||||||
|
|
||||||
let mut sigchat = SigChat::new(&chat);
|
let mut sigchat = SigChat::new(&chat);
|
||||||
let mut first_focus = true;
|
let mut first_focus = true;
|
||||||
|
|
@ -88,9 +112,9 @@ fn wrapped_main() -> ! {
|
||||||
log::info!("got Chat Menu Click");
|
log::info!("got Chat Menu Click");
|
||||||
xous::msg_scalar_unpack!(msg, menu_code, _, _, _, {
|
xous::msg_scalar_unpack!(msg, menu_code, _, _, _, {
|
||||||
match FromPrimitive::from_usize(menu_code) {
|
match FromPrimitive::from_usize(menu_code) {
|
||||||
Some(MenuOp::Link) => {}
|
Some(MenuOp::Link) => sigchat.account_link(),
|
||||||
Some(MenuOp::Noop) => {}
|
Some(MenuOp::Noop) => {}
|
||||||
Some(MenuOp::Register) => {}
|
Some(MenuOp::Register) => sigchat.account_register(),
|
||||||
_ => (),
|
_ => (),
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue