pull/1319/head
gedoor 3 years ago
parent bb29a34d98
commit 4a55f0c52e
  1. 2
      app/src/main/java/io/legado/app/constant/AppLog.kt
  2. 2
      app/src/main/java/io/legado/app/ui/document/HandleFileViewModel.kt

@ -5,7 +5,7 @@ object AppLog {
val logs = arrayListOf<Triple<Long, String, Throwable?>>()
@Synchronized
fun addLog(message: String?, throwable: Throwable?) {
fun addLog(message: String?, throwable: Throwable? = null) {
message ?: return
if (logs.size > 100) {
logs.removeLastOrNull()

@ -5,6 +5,7 @@ import android.net.Uri
import androidx.documentfile.provider.DocumentFile
import androidx.lifecycle.MutableLiveData
import io.legado.app.base.BaseViewModel
import io.legado.app.constant.AppLog
import io.legado.app.help.DirectLinkUpload
import io.legado.app.utils.FileUtils
import io.legado.app.utils.isContentScheme
@ -27,6 +28,7 @@ class HandleFileViewModel(application: Application) : BaseViewModel(application)
}.onSuccess {
success.invoke(it)
}.onError {
AppLog.addLog("上传文件失败\n${it.localizedMessage}", it)
it.printOnDebug()
errorLiveData.postValue(it.localizedMessage)
}

Loading…
Cancel
Save