Skip to content

Commit fd5584e

Browse files
committed
fix(wifi): enable connection to open wifis
1 parent 68bdd3d commit fd5584e

File tree

1 file changed

+6
-10
lines changed
  • cosmic-settings/src/pages/networking

1 file changed

+6
-10
lines changed

cosmic-settings/src/pages/networking/wifi.rs

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -684,17 +684,14 @@ fn devices_view() -> Section<crate::pages::Message> {
684684
}))
685685
.any(|known| known == network.ssid.as_ref());
686686

687-
// TODO: detect if access point is secured or not.
688-
let is_encrypted = true;
689-
690687
let (connect_txt, connect_msg) = if is_connected {
691688
(&section.descriptions[connected_txt], None)
692689
} else if page.connecting.contains(&network.ssid) {
693690
(&section.descriptions[connecting_txt], None)
694691
} else {
695692
(
696693
&section.descriptions[connect_txt],
697-
Some(if is_known || !is_encrypted {
694+
Some(if is_known || network.network_type == NetworkType::Open {
698695
Message::Connect(network.ssid.clone())
699696
} else {
700697
Message::PasswordRequest(network.ssid.clone())
@@ -705,7 +702,7 @@ fn devices_view() -> Section<crate::pages::Message> {
705702
let identifier = widget::row::with_capacity(3)
706703
.push(widget::icon::from_name(wifi_icon(
707704
network.strength,
708-
is_encrypted,
705+
network.network_type,
709706
)))
710707
.push(
711708
widget::text::body(network.ssid.as_ref()).wrapping(Wrapping::Glyph),
@@ -902,11 +899,10 @@ pub fn update_devices(conn: zbus::Connection) -> Task<crate::app::Message> {
902899
})
903900
}
904901

905-
fn wifi_icon(strength: u8, is_encrypted: bool) -> &'static str {
906-
if is_encrypted {
907-
wifi_icon_secure(strength)
908-
} else {
909-
wifi_icon_open(strength)
902+
fn wifi_icon(strength: u8, network_type: NetworkType) -> &'static str {
903+
match network_type {
904+
NetworkType::Open => wifi_icon_open(strength),
905+
_ => wifi_icon_secure(strength),
910906
}
911907
}
912908

0 commit comments

Comments
 (0)