From 4dd67adcabc4c1a8b6a00b4f6781d7dff458f333 Mon Sep 17 00:00:00 2001 From: advplyr Date: Sat, 16 Dec 2023 17:21:19 -0600 Subject: [PATCH 1/2] Fix:Prevent pressing download buttons twice causing crash in iOS --- components/tables/podcast/EpisodeRow.vue | 23 ++++++++------- .../tables/podcast/LatestEpisodeRow.vue | 13 ++++----- pages/item/_id/_episode/index.vue | 13 +++++++-- pages/item/_id/index.vue | 28 +++++++++++-------- store/globals.js | 3 +- 5 files changed, 48 insertions(+), 32 deletions(-) diff --git a/components/tables/podcast/EpisodeRow.vue b/components/tables/podcast/EpisodeRow.vue index 8380f060..4319a285 100644 --- a/components/tables/podcast/EpisodeRow.vue +++ b/components/tables/podcast/EpisodeRow.vue @@ -9,22 +9,18 @@

No Server Media Progress

Local Media Progress {{ Math.round(localMediaProgress.progress * 100) }}

No Local Media Progress

- --> + -->

Published {{ $formatDate(publishedAt, 'MMM do, yyyy') }}

-

- {{ title }} -

+

{{ title }}

Episode #{{ episodeNumber }}
Season #{{ season }}
-
- {{ episodeType }} -
+
{{ episodeType }}
@@ -44,7 +40,7 @@
audio_file - {{ downloadItem ? 'downloading' : 'download' }} + {{ (downloadItem || startingDownload) ? 'downloading' : 'download' }} download_done
@@ -80,7 +76,8 @@ export default { data() { return { isProcessingReadUpdate: false, - processing: false + processing: false, + startingDownload: false } }, computed: { @@ -179,7 +176,13 @@ export default { return folderObj }, async downloadClick() { - if (this.downloadItem) return + if (this.downloadItem || this.startingDownload) return + + this.startingDownload = true + setTimeout(() => { + this.startingDownload = false + }, 1000) + await this.$hapticsImpact() if (this.isIos) { // no local folders on iOS diff --git a/components/tables/podcast/LatestEpisodeRow.vue b/components/tables/podcast/LatestEpisodeRow.vue index 2c99fd93..53f3dfa9 100644 --- a/components/tables/podcast/LatestEpisodeRow.vue +++ b/components/tables/podcast/LatestEpisodeRow.vue @@ -13,18 +13,14 @@
-

- {{ title }} -

+

{{ title }}

{{ $strings.LabelEpisode }} #{{ episodeNumber }}
{{ $strings.LabelSeason }} #{{ season }}
-
- {{ episodeType }} -
+
{{ episodeType }}
@@ -196,7 +192,10 @@ export default { } else { await this.download() } - this.pendingDownload = false + + setTimeout(() => { + this.pendingDownload = false + }, 1000) }, async download(selectedLocalFolder = null) { let localFolder = selectedLocalFolder diff --git a/pages/item/_id/_episode/index.vue b/pages/item/_id/_episode/index.vue index 43200a4a..0a5aa62c 100644 --- a/pages/item/_id/_episode/index.vue +++ b/pages/item/_id/_episode/index.vue @@ -34,7 +34,7 @@ {{ playerIsPlaying ? $strings.ButtonPause : localEpisodeId ? $strings.ButtonPlay : $strings.ButtonStream }} - {{ downloadItem ? 'downloading' : 'download' }} + {{ (downloadItem || startingDownload) ? 'downloading' : 'download' }} more_vert @@ -111,7 +111,8 @@ export default { return { showMoreMenu: false, processing: false, - resettingProgress: false + resettingProgress: false, + startingDownload: false } }, computed: { @@ -369,7 +370,13 @@ export default { } }, async downloadClick() { - if (this.downloadItem) return + if (this.downloadItem || this.startingDownload) return + + this.startingDownload = true + setTimeout(() => { + this.startingDownload = false + }, 1000) + await this.$hapticsImpact() if (this.isIos) { // no local folders on iOS diff --git a/pages/item/_id/index.vue b/pages/item/_id/index.vue index 55476524..068d9b74 100644 --- a/pages/item/_id/index.vue +++ b/pages/item/_id/index.vue @@ -54,7 +54,7 @@ {{ $strings.ButtonRead }} {{ ebookFormat }} - {{ downloadItem ? 'downloading' : 'download' }} + {{ (downloadItem || startingDownload) ? 'downloading' : 'download' }} more_vert @@ -79,8 +79,8 @@
{{ podcastAuthor }}
@@ -90,8 +90,8 @@
{{ $strings.LabelSeries }}
@@ -101,16 +101,16 @@
{{ $strings.LabelNarrators }}
{{ $strings.LabelGenres }}
@@ -206,7 +206,8 @@ export default { windowWidth: 0, descriptionClamped: false, showFullDescription: false, - episodeStartingPlayback: null + episodeStartingPlayback: null, + startingDownload: false } }, computed: { @@ -585,9 +586,14 @@ export default { this.download(localFolder) }, async downloadClick() { - if (this.downloadItem) { + if (this.downloadItem || this.startingDownload) { return } + this.startingDownload = true + setTimeout(() => { + this.startingDownload = false + }, 1000) + await this.$hapticsImpact() if (this.isIos) { // no local folders on iOS diff --git a/store/globals.js b/store/globals.js index 7b816d88..562e4fcb 100644 --- a/store/globals.js +++ b/store/globals.js @@ -46,7 +46,8 @@ export const state = () => ({ export const getters = { getDownloadItem: state => (libraryItemId, episodeId = null) => { return state.itemDownloads.find(i => { - if (episodeId && !i.episodes.some(e => e.id == episodeId)) return false + // if (episodeId && !i.episodes.some(e => e.id == episodeId)) return false + if (episodeId && i.episodeId !== episodeId) return false return i.libraryItemId == libraryItemId }) }, From 460daec72e0bfe78270d0df165111c8f6d11ba7a Mon Sep 17 00:00:00 2001 From: advplyr Date: Sat, 16 Dec 2023 17:21:43 -0600 Subject: [PATCH 2/2] iOS version bump 0.9.69 --- ios/App/App.xcodeproj/project.pbxproj | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ios/App/App.xcodeproj/project.pbxproj b/ios/App/App.xcodeproj/project.pbxproj index f0a14554..fe518c49 100644 --- a/ios/App/App.xcodeproj/project.pbxproj +++ b/ios/App/App.xcodeproj/project.pbxproj @@ -728,12 +728,12 @@ ASSETCATALOG_COMPILER_APPICON_NAME = Icons; CLANG_ENABLE_MODULES = YES; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 25; + CURRENT_PROJECT_VERSION = 26; DEVELOPMENT_TEAM = 7UFJ7D8V6A; INFOPLIST_FILE = App/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 14.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - MARKETING_VERSION = 0.9.68; + MARKETING_VERSION = 0.9.69; OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" \"-DDEBUG\""; PRODUCT_BUNDLE_IDENTIFIER = com.audiobookshelf.app.dev; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -752,12 +752,12 @@ ASSETCATALOG_COMPILER_APPICON_NAME = Icons; CLANG_ENABLE_MODULES = YES; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 25; + CURRENT_PROJECT_VERSION = 26; DEVELOPMENT_TEAM = 7UFJ7D8V6A; INFOPLIST_FILE = App/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 14.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - MARKETING_VERSION = 0.9.68; + MARKETING_VERSION = 0.9.69; PRODUCT_BUNDLE_IDENTIFIER = com.audiobookshelf.app; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_ACTIVE_COMPILATION_CONDITIONS = "";