mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2026-08-28 14:17:19 +02:00
Add:Haptic feedback device setting off/light/medium/heavy #472
This commit is contained in:
+1
-1
@@ -53,7 +53,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
async logout() {
|
||||
await this.$hapticsImpactMedium()
|
||||
await this.$hapticsImpact()
|
||||
if (this.user) {
|
||||
await this.$axios.$post('/logout').catch((error) => {
|
||||
console.error(error)
|
||||
|
||||
+4
-4
@@ -402,7 +402,7 @@ export default {
|
||||
},
|
||||
async playClick() {
|
||||
let episodeId = null
|
||||
await this.$hapticsImpactMedium()
|
||||
await this.$hapticsImpact()
|
||||
|
||||
if (this.isPodcast) {
|
||||
this.episodes.sort((a, b) => {
|
||||
@@ -456,7 +456,7 @@ export default {
|
||||
this.$eventBus.$emit('play-item', { libraryItemId: this.libraryItemId, episodeId })
|
||||
},
|
||||
async clearProgressClick() {
|
||||
await this.$hapticsImpactMedium()
|
||||
await this.$hapticsImpact()
|
||||
const { value } = await Dialog.confirm({
|
||||
title: 'Confirm',
|
||||
message: 'Are you sure you want to reset your progress?'
|
||||
@@ -509,7 +509,7 @@ export default {
|
||||
if (!this.numTracks) {
|
||||
return
|
||||
}
|
||||
await this.$hapticsImpactMedium()
|
||||
await this.$hapticsImpact()
|
||||
if (this.isIos) {
|
||||
// no local folders on iOS
|
||||
this.startDownload()
|
||||
@@ -577,7 +577,7 @@ export default {
|
||||
}
|
||||
},
|
||||
async toggleFinished() {
|
||||
await this.$hapticsImpactMedium()
|
||||
await this.$hapticsImpact()
|
||||
this.isProcessingReadUpdate = true
|
||||
if (this.isLocal) {
|
||||
var isFinished = !this.userIsFinished
|
||||
|
||||
@@ -256,7 +256,7 @@ export default {
|
||||
this.showDialog = true
|
||||
},
|
||||
async play() {
|
||||
await this.$hapticsImpactMedium()
|
||||
await this.$hapticsImpact()
|
||||
this.$eventBus.$emit('play-item', { libraryItemId: this.localLibraryItemId })
|
||||
},
|
||||
getCapImageSrc(contentUrl) {
|
||||
@@ -264,7 +264,7 @@ export default {
|
||||
},
|
||||
async dialogAction(action) {
|
||||
console.log('Dialog action', action)
|
||||
await this.$hapticsImpactMedium()
|
||||
await this.$hapticsImpact()
|
||||
if (action == 'scan') {
|
||||
this.scanItem()
|
||||
} else if (action == 'rescan') {
|
||||
|
||||
+35
-10
@@ -1,6 +1,7 @@
|
||||
<template>
|
||||
<div class="w-full h-full p-8">
|
||||
<p class="uppercase text-xs font-semibold text-gray-300 mb-2">Display Settings</p>
|
||||
<!-- Display settings -->
|
||||
<p class="uppercase text-xs font-semibold text-gray-300 mb-2">User Interface Settings</p>
|
||||
<div class="flex items-center py-3" @click="toggleEnableAltView">
|
||||
<div class="w-10 flex justify-center">
|
||||
<ui-toggle-switch v-model="settings.enableAltView" @input="saveSettings" />
|
||||
@@ -13,7 +14,12 @@
|
||||
</div>
|
||||
<p class="pl-4">Lock orientation</p>
|
||||
</div>
|
||||
<div class="py-3 flex items-center">
|
||||
<p class="pr-4">Haptic feedback</p>
|
||||
<ui-dropdown v-model="settings.hapticFeedback" :items="hapticFeedbackItems" style="max-width: 105px" @input="hapticFeedbackUpdated" />
|
||||
</div>
|
||||
|
||||
<!-- Playback settings -->
|
||||
<p class="uppercase text-xs font-semibold text-gray-300 mb-2 mt-6">Playback Settings</p>
|
||||
<div v-if="!isiOS" class="flex items-center py-3" @click="toggleDisableAutoRewind">
|
||||
<div class="w-10 flex justify-center">
|
||||
@@ -34,6 +40,7 @@
|
||||
<p class="pl-4">Jump forwards time</p>
|
||||
</div>
|
||||
|
||||
<!-- Sleep timer settings -->
|
||||
<p v-if="!isiOS" class="uppercase text-xs font-semibold text-gray-300 mb-2 mt-6">Sleep Timer Settings</p>
|
||||
<div v-if="!isiOS" class="flex items-center py-3" @click="toggleDisableShakeToResetSleepTimer">
|
||||
<div class="w-10 flex justify-center">
|
||||
@@ -58,7 +65,8 @@ export default {
|
||||
jumpForwardTime: 10,
|
||||
jumpBackwardsTime: 10,
|
||||
disableShakeToResetSleepTimer: false,
|
||||
lockOrientation: 0
|
||||
lockOrientation: 0,
|
||||
hapticFeedback: 'LIGHT'
|
||||
},
|
||||
settingInfo: {
|
||||
disableShakeToResetSleepTimer: {
|
||||
@@ -66,7 +74,25 @@ export default {
|
||||
message: 'The sleep timer will start fading out when 30s is remaining. Shaking your device will reset the timer if it is within 30s OR has finished less than 2 mintues ago. Enable this setting to disable that feature.'
|
||||
}
|
||||
},
|
||||
lockCurrentOrientation: false
|
||||
lockCurrentOrientation: false,
|
||||
hapticFeedbackItems: [
|
||||
{
|
||||
text: 'Off',
|
||||
value: 'OFF'
|
||||
},
|
||||
{
|
||||
text: 'Light',
|
||||
value: 'LIGHT'
|
||||
},
|
||||
{
|
||||
text: 'Medium',
|
||||
value: 'MEDIUM'
|
||||
},
|
||||
{
|
||||
text: 'Heavy',
|
||||
value: 'HEAVY'
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -95,6 +121,10 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
hapticFeedbackUpdated(val) {
|
||||
this.$store.commit('globals/setHapticFeedback', val)
|
||||
this.saveSettings()
|
||||
},
|
||||
showInfo(setting) {
|
||||
if (this.settingInfo[setting]) {
|
||||
Dialog.alert({
|
||||
@@ -124,17 +154,13 @@ export default {
|
||||
return 'PORTRAIT' // default
|
||||
},
|
||||
toggleLockOrientation() {
|
||||
console.log('TOGGLE LOCK ORIENTATION', this.lockCurrentOrientation)
|
||||
this.lockCurrentOrientation = !this.lockCurrentOrientation
|
||||
if (this.lockCurrentOrientation) {
|
||||
console.log('CURRENT ORIENTATION=', this.getCurrentOrientation())
|
||||
this.settings.lockOrientation = this.getCurrentOrientation()
|
||||
} else {
|
||||
console.log('SETTING CURRENT ORIENTATION TO NONE')
|
||||
this.settings.lockOrientation = 'NONE'
|
||||
}
|
||||
this.$setOrientationLock(this.settings.lockOrientation)
|
||||
console.log('NOW SAVING SETTINGS', this.settings.lockOrientation)
|
||||
this.saveSettings()
|
||||
},
|
||||
toggleJumpForward() {
|
||||
@@ -149,7 +175,7 @@ export default {
|
||||
this.saveSettings()
|
||||
},
|
||||
async saveSettings() {
|
||||
await this.$hapticsImpactMedium()
|
||||
await this.$hapticsImpact()
|
||||
const updatedDeviceData = await this.$db.updateDeviceSettings({ ...this.settings })
|
||||
console.log('Saved device data', updatedDeviceData)
|
||||
if (updatedDeviceData) {
|
||||
@@ -168,9 +194,8 @@ export default {
|
||||
this.settings.jumpBackwardsTime = deviceSettings.jumpBackwardsTime || 10
|
||||
this.settings.disableShakeToResetSleepTimer = !!deviceSettings.disableShakeToResetSleepTimer
|
||||
this.settings.lockOrientation = deviceSettings.lockOrientation || 'NONE'
|
||||
|
||||
console.log('INIT SETTINGS LOCK ORIENTATION=', this.settings.lockOrientation)
|
||||
this.lockCurrentOrientation = this.settings.lockOrientation !== 'NONE'
|
||||
this.settings.hapticFeedback = deviceSettings.hapticFeedback || 'LIGHT'
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
||||
Reference in New Issue
Block a user