pull/1565/head
kunfei 3 years ago
parent 8d260f7f92
commit 89bcb66527
  1. 6
      app/src/main/java/io/legado/app/model/webBook/BookInfo.kt
  2. 5
      app/src/main/java/io/legado/app/ui/document/HandleFileActivity.kt

@ -13,6 +13,7 @@ import io.legado.app.utils.StringUtils.wordCountFormat
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.ensureActive
import splitties.init.appCtx
import timber.log.Timber
/**
* 获取详情
@ -86,6 +87,7 @@ object BookInfo {
} ?: Debug.log(bookSource.bookSourceUrl, "")
} catch (e: Exception) {
Debug.log(bookSource.bookSourceUrl, "${e.localizedMessage}")
Timber.e(e, "获取分类出错")
}
scope.ensureActive()
Debug.log(bookSource.bookSourceUrl, "┌获取字数")
@ -96,6 +98,7 @@ object BookInfo {
}
} catch (e: Exception) {
Debug.log(bookSource.bookSourceUrl, "${e.localizedMessage}")
Timber.e(e, "获取字数出错")
}
scope.ensureActive()
Debug.log(bookSource.bookSourceUrl, "┌获取最新章节")
@ -106,6 +109,7 @@ object BookInfo {
}
} catch (e: Exception) {
Debug.log(bookSource.bookSourceUrl, "${e.localizedMessage}")
Timber.e(e, "获取最新章节出错")
}
scope.ensureActive()
Debug.log(bookSource.bookSourceUrl, "┌获取简介")
@ -116,6 +120,7 @@ object BookInfo {
}
} catch (e: Exception) {
Debug.log(bookSource.bookSourceUrl, "${e.localizedMessage}")
Timber.e(e, "获取简介出错")
}
scope.ensureActive()
Debug.log(bookSource.bookSourceUrl, "┌获取封面链接")
@ -126,6 +131,7 @@ object BookInfo {
}
} catch (e: Exception) {
Debug.log(bookSource.bookSourceUrl, "${e.localizedMessage}")
Timber.e(e, "获取封面出错")
}
scope.ensureActive()
Debug.log(bookSource.bookSourceUrl, "┌获取目录链接")

@ -46,6 +46,11 @@ class HandleFileActivity :
private val selectDoc = registerForActivityResult(ActivityResultContracts.OpenDocument()) {
it?.let {
if (it.isContentScheme()) {
val modeFlags =
Intent.FLAG_GRANT_READ_URI_PERMISSION or Intent.FLAG_GRANT_WRITE_URI_PERMISSION
contentResolver.takePersistableUriPermission(it, modeFlags)
}
onResult(Intent().setData(it))
} ?: finish()
}

Loading…
Cancel
Save