ionic-team / ionic-team/capacitor-haptics
bug: Calling the Haptics.vibrate method too often hangs iOS
- Dominant language
- TypeScript
- Stars
- 0
- Forks
- 5
- PR merge metrics
- No merged PRs in 30d
Description
## 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
Contributor guide
Assessment
This issue has not been assessed yet.