2026-07-12 11:28:39 +07:00
|
|
|
//! Settings-mode helper logic for the TUI settings overlay.
|
|
|
|
|
//!
|
|
|
|
|
//! Flow: exposes small mutation functions (currently just cycling the
|
|
|
|
|
//! internet access mode) invoked by keybindings while the settings overlay
|
|
|
|
|
//! is active.
|
|
|
|
|
|
2026-07-11 18:23:01 +07:00
|
|
|
use crate::model::settings::{Settings, InternetMode};
|
|
|
|
|
|
2026-07-12 11:28:39 +07:00
|
|
|
/// Advance the internet access mode to the next value in the cycle.
|
|
|
|
|
///
|
|
|
|
|
/// Flow: Off -> ReadOnly -> Full -> Off, wrapping around.
|
|
|
|
|
///
|
|
|
|
|
/// Why: used by a settings-toggle keybinding to step through modes
|
|
|
|
|
/// without needing a dropdown/menu.
|
|
|
|
|
///
|
|
|
|
|
/// Return: nothing; mutates `settings.internet_mode` in place.
|
2026-07-11 18:23:01 +07:00
|
|
|
pub fn cycle_internet_mode(settings: &mut Settings) {
|
|
|
|
|
settings.internet_mode = match settings.internet_mode {
|
|
|
|
|
InternetMode::Off => InternetMode::ReadOnly,
|
|
|
|
|
InternetMode::ReadOnly => InternetMode::Full,
|
|
|
|
|
InternetMode::Full => InternetMode::Off,
|
|
|
|
|
};
|
|
|
|
|
}
|