diff --git a/android/app/build.gradle b/android/app/build.gradle index 502c64c8..932cd907 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -13,8 +13,8 @@ android { applicationId "com.audiobookshelf.app" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 20 - versionName "0.9.4-beta" + versionCode 21 + versionName "0.9.5-beta" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" aaptOptions { // Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps. diff --git a/android/app/src/main/java/com/audiobookshelf/app/AudioDownloader.kt b/android/app/src/main/java/com/audiobookshelf/app/AudioDownloader.kt index a6c1e489..3d88985d 100644 --- a/android/app/src/main/java/com/audiobookshelf/app/AudioDownloader.kt +++ b/android/app/src/main/java/com/audiobookshelf/app/AudioDownloader.kt @@ -253,6 +253,7 @@ class AudioDownloader : Plugin() { var dlfilename = audiobookId + "." + File(filename).extension var coverdlfilename = audiobookId + "." + File(coverFilename).extension + Log.d(tag, "DL Filename $dlfilename | Cover DL Filename $coverdlfilename") var canWriteToFolder = folder.canWrite() if (!canWriteToFolder) { @@ -264,7 +265,7 @@ class AudioDownloader : Plugin() { } var dlRequest = DownloadManager.Request(Uri.parse(url)) - dlRequest.setTitle(title) + dlRequest.setTitle("Ab: $title") dlRequest.setDescription("Downloading to ${folder.name}") dlRequest.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED) dlRequest.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, dlfilename) @@ -295,21 +296,36 @@ class AudioDownloader : Plugin() { var doneReceiver : (id:Long, success: Boolean) -> Unit = { id:Long, success: Boolean -> Log.d(tag, "RECEIVER DONE $id, SUCCES? $success") var docfile:DocumentFile? = null + + // Download was complete, now find downloaded file if (id == coverDownloadId) { docfile = DocumentFileCompat.fromPublicFolder(context, PublicDirectory.DOWNLOADS, coverdlfilename) - Log.d(tag, "Move Cover File ${docfile?.name}") + + // For unknown reason, Android 10 test was using the title set in "setTitle" for the dl manager as the filename + // check if this was the case + if (docfile?.name == null) { + docfile = DocumentFileCompat.fromPublicFolder(context, PublicDirectory.DOWNLOADS, "Cover: $title") + Log.d(tag, "Cover File name attempt 2 ${docfile?.name}") + } } else if (id == audiobookDownloadId) { docfile = DocumentFileCompat.fromPublicFolder(context, PublicDirectory.DOWNLOADS, dlfilename) Log.d(tag, "Move Audiobook File ${docfile?.name}") + + if (docfile?.name == null) { + docfile = DocumentFileCompat.fromPublicFolder(context, PublicDirectory.DOWNLOADS, "Ab: $title") + Log.d(tag, "File name attempt 2 ${docfile?.name}") + } } + // Callback for moving the downloaded file var callback = object : FileCallback() { override fun onPrepare() { Log.d(tag, "PREPARING MOVE FILE") } override fun onFailed(errorCode:ErrorCode) { Log.e(tag, "FAILED MOVE FILE $errorCode") + docfile?.delete() coverDocFile?.delete() @@ -353,6 +369,7 @@ class AudioDownloader : Plugin() { } } + // After file is downloaded, move the files into an audiobook directory inside the user selected folder val executorService: ExecutorService = Executors.newFixedThreadPool(4) executorService.execute { if (id == coverDownloadId) { diff --git a/layouts/default.vue b/layouts/default.vue index 7076952c..2610cf4f 100644 --- a/layouts/default.vue +++ b/layouts/default.vue @@ -109,11 +109,13 @@ export default { // }) // }, async checkForUpdate() { + console.log('Checking for app update') const result = await AppUpdate.getAppUpdateInfo() if (!result) { console.error('Invalid version check') return } + console.log('App Update Info', JSON.stringify(result)) this.$store.commit('setAppUpdateInfo', result) if (result.updateAvailability === 2) { setTimeout(() => { diff --git a/package.json b/package.json index 7b2c2337..bfb567e7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "audiobookshelf-app", - "version": "v0.9.4-beta", + "version": "v0.9.5-beta", "author": "advplyr", "scripts": { "dev": "nuxt --hostname localhost --port 1337",