pull/2368/head
kunfei 2 years ago
parent 46a7ab9076
commit 5a26f87a71
  1. 3
      app/src/main/java/io/legado/app/ui/book/remote/RemoteBookViewModel.kt
  2. 3
      app/src/main/java/io/legado/app/ui/book/remote/manager/RemoteBookWebDav.kt

@ -3,6 +3,7 @@ package io.legado.app.ui.book.remote
import android.app.Application import android.app.Application
import io.legado.app.base.BaseViewModel import io.legado.app.base.BaseViewModel
import io.legado.app.constant.AppLog import io.legado.app.constant.AppLog
import io.legado.app.constant.BookType
import io.legado.app.model.localBook.LocalBook import io.legado.app.model.localBook.LocalBook
import io.legado.app.ui.book.remote.manager.RemoteBookWebDav import io.legado.app.ui.book.remote.manager.RemoteBookWebDav
import io.legado.app.utils.toastOnUi import io.legado.app.utils.toastOnUi
@ -96,7 +97,7 @@ class RemoteBookViewModel(application: Application) : BaseViewModel(application)
val downloadBookPath = RemoteBookWebDav.getRemoteBook(remoteBook) val downloadBookPath = RemoteBookWebDav.getRemoteBook(remoteBook)
downloadBookPath?.let { downloadBookPath?.let {
val localBook = LocalBook.importFile(it) val localBook = LocalBook.importFile(it)
localBook.origin= "webDav::" + remoteBook.path localBook.origin = BookType.webDav + remoteBook.path
localBook.save() localBook.save()
remoteBook.isOnBookShelf = true remoteBook.isOnBookShelf = true
} }

@ -2,6 +2,7 @@ package io.legado.app.ui.book.remote.manager
import android.net.Uri import android.net.Uri
import io.legado.app.constant.AppPattern.bookFileRegex import io.legado.app.constant.AppPattern.bookFileRegex
import io.legado.app.constant.BookType
import io.legado.app.data.entities.Book import io.legado.app.data.entities.Book
import io.legado.app.exception.NoStackTraceException import io.legado.app.exception.NoStackTraceException
import io.legado.app.help.AppWebDav import io.legado.app.help.AppWebDav
@ -99,7 +100,7 @@ object RemoteBookWebDav : RemoteBookManager() {
WebDav(putUrl, it).upload(localBookUri.path!!) WebDav(putUrl, it).upload(localBookUri.path!!)
} }
} }
book.origin = "webDav::" + putUrl book.origin = BookType.webDav + putUrl
book.save() book.save()
return true return true
} }

Loading…
Cancel
Save