mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2026-08-06 20:08:48 +02:00
Add: Bookmarks, Fix: Playback rate updating, Fix: Sleep timer countdown, Fix: Prev chapter btn, Change: Loading indicator for new audio player, Fix: UI alignment issues #26
This commit is contained in:
@@ -1,6 +1,17 @@
|
||||
import Vue from 'vue'
|
||||
import { formatDistance, format } from 'date-fns'
|
||||
|
||||
Vue.prototype.$isDev = process.env.NODE_ENV !== 'production'
|
||||
|
||||
Vue.prototype.$dateDistanceFromNow = (unixms) => {
|
||||
if (!unixms) return ''
|
||||
return formatDistance(unixms, Date.now(), { addSuffix: true })
|
||||
}
|
||||
Vue.prototype.$formatDate = (unixms, fnsFormat = 'MM/dd/yyyy HH:mm') => {
|
||||
if (!unixms) return ''
|
||||
return format(unixms, fnsFormat)
|
||||
}
|
||||
|
||||
Vue.prototype.$bytesPretty = (bytes, decimals = 2) => {
|
||||
if (isNaN(bytes) || bytes === null) return 'Invalid Bytes'
|
||||
if (bytes === 0) {
|
||||
|
||||
+6
-2
@@ -458,15 +458,17 @@ class LocalStorage {
|
||||
async setAllAudiobookProgress(progresses) {
|
||||
this.userAudiobooks = progresses
|
||||
await this.saveUserAudiobooks()
|
||||
|
||||
this.vuexStore.commit('user/setLocalUserAudiobooks', { ...this.userAudiobooks })
|
||||
}
|
||||
|
||||
async updateUserAudiobookProgress(progressPayload) {
|
||||
async updateUserAudiobookData(progressPayload) {
|
||||
this.userAudiobooks[progressPayload.audiobookId] = {
|
||||
...progressPayload
|
||||
}
|
||||
console.log('[LocalStorage] Updated User Audiobook Progress ' + progressPayload.audiobookId)
|
||||
await this.saveUserAudiobooks()
|
||||
|
||||
this.vuexStore.commit('user/setUserAudiobooks', { ...this.userAudiobooks })
|
||||
this.vuexStore.commit('user/setLocalUserAudiobooks', { ...this.userAudiobooks })
|
||||
}
|
||||
|
||||
@@ -474,6 +476,8 @@ class LocalStorage {
|
||||
if (!this.userAudiobooks[audiobookId]) return
|
||||
delete this.userAudiobooks[audiobookId]
|
||||
await this.saveUserAudiobooks()
|
||||
|
||||
this.vuexStore.commit('user/setUserAudiobooks', { ...this.userAudiobooks })
|
||||
this.vuexStore.commit('user/setLocalUserAudiobooks', { ...this.userAudiobooks })
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user