Compare commits

..

1 Commits

Author SHA1 Message Date
dependabot[bot]
5fcd5d19b2
Merge 9130452f06 into ed6f8e5e43 2024-05-31 13:56:49 +08:00

View File

@ -27,7 +27,6 @@ import io.legado.app.help.book.BookHelp
import io.legado.app.help.book.ContentProcessor
import io.legado.app.help.book.getExportFileName
import io.legado.app.help.book.isLocal
import io.legado.app.help.book.isLocalModified
import io.legado.app.help.config.AppConfig
import io.legado.app.model.localBook.LocalBook
import io.legado.app.ui.book.cache.CacheActivity
@ -58,7 +57,6 @@ import kotlinx.coroutines.coroutineScope
import kotlinx.coroutines.ensureActive
import kotlinx.coroutines.flow.collectIndexed
import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.isActive
import kotlinx.coroutines.launch
import me.ag2s.epublib.domain.Author
import me.ag2s.epublib.domain.Date
@ -123,10 +121,7 @@ class ExportBookService : BaseService() {
toastOnUi(it.localizedMessage)
}
IntentAction.stop -> {
notificationManager.cancel(NotificationId.ExportBook)
stopSelf()
}
IntentAction.stop -> stopSelf()
}
return super.onStartCommand(intent, flags, startId)
}
@ -135,9 +130,6 @@ class ExportBookService : BaseService() {
super.onDestroy()
exportProgress.clear()
exportMsg.clear()
waitExportBooks.keys.forEach {
postEvent(EventBus.EXPORT_BOOK, it)
}
}
@SuppressLint("MissingPermission")
@ -176,7 +168,7 @@ class ExportBookService : BaseService() {
return
}
exportJob = lifecycleScope.launch(IO) {
while (isActive) {
while (true) {
val (bookUrl, exportConfig) = waitExportBooks.entries.firstOrNull() ?: let {
notificationContentText = "导出完成"
upExportNotification(true)
@ -208,7 +200,6 @@ class ExportBookService : BaseService() {
}
exportMsg[book.bookUrl] = getString(R.string.export_success)
} catch (e: Throwable) {
ensureActive()
exportMsg[bookUrl] = e.localizedMessage ?: "ERROR"
AppLog.put("导出书籍<${book?.name ?: bookUrl}>出错", e)
} finally {
@ -220,7 +211,10 @@ class ExportBookService : BaseService() {
}
private fun refreshChapterList(book: Book) {
if (!book.isLocal || !book.isLocalModified()) {
if (!book.isLocal) {
return
}
if (LocalBook.getLastModified(book).getOrDefault(0L) < book.latestChapterTime) {
return
}
kotlin.runCatching {