Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/Localization/zh-Hans.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@
"Not set" = "未设置";
"Plug in the cable to change the box's network." = "要更换盒子的网络,请插上数据线。";
"Plug in the cable to update the box's firmware." = "要更新盒子的固件,请插上数据线。";
"Plug in the cable to see the paired computers." = "插上数据线才能看到已配对的电脑。";
"Network name" = "网络名称";
"Password" = "密码";
"Join" = "加入";
Expand Down
4 changes: 4 additions & 0 deletions app/Sources/VibeBuddy/SettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,10 @@ struct PairedComputersSection: View {

var body: some View {
Section {
// The box lists them over the cable only (ERROR cable_only otherwise), so the list would be empty.
if device.network == true {
Text("Plug in the cable to see the paired computers.").foregroundStyle(.secondary)
}
ForEach(device.pairedComputers ?? []) { computer in
LabeledContent(computer.name.isEmpty ? String(localized: "Unnamed computer") : computer.name) {
if computer.key == device.computerKey {
Expand Down
17 changes: 17 additions & 0 deletions daemon/src/status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,11 @@ impl DeviceState {
self.wifi_network = None;
self.wifi_address = None;
self.wifi_error = None;
} else if line.starts_with("WIFI CONNECTING ") {
// Joining again, say with a new password for the same network: the last join's address is gone.
self.wifi_address = None;
} else if let Some(why) = line.strip_prefix("WIFI FAILED ") {
self.wifi_address = None;
self.wifi_error = Some(wifi_failure(why.trim()));
} else if line.trim() == "WIFI CONNECTED" {
self.wifi_error = None;
Expand Down Expand Up @@ -480,6 +484,19 @@ mod tests {
assert_eq!(state.wifi_address, None);
}

#[test]
fn joining_the_same_network_again_forgets_the_last_address() {
let mut state = DeviceState::default();
state.apply(&line("WIFI NETWORK Home"));
state.apply(&line("WIFI ADDRESS 192.168.1.23"));
state.apply(&line("WIFI NETWORK Home"));
state.apply(&line("WIFI CONNECTING Home"));
assert_eq!(state.wifi_address, None, "not joined while it tries again");
state.apply(&line("WIFI ADDRESS 192.168.1.23"));
state.apply(&line("WIFI FAILED AuthenticationExpired"));
assert_eq!((state.wifi_address, state.wifi_error.as_deref()), (None, Some("wrong_password")));
}

#[test]
fn a_box_reached_over_the_local_network_is_joined_there() {
let mut state = DeviceState::default();
Expand Down
3 changes: 3 additions & 0 deletions desktop/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1421,8 +1421,11 @@ impl App {
};
row![text(name).size(13), space::horizontal(), action].spacing(12).into()
});
// The box lists them over the cable only (ERROR cable_only otherwise), so the list would be empty.
let unlisted = device.network.then(|| text(tr("Plug in the cable to see the paired computers.", &[])).size(13));
column![text(tr("Paired computers", &[]))]
.extend(rows)
.push(unlisted)
.push(
text(tr("A computer pairs with the box when it's plugged in. To forget them all, use COMPUTERS in the box's menu.", &[]))
.size(13),
Expand Down
Loading