2022-04-28 17:19:02 -05:00
|
|
|
<template>
|
|
|
|
<div class="w-full h-full p-8">
|
2022-07-02 18:29:41 -05:00
|
|
|
<div v-if="$platform !== 'ios'" class="flex items-center py-3" @click="toggleDisableAutoRewind">
|
2022-04-28 17:19:02 -05:00
|
|
|
<div class="w-10 flex justify-center">
|
|
|
|
<ui-toggle-switch v-model="settings.disableAutoRewind" @input="saveSettings" />
|
|
|
|
</div>
|
|
|
|
<p class="pl-4">Disable Auto Rewind</p>
|
|
|
|
</div>
|
2022-07-27 12:58:06 -05:00
|
|
|
<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" />
|
|
|
|
</div>
|
|
|
|
<p class="pl-4">Alternative Bookshelf View</p>
|
|
|
|
</div>
|
2022-04-28 17:19:02 -05:00
|
|
|
<div class="flex items-center py-3" @click="toggleJumpBackwards">
|
|
|
|
<div class="w-10 flex justify-center">
|
|
|
|
<span class="material-icons text-4xl">{{ currentJumpBackwardsTimeIcon }}</span>
|
|
|
|
</div>
|
|
|
|
<p class="pl-4">Jump backwards time</p>
|
|
|
|
</div>
|
2022-07-01 20:05:11 -05:00
|
|
|
<div class="flex items-center py-3" @click="toggleJumpForward">
|
2022-04-28 17:19:02 -05:00
|
|
|
<div class="w-10 flex justify-center">
|
2022-07-01 20:05:11 -05:00
|
|
|
<span class="material-icons text-4xl">{{ currentJumpForwardTimeIcon }}</span>
|
2022-04-28 17:19:02 -05:00
|
|
|
</div>
|
|
|
|
<p class="pl-4">Jump forwards time</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
2022-07-01 20:05:11 -05:00
|
|
|
deviceData: null,
|
2022-04-28 17:19:02 -05:00
|
|
|
settings: {
|
|
|
|
disableAutoRewind: false,
|
2022-07-27 12:58:06 -05:00
|
|
|
enableAltView: false,
|
2022-07-01 20:05:11 -05:00
|
|
|
jumpForwardTime: 10,
|
|
|
|
jumpBackwardsTime: 10
|
|
|
|
}
|
2022-04-28 17:19:02 -05:00
|
|
|
}
|
|
|
|
},
|
|
|
|
computed: {
|
2022-07-01 20:05:11 -05:00
|
|
|
jumpForwardItems() {
|
|
|
|
return this.$store.state.globals.jumpForwardItems || []
|
2022-04-28 17:19:02 -05:00
|
|
|
},
|
2022-07-01 20:05:11 -05:00
|
|
|
jumpBackwardsItems() {
|
|
|
|
return this.$store.state.globals.jumpBackwardsItems || []
|
|
|
|
},
|
|
|
|
currentJumpForwardTimeIcon() {
|
|
|
|
return this.jumpForwardItems[this.currentJumpForwardTimeIndex].icon
|
|
|
|
},
|
|
|
|
currentJumpForwardTimeIndex() {
|
|
|
|
var index = this.jumpForwardItems.findIndex((jfi) => jfi.value === this.settings.jumpForwardTime)
|
|
|
|
return index >= 0 ? index : 1
|
2022-04-28 17:19:02 -05:00
|
|
|
},
|
|
|
|
currentJumpBackwardsTimeIcon() {
|
|
|
|
return this.jumpBackwardsItems[this.currentJumpBackwardsTimeIndex].icon
|
|
|
|
},
|
|
|
|
currentJumpBackwardsTimeIndex() {
|
2022-07-01 20:05:11 -05:00
|
|
|
var index = this.jumpBackwardsItems.findIndex((jfi) => jfi.value === this.settings.jumpBackwardsTime)
|
|
|
|
return index >= 0 ? index : 1
|
2022-04-28 17:19:02 -05:00
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
toggleDisableAutoRewind() {
|
|
|
|
this.settings.disableAutoRewind = !this.settings.disableAutoRewind
|
|
|
|
this.saveSettings()
|
|
|
|
},
|
2022-07-27 12:58:06 -05:00
|
|
|
toggleEnableAltView() {
|
|
|
|
this.settings.enableAltView = !this.settings.enableAltView
|
|
|
|
this.saveSettings()
|
|
|
|
},
|
2022-07-01 20:05:11 -05:00
|
|
|
toggleJumpForward() {
|
|
|
|
var next = (this.currentJumpForwardTimeIndex + 1) % 3
|
|
|
|
this.settings.jumpForwardTime = this.jumpForwardItems[next].value
|
2022-04-28 17:19:02 -05:00
|
|
|
this.saveSettings()
|
|
|
|
},
|
|
|
|
toggleJumpBackwards() {
|
|
|
|
var next = (this.currentJumpBackwardsTimeIndex + 4) % 3
|
|
|
|
if (next > 2) return
|
|
|
|
this.settings.jumpBackwardsTime = this.jumpBackwardsItems[next].value
|
|
|
|
this.saveSettings()
|
|
|
|
},
|
2022-07-01 20:05:11 -05:00
|
|
|
async saveSettings() {
|
|
|
|
const updatedDeviceData = await this.$db.updateDeviceSettings({ ...this.settings })
|
|
|
|
console.log('Saved device data', updatedDeviceData)
|
|
|
|
if (updatedDeviceData) {
|
|
|
|
this.$store.commit('setDeviceData', updatedDeviceData)
|
|
|
|
this.init()
|
|
|
|
}
|
|
|
|
},
|
|
|
|
async init() {
|
|
|
|
this.deviceData = await this.$db.getDeviceData()
|
|
|
|
this.$store.commit('setDeviceData', this.deviceData)
|
|
|
|
|
|
|
|
const deviceSettings = this.deviceData.deviceSettings || {}
|
|
|
|
this.settings.disableAutoRewind = !!deviceSettings.disableAutoRewind
|
2022-07-27 12:58:06 -05:00
|
|
|
this.settings.enableAltView = !!deviceSettings.enableAltView
|
2022-07-01 20:05:11 -05:00
|
|
|
this.settings.jumpForwardTime = deviceSettings.jumpForwardTime || 10
|
|
|
|
this.settings.jumpBackwardsTime = deviceSettings.jumpBackwardsTime || 10
|
2022-04-28 17:19:02 -05:00
|
|
|
}
|
|
|
|
},
|
|
|
|
mounted() {
|
2022-07-01 20:05:11 -05:00
|
|
|
this.init()
|
2022-04-28 17:19:02 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|