|
|
@ -5,10 +5,7 @@ import android.content.Intent |
|
|
|
import io.legado.app.base.BaseViewModel |
|
|
|
import io.legado.app.base.BaseViewModel |
|
|
|
import io.legado.app.data.appDb |
|
|
|
import io.legado.app.data.appDb |
|
|
|
import io.legado.app.data.entities.RssSource |
|
|
|
import io.legado.app.data.entities.RssSource |
|
|
|
import io.legado.app.utils.GSON |
|
|
|
import io.legado.app.utils.* |
|
|
|
import io.legado.app.utils.fromJsonObject |
|
|
|
|
|
|
|
import io.legado.app.utils.getClipText |
|
|
|
|
|
|
|
import io.legado.app.utils.msg |
|
|
|
|
|
|
|
import kotlinx.coroutines.Dispatchers |
|
|
|
import kotlinx.coroutines.Dispatchers |
|
|
|
|
|
|
|
|
|
|
|
class RssSourceEditViewModel(application: Application) : BaseViewModel(application) { |
|
|
|
class RssSourceEditViewModel(application: Application) : BaseViewModel(application) { |
|
|
@ -40,7 +37,7 @@ class RssSourceEditViewModel(application: Application) : BaseViewModel(applicati |
|
|
|
}.onSuccess { |
|
|
|
}.onSuccess { |
|
|
|
success() |
|
|
|
success() |
|
|
|
}.onError { |
|
|
|
}.onError { |
|
|
|
toastOnUi(it.localizedMessage) |
|
|
|
context.toastOnUi(it.localizedMessage) |
|
|
|
it.printStackTrace() |
|
|
|
it.printStackTrace() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -53,12 +50,12 @@ class RssSourceEditViewModel(application: Application) : BaseViewModel(applicati |
|
|
|
} |
|
|
|
} |
|
|
|
source |
|
|
|
source |
|
|
|
}.onError { |
|
|
|
}.onError { |
|
|
|
toastOnUi(it.localizedMessage) |
|
|
|
context.toastOnUi(it.localizedMessage) |
|
|
|
}.onSuccess { |
|
|
|
}.onSuccess { |
|
|
|
if (it != null) { |
|
|
|
if (it != null) { |
|
|
|
onSuccess(it) |
|
|
|
onSuccess(it) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
toastOnUi("格式不对") |
|
|
|
context.toastOnUi("格式不对") |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -70,7 +67,7 @@ class RssSourceEditViewModel(application: Application) : BaseViewModel(applicati |
|
|
|
finally.invoke(it) |
|
|
|
finally.invoke(it) |
|
|
|
} |
|
|
|
} |
|
|
|
}.onError { |
|
|
|
}.onError { |
|
|
|
toastOnUi(it.msg) |
|
|
|
context.toastOnUi(it.msg) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|