Skip to content

Commit 7e5deea

Browse files
Fix AP input popup flow (#146)
1 parent 56c0948 commit 7e5deea

2 files changed

Lines changed: 18 additions & 1 deletion

File tree

src/handler.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ pub async fn handle_key_events(
634634
FocusedBlock::AccessPointInput => match key_event.code {
635635
KeyCode::Enter => {
636636
ap.start(sender.clone()).await?;
637-
app.focused_block = FocusedBlock::Device;
637+
app.focused_block = FocusedBlock::AccessPoint;
638638
}
639639

640640
KeyCode::Esc => {
@@ -709,6 +709,20 @@ pub async fn handle_key_events(
709709
_ => {}
710710
},
711711

712+
KeyCode::Char(c) if c == config.ap.start => {
713+
if app.focused_block == FocusedBlock::AccessPoint {
714+
ap.ap_start
715+
.store(true, std::sync::atomic::Ordering::Relaxed);
716+
app.focused_block = FocusedBlock::AccessPointInput;
717+
}
718+
}
719+
720+
KeyCode::Char(c) if c == config.ap.stop => {
721+
if app.focused_block == FocusedBlock::AccessPoint {
722+
ap.stop(sender.clone()).await?;
723+
}
724+
}
725+
712726
_ => {
713727
if app.focused_block == FocusedBlock::Device {
714728
match key_event.code {

src/ui.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ pub fn render(app: &mut App, frame: &mut Frame) {
2323
Mode::Ap => {
2424
if let Some(ap) = &mut app.device.ap {
2525
ap.render(frame, app.focused_block, &device, app.config.clone());
26+
if app.focused_block == FocusedBlock::AccessPointInput {
27+
ap.render_input(frame);
28+
}
2629
}
2730
}
2831
}

0 commit comments

Comments
 (0)