mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2025-08-04 10:04:39 +02:00
Offline support, downloading, syncing progress
This commit is contained in:
parent
e97218f2e8
commit
a412c9d359
37 changed files with 2836 additions and 201 deletions
|
@ -1,12 +1,29 @@
|
|||
import Vue from 'vue'
|
||||
|
||||
export const state = () => ({
|
||||
streamAudiobook: null,
|
||||
playingDownload: null,
|
||||
playOnLoad: false,
|
||||
serverUrl: null,
|
||||
user: null,
|
||||
appUpdateInfo: null
|
||||
appUpdateInfo: null,
|
||||
socketConnected: false,
|
||||
networkConnected: false,
|
||||
networkConnectionType: 'unknown',
|
||||
streamListener: null
|
||||
})
|
||||
|
||||
export const getters = {
|
||||
playerIsOpen: (state) => {
|
||||
return state.streamAudiobook || state.playingDownload
|
||||
},
|
||||
isAudiobookStreaming: (state) => id => {
|
||||
return (state.streamAudiobook && state.streamAudiobook.id === id)
|
||||
},
|
||||
isAudiobookPlaying: (state) => id => {
|
||||
return (state.playingDownload && state.playingDownload.id === id) || (state.streamAudiobook && state.streamAudiobook.id === id)
|
||||
}
|
||||
}
|
||||
|
||||
export const actions = {}
|
||||
|
||||
export const mutations = {
|
||||
|
@ -23,12 +40,37 @@ export const mutations = {
|
|||
state.playOnLoad = val
|
||||
},
|
||||
setStreamAudiobook(state, audiobook) {
|
||||
state.streamAudiobook = audiobook
|
||||
if (audiobook) {
|
||||
state.playingDownload = null
|
||||
}
|
||||
Vue.set(state, 'streamAudiobook', audiobook)
|
||||
if (state.streamListener) {
|
||||
state.streamListener('stream', audiobook)
|
||||
}
|
||||
},
|
||||
setPlayingDownload(state, download) {
|
||||
if (download) {
|
||||
state.streamAudiobook = null
|
||||
}
|
||||
Vue.set(state, 'playingDownload', download)
|
||||
if (state.streamListener) {
|
||||
state.streamListener('download', download)
|
||||
}
|
||||
},
|
||||
setServerUrl(state, url) {
|
||||
state.serverUrl = url
|
||||
},
|
||||
setUser(state, user) {
|
||||
state.user = user
|
||||
setSocketConnected(state, val) {
|
||||
state.socketConnected = val
|
||||
},
|
||||
setNetworkStatus(state, val) {
|
||||
state.networkConnected = val.connected
|
||||
state.networkConnectionType = val.connectionType
|
||||
},
|
||||
setStreamListener(state, val) {
|
||||
state.streamListener = val
|
||||
},
|
||||
removeStreamListener(state) {
|
||||
state.streamListener = null
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue