mirror of
https://github.com/l0ng-ai/tty7.git
synced 2026-10-03 08:02:02 +00:00
fix(settings): drop 'Paired with …' once that phone is unpaired
Unpairing the phone just paired left 'Paired with probe.' above an empty 'No phones paired yet.'
This commit is contained in:
@@ -320,7 +320,17 @@ impl Tty7App {
|
||||
let pairing = self
|
||||
.active_settings()
|
||||
.and_then(|s| s.mobile_pairing.as_ref());
|
||||
let paired = self.active_settings().and_then(|s| s.mobile_paired.clone());
|
||||
// Only while that phone is still on the list: unpairing it left
|
||||
// "Paired with probe." above an empty "No phones paired yet."
|
||||
let paired = self
|
||||
.active_settings()
|
||||
.and_then(|s| s.mobile_paired.clone())
|
||||
.filter(|name| {
|
||||
state
|
||||
.as_ref()
|
||||
.and_then(|state| state.devices().ok())
|
||||
.is_some_and(|devices| devices.iter().any(|d| &d.name == name))
|
||||
});
|
||||
// A spent code carries its own "New code" beside the reason it is
|
||||
// spent; a second one up here would be the same button twice.
|
||||
let pair_button = if pairing.is_some_and(|p| p.spent.is_some()) {
|
||||
|
||||
Reference in New Issue
Block a user