Skip to content

Battery status display

Summary

Display battery status at the bottom of each device on its DeviceFragment.

Each link's BatteryPlugin can now cache up to one DeviceBatteryInfo. Whenever the PairingFragment loads, it will display charging information derived from said info on-screen. Note that this Merge Request adds five new string resources.

This should probably be reviewed along-side kde/kdeconnect-kde!175, which enables battery reporting on kdeconnect-kde clients.

Concerns

I think it would be more intuitive to show real-time updates on the UI, but I'm worried the code for that would be too complex.

It might make sense to split this feature out into its own plugin, separate from the code that reports battery status.

Test Plan

I'll need to write some unit tests for the code. Beyond that:

  1. Everything should look as it does pre-merge if the battery plugin is disabled
  2. If the plugin is enabled, battery status will appear inline with the connected device's name in the PairingFragment
  3. Battery status updates whenever the list is refreshed (such as when the app is backgrounded/resumed)
  4. If the device is charging, its battery status will include the word 'charging'
  5. If the device's battery is low, its battery status will include the phrase 'Low Battery'
Edited by Philip Cohn-Cort

Merge request reports