Compare commits

...

7 Commits

Author SHA1 Message Date
dependabot[bot]
170edff5b4
Merge e95db8ea1d into 72ff30b1ea 2024-05-31 22:54:32 +08:00
Horis
72ff30b1ea 优化 2024-05-31 19:04:36 +08:00
Horis
b30ef00307 优化 2024-05-31 18:53:02 +08:00
Horis
0cfd6ea46d 优化 2024-05-31 17:53:53 +08:00
Horis
96c76d74ba 优化 2024-05-31 17:51:28 +08:00
Horis
ed6f8e5e43 优化 2024-05-30 07:08:33 +08:00
dependabot[bot]
e95db8ea1d
Bump unplugin-icons from 0.18.5 to 0.19.0 in /modules/web
Bumps [unplugin-icons](https://github.com/unplugin/unplugin-icons) from 0.18.5 to 0.19.0.
- [Release notes](https://github.com/unplugin/unplugin-icons/releases)
- [Commits](https://github.com/unplugin/unplugin-icons/compare/v0.18.5...v0.19.0)

---
updated-dependencies:
- dependency-name: unplugin-icons
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-06 04:24:51 +00:00
3 changed files with 21 additions and 12 deletions

View File

@ -1,6 +1,7 @@
package io.legado.app.base package io.legado.app.base
import android.content.Intent import android.content.Intent
import android.os.Build
import android.os.IBinder import android.os.IBinder
import androidx.annotation.CallSuper import androidx.annotation.CallSuper
import androidx.lifecycle.LifecycleService import androidx.lifecycle.LifecycleService
@ -83,9 +84,11 @@ abstract class BaseService : LifecycleService() {
} }
} }
.request() .request()
PermissionsCompat.Builder() if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
.addPermissions(Permissions.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS) PermissionsCompat.Builder()
.rationale(R.string.ignore_battery_permission_rationale) .addPermissions(Permissions.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS)
.request() .rationale(R.string.ignore_battery_permission_rationale)
.request()
}
} }
} }

View File

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

View File

@ -34,7 +34,7 @@
"prettier": "^3.0.0", "prettier": "^3.0.0",
"sass": "^1.62.1", "sass": "^1.62.1",
"unplugin-auto-import": "^0.17.5", "unplugin-auto-import": "^0.17.5",
"unplugin-icons": "^0.18.5", "unplugin-icons": "^0.19.0",
"unplugin-vue-components": "^0.26.0", "unplugin-vue-components": "^0.26.0",
"vite": "^5.1.3" "vite": "^5.1.3"
} }