diff --git a/org.thepalaceproject.android.platform b/org.thepalaceproject.android.platform index 7de19d560..78e41812c 160000 --- a/org.thepalaceproject.android.platform +++ b/org.thepalaceproject.android.platform @@ -1 +1 @@ -Subproject commit 7de19d560ca5ddff73938b405417384a61eb529a +Subproject commit 78e41812c1fe868f7daeb117bc451bf3ae9d05f2 diff --git a/simplified-books-database/src/main/java/org/nypl/simplified/books/book_database/DatabaseFormatHandleAudioBook.kt b/simplified-books-database/src/main/java/org/nypl/simplified/books/book_database/DatabaseFormatHandleAudioBook.kt index 89deac64b..f2c1f91ac 100644 --- a/simplified-books-database/src/main/java/org/nypl/simplified/books/book_database/DatabaseFormatHandleAudioBook.kt +++ b/simplified-books-database/src/main/java/org/nypl/simplified/books/book_database/DatabaseFormatHandleAudioBook.kt @@ -147,23 +147,6 @@ internal class DatabaseFormatHandleAudioBook internal constructor( } override fun deleteBookData() { - val newFormat = synchronized(this.dataLock) { - FileUtilities.fileDelete(this.filePosition) - - if (this.fileBook.isDirectory) { - DirectoryUtilities.directoryDelete(this.fileBook) - } else { - FileUtilities.fileDelete(this.fileBook) - } - - this.formatRef = this.formatRef.copy( - file = null, - lastReadLocation = null - ) - - this.formatRef - } - val briefID = this.parameters.bookID.brief() this.log.debug("[{}]: deleting audio book data", briefID) @@ -237,11 +220,25 @@ internal class DatabaseFormatHandleAudioBook internal constructor( } } } catch (ex: Exception) { - this.log.error("[{}]: failed to delete audio book: ", briefID, ex) - throw ex + this.log.error("[{}]: Problem deleting audio book: ", briefID, ex) } - this.parameters.onUpdated.invoke(newFormat) + this.parameters.onUpdated.invoke(synchronized(dataLock) { + FileUtilities.fileDelete(filePosition) + + if (fileBook.isDirectory) { + DirectoryUtilities.directoryDelete(fileBook) + } else { + FileUtilities.fileDelete(fileBook) + } + + formatRef = formatRef.copy( + file = null, + lastReadLocation = null + ) + + formatRef + }) } override fun deleteBookmark(bookmarkId: BookmarkID) {