From 60ee33cb72333b0257449e71feea541fecb2268d Mon Sep 17 00:00:00 2001 From: advplyr Date: Sat, 14 May 2022 09:08:52 -0500 Subject: [PATCH] Update:Show download button on iOS and call downloadLibraryItem without a folderId --- pages/item/_id.vue | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/pages/item/_id.vue b/pages/item/_id.vue index 80430d1b..f0662415 100644 --- a/pages/item/_id.vue +++ b/pages/item/_id.vue @@ -49,7 +49,7 @@ auto_stories Read {{ ebookFormat }} - + {{ downloadItem ? 'downloading' : 'download' }} @@ -319,13 +319,17 @@ export default { if (this.downloadItem) { return } - this.download() - }, - async download(selectedLocalFolder = null) { if (!this.numTracks) { return } - + if (this.isIos) { + // no local folders on iOS + this.startDownload() + } else { + this.download() + } + }, + async download(selectedLocalFolder = null) { // Get the local folder to download to var localFolder = selectedLocalFolder if (!localFolder) { @@ -363,9 +367,15 @@ export default { this.startDownload(localFolder) } }, - async startDownload(localFolder) { - console.log('Starting download to local folder', localFolder.name) - var downloadRes = await AbsDownloader.downloadLibraryItem({ libraryItemId: this.libraryItemId, localFolderId: localFolder.id }) + async startDownload(localFolder = null) { + const payload = { + libraryItemId: this.libraryItemId + } + if (localFolder) { + console.log('Starting download to local folder', localFolder.name) + payload.localFolderId = localFolder.id + } + var downloadRes = await AbsDownloader.downloadLibraryItem(payload) if (downloadRes && downloadRes.error) { var errorMsg = downloadRes.error || 'Unknown error' console.error('Download error', errorMsg)