capacitor-plugins icon indicating copy to clipboard operation
capacitor-plugins copied to clipboard

bug: Calling the Haptics.vibrate method too often hangs iOS

Open Shahor opened this issue 2 years ago • 1 comments

Bug Report

Plugin(s)

https://capacitorjs.com/docs/apis/haptics#vibrate

Most recent versions (probably all)

Capacitor Version

💊   Capacitor Doctor  💊 

Latest Dependencies:

  @capacitor/cli: 5.5.1
  @capacitor/core: 5.5.1
  @capacitor/android: 5.5.1
  @capacitor/ios: 5.5.1

Installed Dependencies:

  @capacitor/cli: 4.8.1
  @capacitor/core: 4.8.1
  @capacitor/android: 4.8.1
  @capacitor/ios: 4.8.1


Platform(s)

  • iOS

I haven't checked on Android

Current Behavior

When Haptics.vibrate is called too often, especially while the previous calls haven't been finished yet, the phone will hang.

Expected Behavior

The haptics are triggered from a different thread than the main one so we don't block the app completely when doing trivial actions.

Code Reproduction

https://github.com/Shahor/capacitor-haptics-repro

Other Technical Details

As stated per the documentation, https://developer.apple.com/documentation/corehaptics/preparing_your_app_to_play_haptics/#3200019, core haptics is thread safe so it can be called from wherever without impact.

Additional Context

Shahor avatar Dec 12 '23 10:12 Shahor

This issue has been labeled as type: bug. This label is added to issues that that have been reproduced and are being tracked in our internal issue tracker.

ionitron-bot[bot] avatar Jan 03 '24 18:01 ionitron-bot[bot]