File tree Expand file tree Collapse file tree
openlogi-agent/src/power_source Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -477,7 +477,13 @@ fn online_accessories(
477477 . get ( & identifier)
478478 . filter ( |tracked| !tracked. identity . conflicts_with ( & identity) )
479479 . and_then ( |tracked| tracked. published . as_ref ( ) )
480- . map ( |published| ( published. percentage , published. status ) )
480+ . map ( |published| {
481+ let status = paired
482+ . battery
483+ . as_ref ( )
484+ . map_or ( published. status , |battery| battery. status ) ;
485+ ( published. percentage , status)
486+ } )
481487 } ) ;
482488 let reading = battery. map ( |( percentage, status) | AccessoryPower {
483489 name : config_key
Original file line number Diff line number Diff line change @@ -608,8 +608,24 @@ fn level_only_readings_never_invent_percentage_and_preserve_last_reported_value(
608608
609609 inv. paired [ 0 ] . battery . as_mut ( ) . unwrap ( ) . percentage = None ;
610610 config. set_device_custom_name ( key, Some ( "Renamed Mouse" . into ( ) ) ) ;
611+ for ( ix, status) in [
612+ BatteryStatus :: Charging ,
613+ BatteryStatus :: Full ,
614+ BatteryStatus :: Error ,
615+ ]
616+ . into_iter ( )
617+ . enumerate ( )
618+ {
619+ inv. paired [ 0 ] . battery . as_mut ( ) . unwrap ( ) . status = status;
620+ publisher. reconcile ( & config, std:: slice:: from_ref ( & inv) , now) ;
621+ assert_eq ! ( publisher. backend. live[ key] . percentage, 0 ) ;
622+ assert_eq ! ( publisher. backend. live[ key] . name, "Renamed Mouse" ) ;
623+ assert_eq ! ( publisher. backend. live[ key] . status, status) ;
624+ assert_eq ! ( publisher. backend. writes, ix + 2 ) ;
625+ }
626+ inv. paired [ 0 ] . battery = None ;
611627 publisher. reconcile ( & config, & [ inv] , now) ;
612628 assert_eq ! ( publisher. backend. live[ key] . percentage, 0 ) ;
613- assert_eq ! ( publisher. backend. live[ key] . name , "Renamed Mouse" ) ;
614- assert_eq ! ( publisher. backend. writes, 2 ) ;
629+ assert_eq ! ( publisher. backend. live[ key] . status , BatteryStatus :: Error ) ;
630+ assert_eq ! ( publisher. backend. writes, 4 ) ;
615631}
Original file line number Diff line number Diff line change @@ -84,7 +84,7 @@ starting = "Starting"
8484waiting = " Waiting for OpenLogi agent"
8585active_singular = " Active · %{count} device"
8686active_plural = " Active · %{count} devices"
87- empty = " Connect a mouse or keyboard through Bolt or Unifying . macOS shows Bluetooth devices itself."
87+ empty = " No Bolt or Unifying mouse or keyboard has reported a battery percentage yet . macOS shows Bluetooth devices itself."
8888unavailable = " Unavailable on this version of macOS"
8989failed_singular = " Battery updates failed · %{count} device published"
9090failed_plural = " Battery updates failed · %{count} devices published"
Original file line number Diff line number Diff line change @@ -84,7 +84,7 @@ starting = "Starting"
8484waiting = " Waiting for OpenLogi agent"
8585active_singular = " Active · %{count} device"
8686active_plural = " Active · %{count} devices"
87- empty = " Connect a mouse or keyboard through Bolt or Unifying . macOS shows Bluetooth devices itself."
87+ empty = " No Bolt or Unifying mouse or keyboard has reported a battery percentage yet . macOS shows Bluetooth devices itself."
8888unavailable = " Unavailable on this version of macOS"
8989failed_singular = " Battery updates failed · %{count} device published"
9090failed_plural = " Battery updates failed · %{count} devices published"
Original file line number Diff line number Diff line change @@ -84,7 +84,7 @@ starting = "Starting"
8484waiting = " Waiting for OpenLogi agent"
8585active_singular = " Active · %{count} device"
8686active_plural = " Active · %{count} devices"
87- empty = " Connect a mouse or keyboard through Bolt or Unifying . macOS shows Bluetooth devices itself."
87+ empty = " No Bolt or Unifying mouse or keyboard has reported a battery percentage yet . macOS shows Bluetooth devices itself."
8888unavailable = " Unavailable on this version of macOS"
8989failed_singular = " Battery updates failed · %{count} device published"
9090failed_plural = " Battery updates failed · %{count} devices published"
Original file line number Diff line number Diff line change @@ -84,7 +84,7 @@ starting = "Wird gestartet"
8484waiting = " Warte auf OpenLogi-Agent"
8585active_singular = " Aktiv · %{count} Gerät"
8686active_plural = " Aktiv · %{count} Geräte"
87- empty = " Verbinde eine Maus oder Tastatur über Bolt oder Unifying. Bluetooth-Geräte zeigt macOS selbst an."
87+ empty = " Noch keine Maus oder Tastatur über Bolt oder Unifying hat einen Akkustand in Prozent gemeldet . Bluetooth-Geräte zeigt macOS selbst an."
8888unavailable = " Auf dieser macOS-Version nicht verfügbar"
8989failed_singular = " Akkuaktualisierung fehlgeschlagen · %{count} Gerät veröffentlicht"
9090failed_plural = " Akkuaktualisierung fehlgeschlagen · %{count} Geräte veröffentlicht"
Original file line number Diff line number Diff line change @@ -84,7 +84,7 @@ starting = "Starting"
8484waiting = " Waiting for OpenLogi agent"
8585active_singular = " Active · %{count} device"
8686active_plural = " Active · %{count} devices"
87- empty = " Connect a mouse or keyboard through Bolt or Unifying . macOS shows Bluetooth devices itself."
87+ empty = " No Bolt or Unifying mouse or keyboard has reported a battery percentage yet . macOS shows Bluetooth devices itself."
8888unavailable = " Unavailable on this version of macOS"
8989failed_singular = " Battery updates failed · %{count} device published"
9090failed_plural = " Battery updates failed · %{count} devices published"
Original file line number Diff line number Diff line change @@ -84,7 +84,7 @@ starting = "Starting"
8484waiting = " Waiting for OpenLogi agent"
8585active_singular = " Active · %{count} device"
8686active_plural = " Active · %{count} devices"
87- empty = " Connect a mouse or keyboard through Bolt or Unifying . macOS shows Bluetooth devices itself."
87+ empty = " No Bolt or Unifying mouse or keyboard has reported a battery percentage yet . macOS shows Bluetooth devices itself."
8888unavailable = " Unavailable on this version of macOS"
8989failed_singular = " Battery updates failed · %{count} device published"
9090failed_plural = " Battery updates failed · %{count} devices published"
Original file line number Diff line number Diff line change @@ -84,7 +84,7 @@ starting = "Starting"
8484waiting = " Waiting for OpenLogi agent"
8585active_singular = " Active · %{count} device"
8686active_plural = " Active · %{count} devices"
87- empty = " Connect a mouse or keyboard through Bolt or Unifying . macOS shows Bluetooth devices itself."
87+ empty = " No Bolt or Unifying mouse or keyboard has reported a battery percentage yet . macOS shows Bluetooth devices itself."
8888unavailable = " Unavailable on this version of macOS"
8989failed_singular = " Battery updates failed · %{count} device published"
9090failed_plural = " Battery updates failed · %{count} devices published"
Original file line number Diff line number Diff line change @@ -84,7 +84,7 @@ starting = "Starting"
8484waiting = " Waiting for OpenLogi agent"
8585active_singular = " Active · %{count} device"
8686active_plural = " Active · %{count} devices"
87- empty = " Connect a mouse or keyboard through Bolt or Unifying . macOS shows Bluetooth devices itself."
87+ empty = " No Bolt or Unifying mouse or keyboard has reported a battery percentage yet . macOS shows Bluetooth devices itself."
8888unavailable = " Unavailable on this version of macOS"
8989failed_singular = " Battery updates failed · %{count} device published"
9090failed_plural = " Battery updates failed · %{count} devices published"
You can’t perform that action at this time.
0 commit comments