From 114dbd24bcd68f992fb8ec35d92768c359c52424 Mon Sep 17 00:00:00 2001 From: benonymity Date: Sat, 23 Apr 2022 00:27:03 -0400 Subject: [PATCH 1/8] Add button to mark book as read --- pages/item/_id.vue | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/pages/item/_id.vue b/pages/item/_id.vue index 3c011697..5a2dced5 100644 --- a/pages/item/_id.vue +++ b/pages/item/_id.vue @@ -46,6 +46,7 @@ {{ downloadItem ? 'downloading' : 'download' }} + @@ -102,6 +103,7 @@ export default { data() { return { resettingProgress: false, + isProcessingReadUpdate: false, showSelectLocalFolder: false } }, @@ -351,7 +353,22 @@ export default { console.log('New local library item', item.id) this.$set(this.libraryItem, 'localLibraryItem', item) } - } + }, + toggleFinished() { + var updatePayload = { + isFinished: !this.userIsFinished + } + this.isProcessingReadUpdate = true + this.$axios + .$patch(`/api/me/progress/${this.libraryItemId}`, updatePayload) + .then(() => { + this.isProcessingReadUpdate = false + }) + .catch((error) => { + console.error('Failed', error) + this.isProcessingReadUpdate = false + }) + }, }, mounted() { this.$eventBus.$on('new-local-library-item', this.newLocalLibraryItem) From 1fed00ca8172ad4c0e021ffb712e23dca1d32677 Mon Sep 17 00:00:00 2001 From: benonymity Date: Sun, 24 Apr 2022 22:02:22 -0400 Subject: [PATCH 2/8] Add localLIbraryProgress updates --- pages/item/_id.vue | 59 +++++++++++++++++++++++++++++++++++----------- 1 file changed, 45 insertions(+), 14 deletions(-) diff --git a/pages/item/_id.vue b/pages/item/_id.vue index 5a2dced5..71b21a41 100644 --- a/pages/item/_id.vue +++ b/pages/item/_id.vue @@ -354,21 +354,52 @@ export default { this.$set(this.libraryItem, 'localLibraryItem', item) } }, - toggleFinished() { - var updatePayload = { - isFinished: !this.userIsFinished - } + async toggleFinished() { this.isProcessingReadUpdate = true - this.$axios - .$patch(`/api/me/progress/${this.libraryItemId}`, updatePayload) - .then(() => { - this.isProcessingReadUpdate = false - }) - .catch((error) => { - console.error('Failed', error) - this.isProcessingReadUpdate = false - }) - }, + if (this.isLocal || this.localEpisode) { + var isFinished = !this.userIsFinished + var localMediaProgressId = this.localLibraryItemId + console.log('toggleFinished local media progress id', localMediaProgressId, isFinished) + var payload = await this.$db.updateLocalMediaProgressFinished({ localMediaProgressId, isFinished }) + console.log('toggleFinished payload', JSON.stringify(payload)) + if (!payload || payload.error) { + var errorMsg = payload ? payload.error : 'Unknown error' + this.$toast.error(errorMsg) + } else { + var localMediaProgress = payload.localMediaProgress + console.log('toggleFinished localMediaProgress', JSON.stringify(localMediaProgress)) + if (localMediaProgress) { + this.$store.commit('globals/updateLocalMediaProgress', localMediaProgress) + } + + var lmp = this.$store.getters['globals/getLocalMediaProgressById'](this.libraryItemId) + console.log('toggleFinished Check LMP', this.libraryItemId, JSON.stringify(lmp)) + + var serverUpdated = payload.server + if (serverUpdated) { + this.$toast.success(`Local & Server Item marked as ${isFinished ? 'Finished' : 'Not Finished'}`) + } else { + this.$toast.success(`Local Item marked as ${isFinished ? 'Finished' : 'Not Finished'}`) + } + } + this.isProcessingReadUpdate = false + } else { + var updatePayload = { + isFinished: !this.userIsFinished + } + this.$axios + .$patch(`/api/me/progress/${this.libraryItemId}`, updatePayload) + .then(() => { + this.isProcessingReadUpdate = false + this.$toast.success(`Item marked as ${updatePayload.isFinished ? 'Finished' : 'Not Finished'}`) + }) + .catch((error) => { + console.error('Failed', error) + this.isProcessingReadUpdate = false + this.$toast.error(`Failed to mark as ${updatePayload.isFinished ? 'Finished' : 'Not Finished'}`) + }) + } + } }, mounted() { this.$eventBus.$on('new-local-library-item', this.newLocalLibraryItem) From 415ff655619441ba8c3725d21727e18d1125cf6b Mon Sep 17 00:00:00 2001 From: benonymity Date: Wed, 27 Apr 2022 15:19:29 -0400 Subject: [PATCH 3/8] Display when local, add CSS classes --- pages/item/_id.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pages/item/_id.vue b/pages/item/_id.vue index 71b21a41..b2976755 100644 --- a/pages/item/_id.vue +++ b/pages/item/_id.vue @@ -33,6 +33,7 @@ auto_stories Read {{ ebookFormat }} +
@@ -46,7 +47,7 @@ {{ downloadItem ? 'downloading' : 'download' }} - +
From d99f4406b74b7a72daa02739c996ebb706df644e Mon Sep 17 00:00:00 2001 From: benonymity Date: Thu, 28 Apr 2022 13:21:47 -0400 Subject: [PATCH 4/8] Removed episode reference, smaller play button --- pages/item/_id.vue | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pages/item/_id.vue b/pages/item/_id.vue index bd5a4b41..f8a898ea 100644 --- a/pages/item/_id.vue +++ b/pages/item/_id.vue @@ -26,7 +26,7 @@
- + play_arrow {{ isPlaying ? 'Playing' : 'Play Local' }} @@ -37,7 +37,7 @@
- + play_arrow {{ isPlaying ? (isStreaming ? 'Streaming' : 'Playing') : hasLocal ? 'Play Local' : 'Play Stream' }} @@ -48,7 +48,7 @@ {{ downloadItem ? 'downloading' : 'download' }} - +
@@ -358,7 +358,7 @@ export default { }, async toggleFinished() { this.isProcessingReadUpdate = true - if (this.isLocal || this.localEpisode) { + if (this.isLocal) { var isFinished = !this.userIsFinished var localMediaProgressId = this.localLibraryItemId console.log('toggleFinished local media progress id', localMediaProgressId, isFinished) From 68e565ebe2677aa132638d24ccc37f92c358af1f Mon Sep 17 00:00:00 2001 From: benonymity Date: Thu, 28 Apr 2022 16:38:27 -0400 Subject: [PATCH 5/8] Don't show if a podcast --- pages/item/_id.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pages/item/_id.vue b/pages/item/_id.vue index f8a898ea..9c498ce5 100644 --- a/pages/item/_id.vue +++ b/pages/item/_id.vue @@ -34,7 +34,7 @@ auto_stories Read {{ ebookFormat }} - +
@@ -48,7 +48,7 @@ {{ downloadItem ? 'downloading' : 'download' }} - +
From ae4678cf245d2c69d1c4d460138c6d836948a90a Mon Sep 17 00:00:00 2001 From: benonymity Date: Thu, 28 Apr 2022 17:13:21 -0400 Subject: [PATCH 6/8] Resize button, no podcast downloads on iOS --- components/tables/podcast/EpisodeRow.vue | 11 ++++++++--- components/ui/ReadIconBtn.vue | 2 +- pages/item/_id.vue | 6 +++--- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/components/tables/podcast/EpisodeRow.vue b/components/tables/podcast/EpisodeRow.vue index 984afee8..aa0e422a 100644 --- a/components/tables/podcast/EpisodeRow.vue +++ b/components/tables/podcast/EpisodeRow.vue @@ -27,9 +27,11 @@ - audio_file - {{ downloadItem ? 'downloading' : 'download' }} - download_done +
+ audio_file + {{ downloadItem ? 'downloading' : 'download' }} + download_done +
@@ -61,6 +63,9 @@ export default { } }, computed: { + isIos() { + return this.$platform === 'ios' + }, mediaType() { return 'podcast' }, diff --git a/components/ui/ReadIconBtn.vue b/components/ui/ReadIconBtn.vue index 934b0c6b..0b9a9590 100644 --- a/components/ui/ReadIconBtn.vue +++ b/components/ui/ReadIconBtn.vue @@ -1,5 +1,5 @@