2022-04-28 17:19:02 -05:00
< template >
2023-12-03 17:37:01 -06:00
< div class = "w-full h-full px-4 py-8 overflow-y-auto" >
2023-01-08 15:32:15 -06:00
<!-- Display settings -- >
2023-12-03 17:37:01 -06:00
< p class = "uppercase text-xs font-semibold text-gray-300 mb-2" > { { $strings . HeaderUserInterfaceSettings } } < / p >
2022-07-27 12:58:06 -05:00
< div class = "flex items-center py-3" @click ="toggleEnableAltView" >
< div class = "w-10 flex justify-center" >
2023-01-29 17:20:46 -06:00
< ui-toggle-switch v-model = "enableBookshelfView" @input="saveSettings" / >
2022-07-27 12:58:06 -05:00
< / div >
2023-12-03 17:37:01 -06:00
< p class = "pl-4" > { { $strings . LabelUseBookshelfView } } < / p >
2022-07-27 12:58:06 -05:00
< / div >
2023-09-17 12:53:38 -05:00
<!-- screen . orientation . lock not supported on iOS webview -- >
< div v-if = "!isiOS" class="flex items-center py-3" @click.stop="toggleLockOrientation" >
2023-01-08 15:38:34 -06:00
< div class = "w-10 flex justify-center pointer-events-none" >
< ui-toggle-switch v-model = "lockCurrentOrientation" / >
2022-12-04 10:41:09 -06:00
< / div >
2023-12-03 17:37:01 -06:00
< p class = "pl-4" > { { $strings . LabelLockOrientation } } < / p >
2022-12-04 10:41:09 -06:00
< / div >
2023-01-08 15:32:15 -06:00
< div class = "py-3 flex items-center" >
2023-12-03 17:37:01 -06:00
< p class = "pr-4 w-36" > { { $strings . LabelHapticFeedback } } < / p >
2023-01-29 13:19:06 -06:00
< div @click.stop ="showHapticFeedbackOptions" >
< ui-text-input :value = "hapticFeedbackOption" readonly append -icon = " expand_more " style = "max-width: 145px" / >
< / div >
2023-01-08 15:32:15 -06:00
< / div >
2023-12-03 17:37:01 -06:00
< div class = "py-3 flex items-center" >
< p class = "pr-4 w-36" > { { $strings . LabelLanguage } } < / p >
< div @click.stop ="showLanguageOptions" >
< ui-text-input :value = "languageOption" readonly append -icon = " expand_more " style = "max-width: 225px" / >
< / div >
< / div >
2022-08-07 09:13:10 -05:00
2023-01-08 15:32:15 -06:00
<!-- Playback settings -- >
2023-12-03 17:37:01 -06:00
< p class = "uppercase text-xs font-semibold text-gray-300 mb-2 mt-10" > { { $strings . HeaderPlaybackSettings } } < / p >
2022-08-07 09:13:10 -05:00
< div v-if = "!isiOS" class="flex items-center py-3" @click="toggleDisableAutoRewind" >
2022-07-27 18:21:10 -05:00
< div class = "w-10 flex justify-center" >
< ui-toggle-switch v-model = "settings.disableAutoRewind" @input="saveSettings" / >
< / div >
2023-12-03 17:37:01 -06:00
< p class = "pl-4" > { { $strings . LabelDisableAutoRewind } } < / p >
2022-07-27 18:21:10 -05:00
< / 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 >
2023-12-03 17:37:01 -06:00
< p class = "pl-4" > { { $strings . LabelJumpBackwardsTime } } < / p >
2022-04-28 17:19:02 -05:00
< / 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 >
2023-12-03 17:37:01 -06:00
< p class = "pl-4" > { { $strings . LabelJumpForwardsTime } } < / p >
2022-04-28 17:19:02 -05:00
< / div >
2023-06-17 11:27:44 -05:00
< div v-if = "!isiOS" class="flex items-center py-3" @click="toggleEnableMp3IndexSeeking" >
< div class = "w-10 flex justify-center" >
< ui-toggle-switch v-model = "settings.enableMp3IndexSeeking" @input="saveSettings" / >
< / div >
2023-12-03 17:37:01 -06:00
< p class = "pl-4" > { { $strings . LabelEnableMp3IndexSeeking } } < / p >
2023-06-17 11:27:44 -05:00
< span class = "material-icons-outlined ml-2" @click.stop ="showConfirmMp3IndexSeeking" > info < / span >
< / div >
2022-08-07 09:13:10 -05:00
2023-01-08 15:32:15 -06:00
<!-- Sleep timer settings -- >
2023-01-29 13:19:06 -06:00
< template v-if = "!isiOS" >
2023-12-03 17:37:01 -06:00
< p class = "uppercase text-xs font-semibold text-gray-300 mb-2 mt-10" > { { $strings . HeaderSleepTimerSettings } } < / p >
2023-01-29 13:19:06 -06:00
< div class = "flex items-center py-3" @click ="toggleDisableShakeToResetSleepTimer" >
< div class = "w-10 flex justify-center" >
< ui-toggle-switch v-model = "settings.disableShakeToResetSleepTimer" @input="saveSettings" / >
< / div >
2023-12-03 17:37:01 -06:00
< p class = "pl-4" > { { $strings . LabelDisableShakeToReset } } < / p >
2023-01-29 13:19:06 -06:00
< span class = "material-icons-outlined ml-2" @click.stop ="showInfo('disableShakeToResetSleepTimer')" > info < / span >
< / div >
< div v-if = "!settings.disableShakeToResetSleepTimer" class="py-3 flex items-center" >
2023-12-03 17:37:01 -06:00
< p class = "pr-4 w-36" > { { $strings . LabelShakeSensitivity } } < / p >
2023-01-29 13:19:06 -06:00
< div @click.stop ="showShakeSensitivityOptions" >
< ui-text-input :value = "shakeSensitivityOption" readonly append -icon = " expand_more " style = "width: 145px; max-width: 145px" / >
< / div >
< / div >
2023-02-04 17:39:41 -06:00
< div class = "flex items-center py-3" @click ="toggleDisableSleepTimerFadeOut" >
< div class = "w-10 flex justify-center" >
< ui-toggle-switch v-model = "settings.disableSleepTimerFadeOut" @input="saveSettings" / >
< / div >
2023-12-03 17:37:01 -06:00
< p class = "pl-4" > { { $strings . LabelDisableAudioFadeOut } } < / p >
2023-02-04 17:39:41 -06:00
< span class = "material-icons-outlined ml-2" @click.stop ="showInfo('disableSleepTimerFadeOut')" > info < / span >
< / div >
2023-02-04 17:52:31 -06:00
< div class = "flex items-center py-3" @click ="toggleDisableSleepTimerResetFeedback" >
< div class = "w-10 flex justify-center" >
< ui-toggle-switch v-model = "settings.disableSleepTimerResetFeedback" @input="saveSettings" / >
< / div >
2023-12-03 17:37:01 -06:00
< p class = "pl-4" > { { $strings . LabelDisableVibrateOnReset } } < / p >
2023-02-04 17:52:31 -06:00
< span class = "material-icons-outlined ml-2" @click.stop ="showInfo('disableSleepTimerResetFeedback')" > info < / span >
< / div >
2023-01-29 13:19:06 -06:00
< div class = "flex items-center py-3" @click ="toggleAutoSleepTimer" >
< div class = "w-10 flex justify-center" >
< ui-toggle-switch v-model = "settings.autoSleepTimer" @input="saveSettings" / >
< / div >
2023-12-03 17:37:01 -06:00
< p class = "pl-4" > { { $strings . LabelAutoSleepTimer } } < / p >
2023-01-29 13:19:06 -06:00
< span class = "material-icons-outlined ml-2" @click.stop ="showInfo('autoSleepTimer')" > info < / span >
2022-08-07 09:13:10 -05:00
< / div >
2023-01-29 13:19:06 -06:00
< / template >
<!-- Auto Sleep timer settings -- >
< div v-if = "settings.autoSleepTimer" class="py-3 flex items-center" >
2023-12-03 17:37:01 -06:00
< p class = "pr-4 w-36" > { { $strings . LabelStartTime } } < / p >
2023-01-29 13:19:06 -06:00
< ui-text-input type = "time" v-model = "settings.autoSleepTimerStartTime" style="width: 145px; max-width: 145px" @input="autoSleepTimerTimeUpdated" / >
2022-08-07 09:13:10 -05:00
< / div >
2023-01-29 13:19:06 -06:00
< div v-if = "settings.autoSleepTimer" class="py-3 flex items-center" >
2023-12-03 17:37:01 -06:00
< p class = "pr-4 w-36" > { { $strings . LabelEndTime } } < / p >
2023-01-29 13:19:06 -06:00
< ui-text-input type = "time" v-model = "settings.autoSleepTimerEndTime" style="width: 145px; max-width: 145px" @input="autoSleepTimerTimeUpdated" / >
2023-01-28 17:31:52 -06:00
< / div >
2023-01-29 13:19:06 -06:00
< div v-if = "settings.autoSleepTimer" class="py-3 flex items-center" >
2023-12-03 17:37:01 -06:00
< p class = "pr-4 w-36" > { { $strings . LabelSleepTimer } } < / p >
2023-01-29 13:19:06 -06:00
< div @click.stop ="showSleepTimerOptions" >
< ui-text-input :value = "sleepTimerLengthOption" readonly append -icon = " expand_more " style = "width: 145px; max-width: 145px" / >
< / div >
< / div >
2023-05-20 11:56:36 -05:00
< div v-if = "settings.autoSleepTimer" class="flex items-center py-3" @click="toggleAutoSleepTimerAutoRewind" >
< div class = "w-10 flex justify-center" >
< ui-toggle-switch v-model = "settings.autoSleepTimerAutoRewind" @input="saveSettings" / >
< / div >
2023-12-03 17:37:01 -06:00
< p class = "pl-4" > { { $strings . LabelAutoSleepTimerAutoRewind } } < / p >
2023-04-29 15:38:51 -06:00
< span class = "material-icons-outlined ml-2" @click.stop ="showInfo('autoSleepTimerAutoRewind')" > info < / span >
< / div >
< div v-if = "settings.autoSleepTimerAutoRewind" class="py-3 flex items-center" >
2023-12-03 17:37:01 -06:00
< p class = "pr-4 w-36" > { { $strings . LabelAutoRewindTime } } < / p >
2023-04-29 15:38:51 -06:00
< div @click.stop ="showAutoSleepTimerRewindOptions" >
< ui-text-input :value = "autoSleepTimerRewindLengthOption" readonly append -icon = " expand_more " style = "width: 145px; max-width: 145px" / >
< / div >
< / div >
2023-01-29 13:19:06 -06:00
< modals-dialog v-model = "showMoreMenuDialog" :items="moreMenuItems" @action="clickMenuAction" / >
< modals-sleep-timer-length-modal v-model = "showSleepTimerLengthModal" @change="sleepTimerLengthModalSelection" / >
2023-04-29 15:38:51 -06:00
< modals-auto-sleep-timer-rewind-length-modal v-model = "showAutoSleepTimerRewindLengthModal" @change="showAutoSleepTimerRewindLengthModalSelection" / >
2022-04-28 17:19:02 -05:00
< / div >
< / template >
< script >
2022-08-07 09:13:10 -05:00
import { Dialog } from '@capacitor/dialog'
2022-04-28 17:19:02 -05:00
export default {
data ( ) {
return {
2022-07-01 20:05:11 -05:00
deviceData : null ,
2023-01-29 13:19:06 -06:00
showMoreMenuDialog : false ,
showSleepTimerLengthModal : false ,
2023-04-29 15:38:51 -06:00
showAutoSleepTimerRewindLengthModal : false ,
2023-01-29 13:19:06 -06:00
moreMenuSetting : '' ,
2022-04-28 17:19:02 -05:00
settings : {
disableAutoRewind : false ,
2023-09-17 11:51:15 -05:00
enableAltView : true ,
2022-07-01 20:05:11 -05:00
jumpForwardTime : 10 ,
2022-08-07 09:13:10 -05:00
jumpBackwardsTime : 10 ,
2023-06-17 11:27:44 -05:00
enableMp3IndexSeeking : false ,
2022-12-04 10:41:09 -06:00
disableShakeToResetSleepTimer : false ,
2023-01-28 17:31:52 -06:00
shakeSensitivity : 'MEDIUM' ,
2023-01-08 15:32:15 -06:00
lockOrientation : 0 ,
2023-01-29 13:19:06 -06:00
hapticFeedback : 'LIGHT' ,
autoSleepTimer : false ,
autoSleepTimerStartTime : '22:00' ,
autoSleepTimerEndTime : '06:00' ,
2023-02-04 17:39:41 -06:00
sleepTimerLength : 900000 , // 15 minutes
2023-02-04 17:52:31 -06:00
disableSleepTimerFadeOut : false ,
2023-04-29 15:38:51 -06:00
disableSleepTimerResetFeedback : false ,
autoSleepTimerAutoRewind : false ,
2023-12-03 17:37:01 -06:00
autoSleepTimerAutoRewindTime : 300000 , // 5 minutes
2023-12-08 07:15:14 +00:00
languageCode : 'en-us' // 5 minutes
2022-08-07 09:13:10 -05:00
} ,
2023-01-29 13:19:06 -06:00
lockCurrentOrientation : false ,
2022-08-07 09:13:10 -05:00
settingInfo : {
disableShakeToResetSleepTimer : {
2023-12-03 17:37:01 -06:00
name : this . $strings . LabelDisableShakeToReset ,
message : this . $strings . LabelDisableShakeToResetHelp
2023-01-29 13:19:06 -06:00
} ,
autoSleepTimer : {
2023-12-03 17:37:01 -06:00
name : this . $strings . LabelAutoSleepTimer ,
message : this . $strings . LabelAutoSleepTimerHelp
2023-02-04 17:39:41 -06:00
} ,
disableSleepTimerFadeOut : {
2023-12-03 17:37:01 -06:00
name : this . $strings . LabelDisableAudioFadeOut ,
message : this . $strings . LabelDisableAudioFadeOutHelp
2023-02-04 17:52:31 -06:00
} ,
disableSleepTimerResetFeedback : {
2023-12-03 17:37:01 -06:00
name : this . $strings . LabelDisableVibrateOnReset ,
message : this . $strings . LabelDisableVibrateOnResetHelp
2023-04-29 15:38:51 -06:00
} ,
autoSleepTimerAutoRewind : {
2023-12-03 17:37:01 -06:00
name : this . $strings . LabelAutoSleepTimerAutoRewind ,
message : this . $strings . LabelAutoSleepTimerAutoRewindHelp
2023-06-17 11:27:44 -05:00
} ,
enableMp3IndexSeeking : {
2023-12-03 17:37:01 -06:00
name : this . $strings . LabelEnableMp3IndexSeeking ,
message : this . $strings . LabelEnableMp3IndexSeekingHelp
2023-11-30 13:07:30 +00:00
name : 'Enable mp3 index seeking' ,
message : 'This setting should only be enabled if you have mp3 files that are not seeking correctly. Inaccurate seeking is most likely due to Variable birate (VBR) MP3 files. This setting will force index seeking, in which a time-to-byte mapping is built as the file is read. In some cases with large MP3 files there will be a delay when seeking towards the end of the file.'
2022-08-07 09:13:10 -05:00
}
2022-12-04 10:41:09 -06:00
} ,
2023-01-08 15:32:15 -06:00
hapticFeedbackItems : [
{
2023-12-03 17:37:01 -06:00
text : this . $strings . LabelOff ,
2023-01-08 15:32:15 -06:00
value : 'OFF'
} ,
{
2023-12-03 17:37:01 -06:00
text : this . $strings . LabelLight ,
2023-01-08 15:32:15 -06:00
value : 'LIGHT'
} ,
{
2023-12-03 17:37:01 -06:00
text : this . $strings . LabelMedium ,
2023-01-08 15:32:15 -06:00
value : 'MEDIUM'
} ,
{
2023-12-03 17:37:01 -06:00
text : this . $strings . LabelHeavy ,
2023-01-08 15:32:15 -06:00
value : 'HEAVY'
}
2023-01-28 17:31:52 -06:00
] ,
shakeSensitivityItems : [
{
2023-12-03 17:37:01 -06:00
text : this . $strings . LabelVeryLow ,
2023-01-28 17:31:52 -06:00
value : 'VERY_LOW'
} ,
{
2023-12-03 17:37:01 -06:00
text : this . $strings . LabelLow ,
2023-01-28 17:31:52 -06:00
value : 'LOW'
} ,
{
2023-12-03 17:37:01 -06:00
text : this . $strings . LabelMedium ,
2023-01-28 17:31:52 -06:00
value : 'MEDIUM'
} ,
{
2023-12-03 17:37:01 -06:00
text : this . $strings . LabelHigh ,
2023-01-28 17:31:52 -06:00
value : 'HIGH'
} ,
{
2023-12-03 17:37:01 -06:00
text : this . $strings . LabelVeryHigh ,
2023-01-28 17:31:52 -06:00
value : 'VERY_HIGH'
}
2023-01-08 15:32:15 -06:00
]
2022-04-28 17:19:02 -05:00
}
} ,
computed : {
2023-01-29 17:20:46 -06:00
// This is flipped because alt view was the default until v0.9.61-beta
enableBookshelfView : {
get ( ) {
return ! this . settings . enableAltView
} ,
set ( val ) {
this . settings . enableAltView = ! val
}
} ,
2022-08-07 09:13:10 -05:00
isiOS ( ) {
return this . $platform === 'ios'
} ,
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 || [ ]
} ,
2023-12-03 17:37:01 -06:00
languageOptionItems ( ) {
return this . $languageCodeOptions || [ ]
} ,
2022-07-01 20:05:11 -05:00
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
2023-01-29 13:19:06 -06:00
} ,
shakeSensitivityOption ( ) {
const item = this . shakeSensitivityItems . find ( ( i ) => i . value === this . settings . shakeSensitivity )
2023-12-03 17:37:01 -06:00
return item ? . text || 'Error'
2023-01-29 13:19:06 -06:00
} ,
hapticFeedbackOption ( ) {
const item = this . hapticFeedbackItems . find ( ( i ) => i . value === this . settings . hapticFeedback )
2023-12-03 17:37:01 -06:00
return item ? . text || 'Error'
} ,
languageOption ( ) {
return this . languageOptionItems . find ( ( i ) => i . value === this . settings . languageCode ) ? . text || 'English'
2023-01-29 13:19:06 -06:00
} ,
sleepTimerLengthOption ( ) {
2023-12-03 17:37:01 -06:00
if ( ! this . settings . sleepTimerLength ) return this . $strings . LabelEndOfChapter
2023-01-29 13:19:06 -06:00
const minutes = Number ( this . settings . sleepTimerLength ) / 1000 / 60
return ` ${ minutes } min `
} ,
2023-04-29 15:38:51 -06:00
autoSleepTimerRewindLengthOption ( ) {
const minutes = Number ( this . settings . autoSleepTimerAutoRewindTime ) / 1000 / 60
return ` ${ minutes } min `
} ,
2023-01-29 13:19:06 -06:00
moreMenuItems ( ) {
if ( this . moreMenuSetting === 'shakeSensitivity' ) return this . shakeSensitivityItems
else if ( this . moreMenuSetting === 'hapticFeedback' ) return this . hapticFeedbackItems
2023-12-03 17:37:01 -06:00
else if ( this . moreMenuSetting === 'language' ) return this . languageOptionItems
2023-01-29 13:19:06 -06:00
return [ ]
2022-04-28 17:19:02 -05:00
}
} ,
methods : {
2023-01-29 13:19:06 -06:00
sleepTimerLengthModalSelection ( value ) {
this . settings . sleepTimerLength = value
this . saveSettings ( )
} ,
2023-04-29 15:38:51 -06:00
showAutoSleepTimerRewindLengthModalSelection ( value ) {
this . settings . autoSleepTimerAutoRewindTime = value
this . saveSettings ( )
} ,
2023-01-29 13:19:06 -06:00
showSleepTimerOptions ( ) {
this . showSleepTimerLengthModal = true
} ,
2023-04-29 15:38:51 -06:00
showAutoSleepTimerRewindOptions ( ) {
this . showAutoSleepTimerRewindLengthModal = true
} ,
2023-01-29 13:19:06 -06:00
showHapticFeedbackOptions ( ) {
this . moreMenuSetting = 'hapticFeedback'
this . showMoreMenuDialog = true
} ,
showShakeSensitivityOptions ( ) {
this . moreMenuSetting = 'shakeSensitivity'
this . showMoreMenuDialog = true
} ,
2023-12-03 17:37:01 -06:00
showLanguageOptions ( ) {
this . moreMenuSetting = 'language'
this . showMoreMenuDialog = true
} ,
2023-01-29 13:19:06 -06:00
clickMenuAction ( action ) {
this . showMoreMenuDialog = false
if ( this . moreMenuSetting === 'shakeSensitivity' ) {
this . settings . shakeSensitivity = action
this . saveSettings ( )
} else if ( this . moreMenuSetting === 'hapticFeedback' ) {
this . settings . hapticFeedback = action
this . hapticFeedbackUpdated ( action )
2023-12-03 17:37:01 -06:00
} else if ( this . moreMenuSetting === 'language' ) {
this . settings . languageCode = action
this . languageOptionUpdated ( action )
2023-01-29 13:19:06 -06:00
}
} ,
autoSleepTimerTimeUpdated ( val ) {
console . log ( '[settings] Auto sleep timer time=' , val )
if ( ! val ) return // invalid times return falsy
2023-01-28 17:31:52 -06:00
this . saveSettings ( )
} ,
2023-01-08 15:32:15 -06:00
hapticFeedbackUpdated ( val ) {
this . $store . commit ( 'globals/setHapticFeedback' , val )
this . saveSettings ( )
} ,
2023-12-03 17:37:01 -06:00
languageOptionUpdated ( val ) {
this . $setLanguageCode ( val )
this . saveSettings ( )
} ,
2022-08-07 09:13:10 -05:00
showInfo ( setting ) {
if ( this . settingInfo [ setting ] ) {
Dialog . alert ( {
title : this . settingInfo [ setting ] . name ,
message : this . settingInfo [ setting ] . message
} )
}
} ,
2023-06-17 11:27:44 -05:00
async showConfirmMp3IndexSeeking ( ) {
const confirmResult = await Dialog . confirm ( {
title : this . settingInfo . enableMp3IndexSeeking . name ,
message : this . settingInfo . enableMp3IndexSeeking . message ,
cancelButtonTitle : 'View More'
} )
if ( ! confirmResult . value ) {
window . open ( 'https://exoplayer.dev/troubleshooting.html#why-is-seeking-inaccurate-in-some-mp3-files' , '_blank' )
}
} ,
toggleEnableMp3IndexSeeking ( ) {
this . settings . enableMp3IndexSeeking = ! this . settings . enableMp3IndexSeeking
this . saveSettings ( )
} ,
2023-01-29 13:19:06 -06:00
toggleAutoSleepTimer ( ) {
this . settings . autoSleepTimer = ! this . settings . autoSleepTimer
this . saveSettings ( )
} ,
2023-04-29 15:38:51 -06:00
toggleAutoSleepTimerAutoRewind ( ) {
this . settings . autoSleepTimerAutoRewind = ! this . settings . autoSleepTimerAutoRewind
2023-05-20 11:58:27 -05:00
this . saveSettings ( )
2023-04-29 15:38:51 -06:00
} ,
2023-02-04 17:39:41 -06:00
toggleDisableSleepTimerFadeOut ( ) {
this . settings . disableSleepTimerFadeOut = ! this . settings . disableSleepTimerFadeOut
this . saveSettings ( )
} ,
2022-08-07 09:13:10 -05:00
toggleDisableShakeToResetSleepTimer ( ) {
this . settings . disableShakeToResetSleepTimer = ! this . settings . disableShakeToResetSleepTimer
this . saveSettings ( )
} ,
2023-02-04 17:52:31 -06:00
toggleDisableSleepTimerResetFeedback ( ) {
this . settings . disableSleepTimerResetFeedback = ! this . settings . disableSleepTimerResetFeedback
this . saveSettings ( )
} ,
2022-04-28 17:19:02 -05:00
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-12-04 10:41:09 -06:00
getCurrentOrientation ( ) {
2023-06-20 16:29:56 -05:00
const orientation = window . screen ? . orientation || { }
2022-12-04 10:41:09 -06:00
const type = orientation . type || ''
if ( type . includes ( 'landscape' ) ) return 'LANDSCAPE'
return 'PORTRAIT' // default
} ,
toggleLockOrientation ( ) {
this . lockCurrentOrientation = ! this . lockCurrentOrientation
if ( this . lockCurrentOrientation ) {
this . settings . lockOrientation = this . getCurrentOrientation ( )
} else {
this . settings . lockOrientation = 'NONE'
}
this . $setOrientationLock ( this . settings . lockOrientation )
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 ( ) {
2023-01-08 15:32:15 -06:00
await this . $hapticsImpact ( )
2022-07-01 20:05:11 -05:00
const updatedDeviceData = await this . $db . updateDeviceSettings ( { ... this . settings } )
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
2023-09-17 11:51:15 -05:00
this . settings . enableMp3IndexSeeking = ! ! deviceSettings . enableMp3IndexSeeking
2023-06-17 11:27:44 -05:00
2022-12-04 10:41:09 -06:00
this . settings . lockOrientation = deviceSettings . lockOrientation || 'NONE'
this . lockCurrentOrientation = this . settings . lockOrientation !== 'NONE'
2023-01-08 15:32:15 -06:00
this . settings . hapticFeedback = deviceSettings . hapticFeedback || 'LIGHT'
2023-01-29 13:19:06 -06:00
this . settings . disableShakeToResetSleepTimer = ! ! deviceSettings . disableShakeToResetSleepTimer
this . settings . shakeSensitivity = deviceSettings . shakeSensitivity || 'MEDIUM'
this . settings . autoSleepTimer = ! ! deviceSettings . autoSleepTimer
this . settings . autoSleepTimerStartTime = deviceSettings . autoSleepTimerStartTime || '22:00'
this . settings . autoSleepTimerEndTime = deviceSettings . autoSleepTimerEndTime || '06:00'
this . settings . sleepTimerLength = ! isNaN ( deviceSettings . sleepTimerLength ) ? deviceSettings . sleepTimerLength : 900000 // 15 minutes
2023-02-04 17:39:41 -06:00
this . settings . disableSleepTimerFadeOut = ! ! deviceSettings . disableSleepTimerFadeOut
2023-02-04 17:52:31 -06:00
this . settings . disableSleepTimerResetFeedback = ! ! deviceSettings . disableSleepTimerResetFeedback
2023-04-29 15:38:51 -06:00
this . settings . autoSleepTimerAutoRewind = ! ! deviceSettings . autoSleepTimerAutoRewind
2023-05-20 11:56:36 -05:00
this . settings . autoSleepTimerAutoRewindTime = ! isNaN ( deviceSettings . autoSleepTimerAutoRewindTime ) ? deviceSettings . autoSleepTimerAutoRewindTime : 300000 // 5 minutes
2023-12-03 17:37:01 -06:00
this . settings . languageCode = deviceSettings . languageCode || 'en-us'
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
}
}
2022-12-08 00:28:28 -05:00
< / script >