mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2025-08-29 22:29:29 +02:00
Fix:Android sync server progress to local progress #808
This commit is contained in:
parent
59b428100b
commit
e634132a39
2 changed files with 4 additions and 1 deletions
|
@ -364,6 +364,7 @@ class ApiHandler(var ctx:Context) {
|
||||||
Log.d(tag, "Server progress for media item id=\"${mediaProgress.mediaItemId}\" is more recent then local. Updating local current time ${localMediaProgress.currentTime} to ${mediaProgress.currentTime}")
|
Log.d(tag, "Server progress for media item id=\"${mediaProgress.mediaItemId}\" is more recent then local. Updating local current time ${localMediaProgress.currentTime} to ${mediaProgress.currentTime}")
|
||||||
localMediaProgress.updateFromServerMediaProgress(mediaProgress)
|
localMediaProgress.updateFromServerMediaProgress(mediaProgress)
|
||||||
MediaEventManager.syncEvent(mediaProgress, "Sync on server connection")
|
MediaEventManager.syncEvent(mediaProgress, "Sync on server connection")
|
||||||
|
DeviceManager.dbManager.saveLocalMediaProgress(localMediaProgress)
|
||||||
} else if (localMediaProgress.lastUpdate > mediaProgress.lastUpdate && localMediaProgress.ebookLocation != null && localMediaProgress.ebookLocation != mediaProgress.ebookLocation) {
|
} else if (localMediaProgress.lastUpdate > mediaProgress.lastUpdate && localMediaProgress.ebookLocation != null && localMediaProgress.ebookLocation != mediaProgress.ebookLocation) {
|
||||||
// Patch ebook progress to server
|
// Patch ebook progress to server
|
||||||
val endpoint = "/api/me/progress/${localMediaProgress.libraryItemId}"
|
val endpoint = "/api/me/progress/${localMediaProgress.libraryItemId}"
|
||||||
|
|
|
@ -190,10 +190,12 @@ export default {
|
||||||
|
|
||||||
console.log('[default] Calling syncLocalSessions')
|
console.log('[default] Calling syncLocalSessions')
|
||||||
const response = await this.$db.syncLocalSessionsWithServer()
|
const response = await this.$db.syncLocalSessionsWithServer()
|
||||||
if (response && response.error) {
|
if (response?.error) {
|
||||||
console.error('[default] Failed to sync local sessions', response.error)
|
console.error('[default] Failed to sync local sessions', response.error)
|
||||||
} else {
|
} else {
|
||||||
console.log('[default] Successfully synced local sessions')
|
console.log('[default] Successfully synced local sessions')
|
||||||
|
// Reload local media progresses
|
||||||
|
await this.$store.dispatch('globals/loadLocalMediaProgress')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async syncLocalMediaProgress() {
|
async syncLocalMediaProgress() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue