mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2026-08-10 13:58:40 +02:00
Add:Haptic feedback device setting off/light/medium/heavy #472
This commit is contained in:
+12
-2
@@ -4,7 +4,7 @@ import { Haptics, ImpactStyle, NotificationType } from "@capacitor/haptics"
|
||||
const hapticsImpactHeavy = async () => {
|
||||
await Haptics.impact({ style: ImpactStyle.Heavy })
|
||||
}
|
||||
Vue.prototype.$hapticsImpactHeavy = hapticsImpactHeavy;
|
||||
Vue.prototype.$hapticsImpactHeavy = hapticsImpactHeavy
|
||||
|
||||
const hapticsImpactMedium = async () => {
|
||||
await Haptics.impact({ style: ImpactStyle.Medium })
|
||||
@@ -19,7 +19,7 @@ Vue.prototype.$hapticsImpactLight = hapticsImpactLight
|
||||
const hapticsVibrate = async () => {
|
||||
await Haptics.vibrate()
|
||||
}
|
||||
Vue.prototype.$hapticsVibrate = hapticsVibrate;
|
||||
Vue.prototype.$hapticsVibrate = hapticsVibrate
|
||||
|
||||
const hapticsNotificationSuccess = async () => {
|
||||
await Haptics.notification({ type: NotificationType.Success })
|
||||
@@ -50,3 +50,13 @@ const hapticsSelectionEnd = async () => {
|
||||
await Haptics.selectionEnd()
|
||||
}
|
||||
Vue.prototype.$hapticsSelectionEnd = hapticsSelectionEnd
|
||||
|
||||
export default ({ store }, inject) => {
|
||||
inject('hapticsImpact', () => {
|
||||
const hapticFeedback = store.state.globals.hapticFeedback
|
||||
if (hapticFeedback === 'OFF') return
|
||||
if (hapticFeedback === 'LIGHT') return hapticsImpactLight()
|
||||
if (hapticFeedback === 'MEDIUM') return hapticsImpactMedium()
|
||||
return hapticsImpactHeavy()
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user