maui
maui copied to clipboard
Vibrate - Detect zero duration and return early
Description of Change
CreateOneShot method doesn't accept a duration of zero as documented here:
https://learn.microsoft.com/en-us/dotnet/api/android.os.vibrationeffect.createoneshot?view=xamarin-android-sdk-12
However, zero is valid for the MAUI Vibrate method: https://learn.microsoft.com/en-us/dotnet/api/microsoft.maui.devices.vibration.vibrate?view=net-maui-7.0
So we need to detect this and return early to avoid this exception:
Java.Lang.IllegalArgumentException: 'at least one timing must be non-zero (segments=[Step{amplitude=-1.0, frequency=0.0, duration=0}])'
Issues Fixed
It was easier to fix this directly than to create a whole issue and take the time to make a reproduction project.
Hey there @BioTurboNick! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.
/azp run
Azure Pipelines successfully started running 2 pipeline(s).
Should we add this in the API docs and/or conceptual docs or what would be a good place to mention this?
cc: @davidbritch
/azp run
Azure Pipelines successfully started running 2 pipeline(s).
/backport to net7.0
Started backporting to net7.0: https://github.com/dotnet/maui/actions/runs/3705758101