mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2026-08-08 04:48:36 +02:00
Add:Haptic feedback device setting off/light/medium/heavy #472
This commit is contained in:
@@ -212,7 +212,7 @@ class AbsDatabaseWeb extends WebPlugin {
|
||||
}
|
||||
|
||||
async updateDeviceSettings(payload) {
|
||||
var deviceData = await this.getDeviceData()
|
||||
const deviceData = await this.getDeviceData()
|
||||
deviceData.deviceSettings = payload
|
||||
localStorage.setItem('device', JSON.stringify(deviceData))
|
||||
return deviceData
|
||||
|
||||
+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