Compare commits

..

1 Commits

Author SHA1 Message Date
kunfei
e001061386
Merge 6c9a8a74bd into ed6f8e5e43 2024-05-30 07:41:36 +08:00
2 changed files with 6 additions and 16 deletions

View File

@ -81,10 +81,6 @@ class PermissionActivity : AppCompatActivity() {
kotlin.runCatching {
val intent = Intent(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS)
intent.setData(Uri.parse("package:$packageName"))
intent.setClassName(
"com.android.settings",
"com.android.settings.fuelgauge.RequestIgnoreBatteryOptimizations"
)
settingActivityResult.launch(intent)
}
}

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 {