plus_plugins
plus_plugins copied to clipboard
feat(battery_plus): Added power source type of how the device is powered.
Description
This PR updates the battery_plus plugin to handle power source type fetching on mobile. When you request the PowerSource type from the plugin it will try to get the source type from the intent battery changed extras, to indicate if the power source is AC, USB, Wireless or by battery.
Motivation
We work with mobile scanner devices that run on Android and are socketed in Cradles for their charging and release to the users. There is no communication between the cradle and the scanner to detect if the scanner is in the cradle except for its power state. With the current version of the battery_plus package, we can detect whether the system is charging. But for development purposes, as an example, it is possible to also have a USB cable attached to the device. This will break the charging logic, and we require a second parameter to determine if the power source is our USB cable, the cradle, or the battery.
Checklist
- [x] I read the Contributor Guide and followed the process outlined there for submitting PRs.
- [x] I titled the PR using Conventional Commits.
- [x] I did not modify the
CHANGELOG.md
nor the plugin version inpubspec.yaml
files. - [ ] All existing and new tests are passing.
- [ ] The analyzer (
flutter analyze
) does not report any problems on my PR.
Breaking Change
Does your PR require plugin users to manually update their apps to accommodate your change?
- [ ] Yes, this is a breaking change (please indicate that with a
!
in the title as explained in Conventional Commits). - [x] No, this is not a breaking change.
Thanks for your contribution. Will you also provide an implementation of this feature for iOS? If this feature is planned to cover only Android we won't be able to accept it as stated in our Contributor guide.
Thanks for your contribution. Will you also provide an implementation of this feature for iOS? If this feature is planned to cover only Android we won't be able to accept it as stated in our Contributor guide.
Hi @vbuberen, I planned to implement the iOS feature this weekend. For Web and Windows, I do need to-do some research on how to accomplice this feature.
If macOS uses the same implementation as iOS, then this feature update will be planned for next weekend.
Thanks for info. No rush from our side at all. Next release for plugins is planned to be somewhere in March, depending on when other desired features/fixes are ready. So take you time. From my side I just wanted to be sure that not only Android will get this feature.
@devaronius Any updates on this?
@devaronius ping ping. I guess it can be closed?