Skip to content

Commit

Permalink
wallet: dont show keyboard and emoji picker at the same time ever
Browse files Browse the repository at this point in the history
  • Loading branch information
darkfi committed Jan 10, 2025
1 parent 201802c commit 0482e35
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
1 change: 1 addition & 0 deletions bin/darkwallet/src/app/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,7 @@ pub fn create_chatedit(name: &str) -> SceneNode {
node.add_property(prop).unwrap();

node.add_signal("enter_pressed", "Enter key pressed", vec![]).unwrap();
node.add_signal("request_keyboard", "Request to show keyboard", vec![]).unwrap();

// Used by emoji_picker
node.add_method("insert_text", vec![("text", "Text", CallArgType::Str)], None).unwrap();
Expand Down
13 changes: 13 additions & 0 deletions bin/darkwallet/src/app/schema/chat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -909,6 +909,19 @@ pub async fn make(
prop.set_f32(Role::App, 2, EMOJIBTN_BOX[2]).unwrap();
prop.set_f32(Role::App, 3, EMOJIBTN_BOX[3]).unwrap();

let (slot, recvr) = Slot::new("reqkeyb");
chatedit_node.register("request_keyboard", slot).unwrap();
let emoji_btn_is_visible2 = emoji_btn_is_visible.clone();
let listen_click = app.ex.spawn(async move {
while let Ok(_) = recvr.recv().await {
if emoji_btn_is_visible2.get() {
debug!(target: "app::chat", "Emoji picker not visible so showing keyboard");
miniquad::window::show_keyboard(true);
}
}
});
app.tasks.lock().unwrap().push(listen_click);

let (slot, recvr) = Slot::new("emoji_clicked");
node.register("click", slot).unwrap();
let listen_click = app.ex.spawn(async move {
Expand Down
11 changes: 8 additions & 3 deletions bin/darkwallet/src/ui/chatedit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1181,7 +1181,10 @@ impl ChatEdit {
KeyCode::Kp8 => self.insert_char('8').await,
KeyCode::Kp9 => self.insert_char('9').await,
KeyCode::KpDecimal => self.insert_char('.').await,
//KeyCode::Enter | KeyCode::KpEnter => self.insert_char('\n').await,
KeyCode::Enter | KeyCode::KpEnter => {
let node = self.node.upgrade().unwrap();
node.trigger("enter_pressed", vec![]).await.unwrap();
}
KeyCode::Delete => {
self.delete(0, 1);
self.clamp_scroll(&mut self.text_wrap.lock());
Expand Down Expand Up @@ -1522,8 +1525,10 @@ impl ChatEdit {
}
_ => {}
}
debug!(target: "ui::chatedit", "handle touch end showing keyboard");
window::show_keyboard(true);

let node = self.node.upgrade().unwrap();
node.trigger("request_keyboard", vec![]).await.unwrap();

true
}

Expand Down

0 comments on commit 0482e35

Please sign in to comment.