mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2026-08-30 15:17:14 +02:00
Move AbsAudioPlayer.setChapterTrack to AudioPlayer instead of localStore
This commit is contained in:
@@ -695,8 +695,8 @@ export default {
|
|||||||
this.updateTimestamp()
|
this.updateTimestamp()
|
||||||
this.updateTrack()
|
this.updateTrack()
|
||||||
this.updateReadyTrack()
|
this.updateReadyTrack()
|
||||||
|
this.updateUseChapterTrack()
|
||||||
this.$localStore.setUseTotalTrack(this.useTotalTrack)
|
this.$localStore.setUseTotalTrack(this.useTotalTrack)
|
||||||
this.$localStore.setUseChapterTrack(this.useChapterTrack)
|
|
||||||
} else if (action === 'total_track') {
|
} else if (action === 'total_track') {
|
||||||
this.useTotalTrack = !this.useTotalTrack
|
this.useTotalTrack = !this.useTotalTrack
|
||||||
this.useChapterTrack = !this.useTotalTrack || this.useChapterTrack
|
this.useChapterTrack = !this.useTotalTrack || this.useChapterTrack
|
||||||
@@ -704,13 +704,20 @@ export default {
|
|||||||
this.updateTimestamp()
|
this.updateTimestamp()
|
||||||
this.updateTrack()
|
this.updateTrack()
|
||||||
this.updateReadyTrack()
|
this.updateReadyTrack()
|
||||||
|
this.updateUseChapterTrack()
|
||||||
this.$localStore.setUseTotalTrack(this.useTotalTrack)
|
this.$localStore.setUseTotalTrack(this.useTotalTrack)
|
||||||
this.$localStore.setUseChapterTrack(this.useChapterTrack)
|
|
||||||
} else if (action === 'close') {
|
} else if (action === 'close') {
|
||||||
this.closePlayback()
|
this.closePlayback()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
updateUseChapterTrack() {
|
||||||
|
this.$localStore.setUseChapterTrack(this.useChapterTrack)
|
||||||
|
// Chapter track in NowPlaying only supported on iOS for now
|
||||||
|
if (this.$platform === 'ios') {
|
||||||
|
AbsAudioPlayer.setChapterTrack({ enabled: this.useChapterTrack })
|
||||||
|
}
|
||||||
|
},
|
||||||
forceCloseDropdownMenu() {
|
forceCloseDropdownMenu() {
|
||||||
if (this.$refs.dropdownMenu && this.$refs.dropdownMenu.closeMenu) {
|
if (this.$refs.dropdownMenu && this.$refs.dropdownMenu.closeMenu) {
|
||||||
this.$refs.dropdownMenu.closeMenu()
|
this.$refs.dropdownMenu.closeMenu()
|
||||||
|
|||||||
@@ -1,7 +1,4 @@
|
|||||||
import { Preferences } from '@capacitor/preferences'
|
import { Preferences } from '@capacitor/preferences'
|
||||||
import { AbsAudioPlayer } from '@/plugins/capacitor'
|
|
||||||
import { Capacitor } from '@capacitor/core'
|
|
||||||
|
|
||||||
|
|
||||||
class LocalStorage {
|
class LocalStorage {
|
||||||
constructor(vuexStore) {
|
constructor(vuexStore) {
|
||||||
@@ -48,9 +45,6 @@ class LocalStorage {
|
|||||||
async setUseChapterTrack(useChapterTrack) {
|
async setUseChapterTrack(useChapterTrack) {
|
||||||
try {
|
try {
|
||||||
await Preferences.set({ key: 'useChapterTrack', value: useChapterTrack ? '1' : '0' })
|
await Preferences.set({ key: 'useChapterTrack', value: useChapterTrack ? '1' : '0' })
|
||||||
if (Capacitor.getPlatform() === 'ios') {
|
|
||||||
AbsAudioPlayer.setChapterTrack({ enabled: useChapterTrack })
|
|
||||||
}
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('[LocalStorage] Failed to set use chapter track', error)
|
console.error('[LocalStorage] Failed to set use chapter track', error)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user