Open C29H25N3O5 opened 3 years ago
This is impossible to implement without changing the source code of love and introducing undocumented API's of Apple, breaking support on older iOS versions.
I'm pretty sure it's possible to check the OS version on LOVE, and you can adjust it to that
I'm pretty sure it's possible to check the OS version on LOVE, and you can adjust it to that
No, the change of code is done outside of this repository, and outside of LOVE runtime. We might need an iOS developer to help with that. Lua code won't do here.
I'm pretty sure it's possible to check the OS version on LOVE, and you can adjust it to that
No, the change of code is done outside of this repository, and outside of LOVE runtime. We might need an iOS developer to help with that. Lua code won't do here.
Alright then. If that is the case, is it possible to just remove the vibration slider on iOS (before an LÖVE update to solve this problem)?
Good news! We're working to do exactly the change I've described. But removing that slider before the work's done seems reasonable.
love2d
uses a very old API AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
which can only vibrate for about 0.5 seconds. See https://love2d.org/wiki/love.system.vibrate
The implementation is here: https://github.com/love2d/love/blob/master/src/common/ios.mm#L394-L400
The declaration is here: https://github.com/love2d/love/blob/master/src/common/ios.h#L67-L69 and it says Causes devices with vibration support to vibrate for about 0.5 seconds.
is actually incorrect, because since iOS 10, there is a new API UIImpactFeedbackGenerator
that can generate very light vibrations (requires iOS 10+).
The iOS development documentation is available at https://developer.apple.com/documentation/uikit/uiimpactfeedbackgenerator?language=objc
Only 7% of iOS users worldwide are now using iOS 12 or lower, Apple's official source https://developer.apple.com/support/app-store/
So, if Techmino's iOS developers manually change love2d
's src/common/ios.mm#L398
to the following when packaging it would solve the problem (tested on my own iPhone X with iOS 14.7, it works perfect).
if (@available(iOS 10.0, *)) {
UIImpactFeedbackGenerator *feedBackGenertor = [[UIImpactFeedbackGenerator alloc] initWithStyle:UIImpactFeedbackStyleMedium];
[feedBackGenertor impactOccurred];
} else {
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
}
Should this be closed?
YES.
It seems that this issue has found its way back to the latest version of iOS.
Okay, now we need to add iOS 13.0+
API for even finer controlsimpactOccurredWithIntensity.
Also need to change:
When adjusting the Vibration slider in Settings, the strength of vibration cannot be specified on iOS devices. Even when the strength was set to 10, the device still produces the same vibration strength as if the strength is 1. It acts more like switch than a slider.
Also, it is suggested that the duration of the vibration could be shortened. Currently, the duration is so long that when multiple press was conducted in a short time, the device only produces one vibration.
I don't know whether this issue occurs on Android devices but it is a major problem on iPhone.